-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml.cs
More file actions
37 lines (35 loc) · 1.15 KB
/
MainWindow.xaml.cs
File metadata and controls
37 lines (35 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System.Windows;
using SyncDateTime.ViewModel;
using GalaSoft.MvvmLight.Messaging;
using SyncDateTime.Messages;
namespace SyncDateTime
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
/// <summary>
/// Initializes a new instance of the MainWindow class.
/// </summary>
public MainWindow()
{
InitializeComponent();
Closing += (s, e) => ViewModelLocator.Cleanup();
Messenger.Default.Register<SelectFolderMessage>(
this,
msg =>
{
var dialog = new System.Windows.Forms.FolderBrowserDialog();
dialog.Reset();
dialog.RootFolder = System.Environment.SpecialFolder.MyComputer;
dialog.SelectedPath = msg.Path;
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
// Send callback
msg.ProcessCallback(dialog.SelectedPath);
}
});
}
}
}