3 using System.Collections.Generic;
5 using System.Windows.Threading;
6 using Microsoft.WindowsAPICodePack.Dialogs;
7 using SiliconStudio.Presentation.Services;
9 namespace SiliconStudio.Presentation.Dialogs
14 : base(dispatcher, parentWindow)
16 Dialog =
new CommonOpenFileDialog { EnsureFileExists =
true };
17 Filters =
new List<FileDialogFilter>();
18 FilePaths =
new List<string>();
22 public bool AllowMultiSelection {
get {
return OpenDlg.Multiselect; } set { OpenDlg.Multiselect = value; } }
25 public IList<FileDialogFilter> Filters {
get; set; }
28 public IReadOnlyCollection<string> FilePaths {
get;
private set; }
31 public string InitialDirectory {
get {
return OpenDlg.InitialDirectory; } set { OpenDlg.InitialDirectory = value != null ? value.Replace(
'/',
'\\') : null; } }
34 public string DefaultFileName {
get {
return OpenDlg.DefaultFileName; } set { OpenDlg.DefaultFileName = value; } }
36 private CommonOpenFileDialog OpenDlg {
get {
return (CommonOpenFileDialog)Dialog; } }
41 OpenDlg.Filters.Clear();
42 foreach (var filter
in Filters)
44 OpenDlg.Filters.Add(
new CommonFileDialogFilter(filter.Description, filter.ExtensionList));
46 var result = InvokeDialog();
47 FilePaths = result != DialogResult.Cancel ?
new List<string>(OpenDlg.FileNames) :
new List<string>();
override DialogResult Show()
Display the modal dialog. This method will block until the user close the dialog. A DialogResult valu...
DialogResult
An enum representing the result of a dialog invocation.
An interface representing a modal file open dialog.