-
Notifications
You must be signed in to change notification settings - Fork 3.4k
/
DialogsViewModel.cs
59 lines (48 loc) · 2.13 KB
/
DialogsViewModel.cs
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
namespace MahMaterialDragablzMashUp
{
public class DialogsViewModel
{
public ICommand ShowInputDialogCommand { get; }
public ICommand ShowProgressDialogCommand { get; }
public ICommand ShowLeftFlyoutCommand { get; }
private ResourceDictionary DialogDictionary = new ResourceDictionary() { Source = new Uri("pack://application:,,,/MaterialDesignThemes.MahApps;component/Themes/MaterialDesignTheme.MahApps.Dialogs.xaml") };
public DialogsViewModel()
{
ShowInputDialogCommand = new AnotherCommandImplementation(_ => InputDialog());
ShowProgressDialogCommand = new AnotherCommandImplementation(_ => ProgressDialog());
ShowLeftFlyoutCommand = new AnotherCommandImplementation(_ => ShowLeftFlyout());
}
public Flyout LeftFlyout { get; set; }
private void InputDialog()
{
var metroDialogSettings = new MetroDialogSettings
{
CustomResourceDictionary = DialogDictionary,
NegativeButtonText = "CANCEL"
};
DialogCoordinator.Instance.ShowInputAsync(this, "MahApps Dialog", "Using Material Design Themes", metroDialogSettings);
}
private async void ProgressDialog()
{
var metroDialogSettings = new MetroDialogSettings
{
CustomResourceDictionary = DialogDictionary,
NegativeButtonText = "CANCEL"
};
var controller = await DialogCoordinator.Instance.ShowProgressAsync(this, "MahApps Dialog", "Using Material Design Themes (WORK IN PROGRESS)", true, metroDialogSettings);
controller.SetIndeterminate();
await Task.Delay(3000);
await controller.CloseAsync();
}
private void ShowLeftFlyout()
{
((MainWindow)Application.Current.MainWindow).LeftFlyout.IsOpen = !((MainWindow)Application.Current.MainWindow).LeftFlyout.IsOpen;
}
}
}