diff --git a/App.xaml b/App.xaml
index c2e3ab2..95ef6d0 100644
--- a/App.xaml
+++ b/App.xaml
@@ -24,8 +24,8 @@
-
-
+
+
diff --git a/MainWindow.xaml b/MainWindow.xaml
index 336e397..7416db7 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -50,7 +50,7 @@
-
+
@@ -144,7 +144,7 @@
-
+
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index d83b0e0..8946d4d 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -29,7 +29,9 @@ public partial class MainWindow
protected override void OnContentRendered(EventArgs e)
{
base.OnContentRendered(e);
- DataContext = MainViewModel.Instance;
+ MainViewModel mainVM = new MainViewModel();
+ DataContext = mainVM;
+ WindowManager.mainViewModel = mainVM;
Logger.Debug("OnContentRendered -------");
}
diff --git a/Resource/Images/config_3x.png b/Resource/Images/config_3x.png
new file mode 100644
index 0000000..bfcb95b
Binary files /dev/null and b/Resource/Images/config_3x.png differ
diff --git a/Resource/Images/diam_3x.png b/Resource/Images/diam_3x.png
new file mode 100644
index 0000000..508a974
Binary files /dev/null and b/Resource/Images/diam_3x.png differ
diff --git a/Resource/Images/hand_3x.png b/Resource/Images/hand_3x.png
new file mode 100644
index 0000000..f7c8f2a
Binary files /dev/null and b/Resource/Images/hand_3x.png differ
diff --git a/Resource/Images/help_3x.png b/Resource/Images/help_3x.png
new file mode 100644
index 0000000..8e1c01a
Binary files /dev/null and b/Resource/Images/help_3x.png differ
diff --git a/SparkClient.csproj b/SparkClient.csproj
index 8127cb4..b6fba99 100644
--- a/SparkClient.csproj
+++ b/SparkClient.csproj
@@ -27,6 +27,14 @@
Always
+
+
+
+
+
+
+
+
diff --git a/SparkClient.sln.DotSettings.user b/SparkClient.sln.DotSettings.user
index 95c6472..1df1a09 100644
--- a/SparkClient.sln.DotSettings.user
+++ b/SparkClient.sln.DotSettings.user
@@ -1,6 +1,8 @@
ForceIncluded
ForceIncluded
+ ForceIncluded
+ ForceIncluded
ForceIncluded
ForceIncluded
ForceIncluded
diff --git a/ViewModel/BaseViewModel.cs b/ViewModel/BaseViewModel.cs
index 41db4bb..c9220e7 100644
--- a/ViewModel/BaseViewModel.cs
+++ b/ViewModel/BaseViewModel.cs
@@ -11,7 +11,7 @@ public class BaseViewModel : INotifyPropertyChanged
protected void OnPropertyChanged([CallerMemberName] string propertyName = null) {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
-
+
public class RelayCommand : ICommand
{
diff --git a/ViewModel/BaseWindow/BaseControlVM.cs b/ViewModel/BaseWindow/BaseControlVM.cs
index bfef468..3c2e4f7 100644
--- a/ViewModel/BaseWindow/BaseControlVM.cs
+++ b/ViewModel/BaseWindow/BaseControlVM.cs
@@ -22,11 +22,16 @@ public class BaseControlVM : BaseViewModel
public object Content { get; }
public ICommand CloseCommand { get; }
- public BaseControlVM(MainViewModel mainViewModel, object content)
+ public BaseControlVM(BaseViewModel vm)
{
- Content = content;
- CloseCommand = mainViewModel.ShowHomeCommand; // 返回 HomeWindow
+ Content = vm;
+
+ CloseCommand = new RelayCommand(CloseVM);
+ }
+
+ public void CloseVM(object parameter)
+ {
+ WindowManager.mainViewModel.Content = WindowManager.PreviousVM();
}
-
}
\ No newline at end of file
diff --git a/ViewModel/BaseWindow/HomeWindowVM.cs b/ViewModel/BaseWindow/HomeWindowVM.cs
index 57373c2..a97c629 100644
--- a/ViewModel/BaseWindow/HomeWindowVM.cs
+++ b/ViewModel/BaseWindow/HomeWindowVM.cs
@@ -6,14 +6,17 @@ namespace SparkClient.ViewModel.BaseWindow;
public class HomeWindowVM : BaseViewModel
{
- private readonly MainViewModel _mainViewModel;
+ public ICommand ShowHelperPageCommand { get; }
- public ICommand ShowHelperPageCommand => _mainViewModel.ShowHelperPageCommand;
- public ICommand ShowSettingsPageCommand => _mainViewModel.ShowSettingsPageCommand;
- public ICommand ShowProfilePageCommand => _mainViewModel.ShowProfilePageCommand;
+ public HomeWindowVM()
+ {
+ ShowHelperPageCommand = new RelayCommand(ShowHelperPage);
+ }
- public HomeWindowVM(MainViewModel mainViewModel)
- {
- _mainViewModel = mainViewModel;
- }
+ public void ShowHelperPage(object parameter)
+ {
+ BaseControlVM vm = new BaseControlVM(new HelperPageVM());
+ WindowManager.mainViewModel.Content = vm;
+ WindowManager.openContent.Add(vm);
+ }
}
\ No newline at end of file
diff --git a/ViewModel/BaseWindow/MainViewModel.cs b/ViewModel/BaseWindow/MainViewModel.cs
index b3f1528..06ca3d2 100644
--- a/ViewModel/BaseWindow/MainViewModel.cs
+++ b/ViewModel/BaseWindow/MainViewModel.cs
@@ -1,42 +1,14 @@
-using System.Windows.Input;
-using SparkClient.Views;
-
namespace SparkClient.ViewModel.BaseWindow;
-public class MainViewModel: BaseViewModel
+public class MainViewModel : BaseViewModel
{
+ private object _content;
- private static MainViewModel _instance;
-
- public static MainViewModel Instance => _instance ??= new MainViewModel();
+ public object Content { get { return _content; } set { _content = value; OnPropertyChanged("Content"); } }
-
- private object _currentViewModel;
-
- public object CurrentViewModel
+ public MainViewModel()
{
- get => _currentViewModel;
- set
- {
- _currentViewModel = value;
- OnPropertyChanged();
- }
- }
-
- public ICommand ShowHomeCommand { get; }
- public ICommand ShowHelperPageCommand { get; }
- public ICommand ShowSettingsPageCommand { get; }
- public ICommand ShowProfilePageCommand { get; }
-
- private MainViewModel()
- {
- // 初始化加载 HomeWindow
- CurrentViewModel = new HomeWindowVM(this);
-
- // 初始化命令
- ShowHomeCommand = new RelayCommand(_ => CurrentViewModel = new HomeWindowVM(this));
- ShowHelperPageCommand = new RelayCommand(_ => CurrentViewModel = new BaseControlVM(this, new HelperPage()));
- // ShowSettingsPageCommand = new RelayCommand(_ => CurrentViewModel = new BaseControlVM(this, new SettingsPage()));
- // ShowProfilePageCommand = new RelayCommand(_ => CurrentViewModel = new BaseControlVM(this, new ProfilePage()));
+ Content = new HomeWindowVM();
+ WindowManager.openContent.Add(Content);
}
}
\ No newline at end of file
diff --git a/ViewModel/BaseWindow/WindowManager.cs b/ViewModel/BaseWindow/WindowManager.cs
new file mode 100644
index 0000000..6668a13
--- /dev/null
+++ b/ViewModel/BaseWindow/WindowManager.cs
@@ -0,0 +1,18 @@
+namespace SparkClient.ViewModel.BaseWindow;
+
+public class WindowManager
+{
+ public static MainViewModel mainViewModel;
+
+ public static List