ConfigWindow.xaml.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. 
  2. using GeekDesk.Control.UserControls;
  3. using GeekDesk.Control.UserControls.Config;
  4. using GeekDesk.ViewModel;
  5. using HandyControl.Controls;
  6. using HandyControl.Data;
  7. using System;
  8. using System.Windows;
  9. using System.Windows.Input;
  10. namespace GeekDesk.Control.Windows
  11. {
  12. /// <summary>
  13. /// ConfigDialog.xaml 的交互逻辑
  14. /// </summary>
  15. public partial class ConfigWindow
  16. {
  17. private static AboutControl about = new AboutControl();
  18. private static ThemeControl theme = new ThemeControl();
  19. private static MotionControl motion = new MotionControl();
  20. private static OtherControl other = new OtherControl();
  21. public MainWindow mainWindow;
  22. private ConfigWindow(AppConfig appConfig, MainWindow mainWindow)
  23. {
  24. InitializeComponent();
  25. this.DataContext = appConfig;
  26. RightCard.Content = about;
  27. this.Topmost = true;
  28. this.mainWindow = mainWindow;
  29. }
  30. /// <summary>
  31. /// 点击关闭按钮
  32. /// </summary>
  33. /// <param name="sender"></param>
  34. /// <param name="e"></param>
  35. private void Close_Button_Click(object sender, RoutedEventArgs e)
  36. {
  37. this.Close();
  38. }
  39. private void MemuClick(object sender, RoutedEventArgs e)
  40. {
  41. SideMenuItem smi = sender as SideMenuItem;
  42. switch (smi.Tag.ToString())
  43. {
  44. case "Motion":
  45. RightCard.Content = motion;
  46. break;
  47. case "Theme":
  48. RightCard.Content = theme;
  49. break;
  50. case "Other":
  51. RightCard.Content = other;
  52. break;
  53. default:
  54. RightCard.Content = about;
  55. break;
  56. }
  57. }
  58. private static System.Windows.Window window = null;
  59. public static void Show(AppConfig appConfig, MainWindow mainWindow)
  60. {
  61. if (window == null || !window.Activate())
  62. {
  63. window = new ConfigWindow(appConfig, mainWindow);
  64. }
  65. window.Show();
  66. }
  67. }
  68. }