forked from lepoco/wpfui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml.cs
65 lines (49 loc) · 1.85 KB
/
MainWindow.xaml.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
60
61
62
63
64
65
using $safeprojectname$.ViewModels.Windows;
using Wpf.Ui;
using Wpf.Ui.Abstractions;
using Wpf.Ui.Appearance;
using Wpf.Ui.Controls;
namespace $safeprojectname$.Views.Windows
{
public partial class MainWindow : INavigationWindow
{
public MainWindowViewModel ViewModel { get; }
public MainWindow(
MainWindowViewModel viewModel,
INavigationViewPageProvider navigationViewPageProvider,
INavigationService navigationService
)
{
ViewModel = viewModel;
DataContext = this;
SystemThemeWatcher.Watch(this);
InitializeComponent();
SetPageService(navigationViewPageProvider);
navigationService.SetNavigationControl(RootNavigation);
}
#region INavigationWindow methods
public INavigationView GetNavigation() => RootNavigation;
public bool Navigate(Type pageType) => RootNavigation.Navigate(pageType);
public void SetPageService(INavigationViewPageProvider navigationViewPageProvider) => RootNavigation.SetPageProviderService(navigationViewPageProvider);
public void ShowWindow() => Show();
public void CloseWindow() => Close();
#endregion INavigationWindow methods
/// <summary>
/// Raises the closed event.
/// </summary>
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
// Make sure that closing this window will begin the process of closing the application.
Application.Current.Shutdown();
}
INavigationView INavigationWindow.GetNavigation()
{
throw new NotImplementedException();
}
public void SetServiceProvider(IServiceProvider serviceProvider)
{
throw new NotImplementedException();
}
}
}