diff --git a/Livet.props b/Livet.props
index f71d6ed..87639eb 100644
--- a/Livet.props
+++ b/Livet.props
@@ -1,7 +1,7 @@
- 3.2.3.1
+ 3.2.3.2
$(Version)
diff --git a/LivetCask.Extensions/Behaviors/Messaging/IO/FolderBrowserDialogInteractionMessageAction.cs b/LivetCask.Extensions/Behaviors/Messaging/IO/FolderBrowserDialogInteractionMessageAction.cs
index f7749db..d813726 100644
--- a/LivetCask.Extensions/Behaviors/Messaging/IO/FolderBrowserDialogInteractionMessageAction.cs
+++ b/LivetCask.Extensions/Behaviors/Messaging/IO/FolderBrowserDialogInteractionMessageAction.cs
@@ -1,4 +1,5 @@
using System;
+using System.Linq;
using System.Windows;
using Livet.Dialogs;
using Livet.Messaging;
@@ -32,10 +33,17 @@ protected override void InvokeAction(InteractionMessage m)
dialog.Title = folderSelectionMessage.Title;
dialog.Description = folderSelectionMessage.Description;
dialog.SelectedPath = folderSelectionMessage.SelectedPath;
+ dialog.Multiselect = folderSelectionMessage.Multiselect;
- folderSelectionMessage.Response = dialog.ShowDialog(hostWindow).GetValueOrDefault()
- ? dialog.SelectedPath
- : null;
+ if (dialog.ShowDialog(hostWindow).GetValueOrDefault())
+ {
+ folderSelectionMessage.SelectedPaths = dialog.SelectedPaths;
+ folderSelectionMessage.Response = folderSelectionMessage.SelectedPaths.FirstOrDefault();
+ }
+ else
+ {
+ folderSelectionMessage.Response = null;
+ }
}
}
}
diff --git a/LivetCask.Extensions/Dialogs/CommonOpenFileFolderSelectionDialog.cs b/LivetCask.Extensions/Dialogs/CommonOpenFileFolderSelectionDialog.cs
index 0f3b13f..4bae0fc 100644
--- a/LivetCask.Extensions/Dialogs/CommonOpenFileFolderSelectionDialog.cs
+++ b/LivetCask.Extensions/Dialogs/CommonOpenFileFolderSelectionDialog.cs
@@ -1,5 +1,7 @@
using System;
+using System.Collections.Generic;
using System.IO;
+using System.Linq;
using System.Windows;
using Livet.Annotations;
using Microsoft.WindowsAPICodePack.Dialogs;
@@ -19,7 +21,7 @@ internal sealed class CommonOpenFileFolderSelectionDialog : FolderSelectionDialo
///
public CommonOpenFileFolderSelectionDialog()
{
- _commonOpenFileDialog = new CommonOpenFileDialog {IsFolderPicker = true, Multiselect = false};
+ _commonOpenFileDialog = new CommonOpenFileDialog { IsFolderPicker = true, Multiselect = false };
_defaultTitle = _commonOpenFileDialog.Title;
}
@@ -47,6 +49,16 @@ public override string Description
set { }
}
+ ///
+ /// Gets or sets whether the multi selection is enabled on the folder browser dialog.
+ ///
+ public override bool Multiselect
+ {
+ get { return _commonOpenFileDialog.Multiselect; }
+
+ set { _commonOpenFileDialog.Multiselect = value; }
+ }
+
///
/// Gets or sets the selected path.
///
@@ -76,6 +88,14 @@ public override string SelectedPath
}
}
+ ///
+ /// Gets or sets the selected paths.
+ ///
+ public override string[] SelectedPaths
+ {
+ get { return _commonOpenFileDialog.FileNames.ToArray(); }
+ }
+
///
/// Releases unmanaged and - optionally - managed resources
///
diff --git a/LivetCask.Extensions/Dialogs/FolderBrowserFolderSelectionDialog.cs b/LivetCask.Extensions/Dialogs/FolderBrowserFolderSelectionDialog.cs
index 902a9f0..5793dfd 100644
--- a/LivetCask.Extensions/Dialogs/FolderBrowserFolderSelectionDialog.cs
+++ b/LivetCask.Extensions/Dialogs/FolderBrowserFolderSelectionDialog.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows;
@@ -71,6 +72,26 @@ public override string Title
set { }
}
+
+ ///
+ /// This property is not supported.
+ ///
+ /// Always false.
+ public override bool Multiselect
+ {
+ get { return false; }
+ set { }
+ }
+
+ ///
+ /// Gets or sets the selected paths.
+ ///
+ /// Always return SelectedPath.
+ public override string[] SelectedPaths
+ {
+ get { return new[] { SelectedPath }; }
+ }
+
///
/// Releases unmanaged and - optionally - managed resources
///
diff --git a/LivetCask.Extensions/Dialogs/FolderSelectionDialog.cs b/LivetCask.Extensions/Dialogs/FolderSelectionDialog.cs
index 2a98b0e..7a4a3b4 100644
--- a/LivetCask.Extensions/Dialogs/FolderSelectionDialog.cs
+++ b/LivetCask.Extensions/Dialogs/FolderSelectionDialog.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Windows;
namespace Livet.Dialogs
@@ -35,6 +36,17 @@ internal abstract class FolderSelectionDialog : IDisposable
///
public abstract string Title { get; set; }
+
+ ///
+ /// Gets or sets whether the multi selection is enabled on the folder browser dialog.
+ ///
+ public abstract bool Multiselect { get; set; }
+
+ ///
+ /// Gets or sets the selected paths.
+ ///
+ public abstract string[] SelectedPaths { get; }
+
///
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
///
diff --git a/LivetCask.Extensions/Messaging/IO/FolderSelectionMessage.cs b/LivetCask.Extensions/Messaging/IO/FolderSelectionMessage.cs
index 01711ed..9da3438 100644
--- a/LivetCask.Extensions/Messaging/IO/FolderSelectionMessage.cs
+++ b/LivetCask.Extensions/Messaging/IO/FolderSelectionMessage.cs
@@ -19,7 +19,8 @@ public sealed class FolderSelectionMessage : ResponsiveInteractionMessage
/// .
///
- [NotNull] public static readonly DependencyProperty DescriptionProperty =
+ [NotNull]
+ public static readonly DependencyProperty DescriptionProperty =
DependencyProperty.Register("Description", typeof(string), typeof(FolderSelectionMessage),
new UIPropertyMetadata(null));
@@ -29,7 +30,8 @@ public sealed class FolderSelectionMessage : ResponsiveInteractionMessage
/// .
///
- [NotNull] public static readonly DependencyProperty TitleProperty =
+ [NotNull]
+ public static readonly DependencyProperty TitleProperty =
DependencyProperty.Register("Title", typeof(string), typeof(FolderSelectionMessage),
new UIPropertyMetadata(string.Empty));
@@ -39,19 +41,44 @@ public sealed class FolderSelectionMessage : ResponsiveInteractionMessage
/// .
///
- [NotNull] public static readonly DependencyProperty SelectedPathProperty =
+ [NotNull]
+ public static readonly DependencyProperty SelectedPathProperty =
DependencyProperty.Register("SelectedPath", typeof(string), typeof(FolderSelectionMessage),
new UIPropertyMetadata(string.Empty));
+ ///
+ /// Defines dependency property.
+ ///
+ ///
+ /// .
+ ///
+ [NotNull]
+ public static readonly DependencyProperty SelectedPathsProperty =
+ DependencyProperty.Register("SelectedPaths", typeof(string[]), typeof(FolderSelectionMessage),
+ new UIPropertyMetadata(new[] { string.Empty }));
+
///
/// Defines dependency property.
///
///
/// .
///
- [NotNull] public static readonly DependencyProperty DialogPreferenceProperty =
+ [NotNull]
+ public static readonly DependencyProperty DialogPreferenceProperty =
DependencyProperty.Register("DialogPreference", typeof(FolderSelectionDialogPreference),
typeof(FileSelectionMessage), new UIPropertyMetadata(FolderSelectionDialogPreference.None));
+ ///
+ /// Defines dependency property.
+ ///
+ ///
+ /// .
+ ///
+ [NotNull]
+ public static readonly DependencyProperty MultiselectProperty =
+ DependencyProperty.Register("Multiselect", typeof(bool),
+ typeof(FileSelectionMessage), new UIPropertyMetadata(false));
+
+
///
/// Initializes a new instance of the class
@@ -92,6 +119,15 @@ public string Title
set { SetValue(TitleProperty, value); }
}
+ ///
+ /// Gets or sets whether the multi selection is enabled on the folder browser dialog.
+ ///
+ public bool Multiselect
+ {
+ get { return (bool)GetValue(MultiselectProperty); }
+ set { SetValue(MultiselectProperty, value); }
+ }
+
///
/// Gets or sets the selected path on the folder selection dialog.
///
@@ -105,6 +141,18 @@ public string SelectedPath
set { SetValue(SelectedPathProperty, value); }
}
+ ///
+ /// Gets or sets the selected paths on the folder selection dialog.
+ ///
+ ///
+ /// The selected paths on the folder selection dialog.
+ ///
+ public string[] SelectedPaths
+ {
+ get { return GetValue(SelectedPathsProperty) as string[]; }
+ set { SetValue(SelectedPathsProperty, value); }
+ }
+
///
/// Gets or sets the dialog preference.
///
@@ -117,7 +165,7 @@ public FolderSelectionDialogPreference DialogPreference
{
var value = GetValue(DialogPreferenceProperty);
return value?.GetType() == typeof(FolderSelectionDialogPreference)
- ? (FolderSelectionDialogPreference) value
+ ? (FolderSelectionDialogPreference)value
: default;
}
set { SetValue(DialogPreferenceProperty, value); }
diff --git a/README.md b/README.md
index d5e6e0d..025b925 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,15 @@ zlib/libpng ライセンスでは、ライブラリとしての利用にとど
しかし、ソースコードを改変しての再配布にはその旨の明示が義務付けられます。
+## GitHub スポンサー
+
+応援してもらえるとモチベーションが上がります。
+
+|Name|GitHub Sponsors|
+|----|----|
+|runceel|https://github.com/sponsors/runceel|
+
+
## 導入
Livet は Visual Studio 2019 の拡張機能を使用することでプロジェクトテンプレートやアイテムテンプレートやコードスニペットが追加され生産性が一番高い状態で開発が出来るように設計されています。
diff --git a/Samples/ViewLayerSupport/ViewModels/MessagingWindowViewModel.cs b/Samples/ViewLayerSupport/ViewModels/MessagingWindowViewModel.cs
index 158fecb..567007b 100644
--- a/Samples/ViewLayerSupport/ViewModels/MessagingWindowViewModel.cs
+++ b/Samples/ViewLayerSupport/ViewModels/MessagingWindowViewModel.cs
@@ -76,11 +76,25 @@ public void ConfirmFromView([NotNull] ConfirmationMessage message)
OutputMessage = $"{DateTime.Now}: ConfirmFromView: {message.Response ?? false}";
}
+ public void FileSelected([NotNull] OpeningFileSelectionMessage message)
+ {
+ if (message == null) throw new ArgumentNullException(nameof(message));
+
+
+ string selectedPaths = message.Response == null
+ ? "未選択"
+ : String.Join(";", message.Response);
+ OutputMessage = $"{DateTime.Now}: FileSelected: {selectedPaths}";
+ }
public void FolderSelected([NotNull] FolderSelectionMessage message)
{
if (message == null) throw new ArgumentNullException(nameof(message));
- OutputMessage = $"{DateTime.Now}: FolderSelected: {message.Response ?? "未選択"}";
+ string selectedPaths = message.Response == null
+ ? "未選択"
+ : String.Join(";", message.SelectedPaths);
+
+ OutputMessage = $"{DateTime.Now}: FolderSelected: {selectedPaths}";
}
public void Initialize() { }
diff --git a/Samples/ViewLayerSupport/Views/MessagingWindow.xaml b/Samples/ViewLayerSupport/Views/MessagingWindow.xaml
index cdcc582..a073f01 100644
--- a/Samples/ViewLayerSupport/Views/MessagingWindow.xaml
+++ b/Samples/ViewLayerSupport/Views/MessagingWindow.xaml
@@ -1,75 +1,109 @@
+ x:Class="ViewLayerSupport.Views.MessagingWindow"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
+ xmlns:l="http://schemas.livet-mvvm.net/2011/wpf"
+ xmlns:v="clr-namespace:ViewLayerSupport.Views"
+ xmlns:vm="clr-namespace:ViewLayerSupport.ViewModels"
+ Title="MessagingWindow"
+ Width="525"
+ Height="350">
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file