1
- using MahApps . Metro . Controls ;
1
+ using FolderBrowserEx ;
2
+ using MahApps . Metro . Controls ;
2
3
using MahApps . Metro . Controls . Dialogs ;
3
4
using Microsoft . Win32 ;
4
5
using System . Collections . Generic ;
5
6
using System . IO ;
6
7
using System . Threading . Tasks ;
7
- using System . Web . UI . WebControls ;
8
8
using System . Windows ;
9
- using System . Windows . Input ;
10
- using WPFFolderBrowser ;
9
+ using System . Windows . Forms ;
10
+ using FolderBrowserDialog = FolderBrowserEx . FolderBrowserDialog ;
11
11
12
12
namespace MessageDialogManagerLib
13
13
{
14
14
public class MessageDialogManagerMahapps : IMessageDialogManager
15
15
{
16
16
private ProgressDialogController _controller ;
17
- private Application _app ;
17
+ private System . Windows . Application _app ;
18
18
/// <summary>
19
19
/// We have to use this private variable instead a local variable to show a custom dialog
20
20
/// to avoid an error closing the dialog
@@ -26,7 +26,7 @@ public class MessageDialogManagerMahapps : IMessageDialogManager
26
26
public string FolderPath { get ; set ; }
27
27
public string FilePath { get ; set ; }
28
28
29
- public MessageDialogManagerMahapps ( Application app )
29
+ public MessageDialogManagerMahapps ( System . Windows . Application app )
30
30
{
31
31
_app = app ;
32
32
_customDialogs = new Dictionary < IDialogViewModel , CustomDialog > ( ) ;
@@ -77,18 +77,12 @@ public async Task CloseProgress()
77
77
public bool ShowFolderBrowser ( string title , string initialDirectory )
78
78
{
79
79
bool res = false ;
80
- WPFFolderBrowserDialog ofd = new WPFFolderBrowserDialog ( ) ;
81
-
82
- if ( Directory . Exists ( initialDirectory ) )
83
- ofd . InitialDirectory = initialDirectory ;
84
- else
85
- ofd . InitialDirectory = "" ;
86
- ofd . Title = title ;
87
-
88
- if ( ofd . ShowDialog ( ) == true )
80
+ FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog ( ) ;
81
+ folderBrowserDialog . Title = title ;
82
+ if ( folderBrowserDialog . ShowDialog ( ) == DialogResult . OK )
89
83
{
90
- FolderPath = ofd . FileName ;
91
- res = true ;
84
+ FolderPath = folderBrowserDialog . SelectedFolder ;
85
+ res = true ;
92
86
}
93
87
return res ;
94
88
}
@@ -97,7 +91,7 @@ public bool ShowFileBrowser(string title, string initialPath, string filter)
97
91
{
98
92
bool res = false ;
99
93
100
- OpenFileDialog openFileDialog = new OpenFileDialog ( ) ;
94
+ Microsoft . Win32 . OpenFileDialog openFileDialog = new Microsoft . Win32 . OpenFileDialog ( ) ;
101
95
if ( Directory . Exists ( initialPath ) )
102
96
openFileDialog . InitialDirectory = initialPath ;
103
97
else
0 commit comments