-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathApp.xaml.cs
80 lines (68 loc) · 2.81 KB
/
App.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System.Windows;
using System.Windows.Media;
using ControlzEx.Theming;
using PPMusic.View;
using PPMusic.View.MainContentPages;
using PPMusic.View.Menu;
using PPMusic.View.PlayerCommandsBar;
using PPMusic.View.PlayingSong;
using PPMusic.View.TitleBar;
using PPMusic.ViewModel;
using PPMusic.ViewModel.MainContentPages;
using PPMusic.ViewModel.Menu;
using PPMusic.ViewModel.PlayerCommandsBar;
using PPMusic.ViewModel.TitleBar;
using Prism.Ioc;
using Prism.Mvvm;
namespace PPMusic
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App
{
public App()
{
var color = Color.FromRgb(31, 211, 182);
var theme = new Theme(
"Light.PPGreenBlue",
"PPGreenBlue(Light)",
"Light",
"PPGreenBlue",
color,
new SolidColorBrush(color),
false,
false
);
ThemeManager.Current.AddTheme(theme);
}
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
//注册导航地址薄
var navigationCatalog = new NavigationCatalog();
containerRegistry.RegisterInstance(navigationCatalog);
//注册假数据创建器
containerRegistry.RegisterSingleton<FakeDataCreator>();
//注册播放控制栏视图模型的单例,由于会出现多个播放控制栏 共享一个视图模型的情况,所以将其设为单例
containerRegistry.RegisterSingleton<PlayerCommandsBarViewModel>();
//注册导航
containerRegistry.RegisterForNavigation<Recommend>(navigationCatalog.Recommend);
containerRegistry.RegisterForNavigation<MusicHall>(navigationCatalog.MusicHall);
}
protected override void ConfigureViewModelLocator()
{
base.ConfigureViewModelLocator();
ViewModelLocationProvider.Register<ShellWindow, ShellWindowViewModel>();
ViewModelLocationProvider.Register<PlayerCommandsBar, PlayerCommandsBarViewModel>();
ViewModelLocationProvider.Register<PlayingSong, PlayerCommandsBarViewModel>();
ViewModelLocationProvider.Register<Menus, MenusViewModel>();
ViewModelLocationProvider.Register<TitleBar, TitleBarViewModel>();
ViewModelLocationProvider.Register<Recommend, RecommendViewModel>();
ViewModelLocationProvider.Register<MusicHall, MusicHallViewModel>();
}
protected override Window CreateShell()
{
return Container.Resolve<ShellWindow>();
}
}
}