1
0

ConfigWindow.xaml.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. 
  2. using GalaSoft.MvvmLight.Command;
  3. using GeekDesk.Control.UserControls;
  4. using GeekDesk.Control.UserControls.Config;
  5. using GeekDesk.ViewModel;
  6. using HandyControl.Controls;
  7. using HandyControl.Data;
  8. using System;
  9. using System.Windows;
  10. using System.Windows.Input;
  11. namespace GeekDesk.Control.Windows
  12. {
  13. /// <summary>
  14. /// ConfigDialog.xaml 的交互逻辑
  15. /// </summary>
  16. public partial class ConfigWindow
  17. {
  18. private static AboutControl about = new AboutControl();
  19. private static ThemeControl theme = new ThemeControl();
  20. private static MotionControl motion = new MotionControl();
  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 DragMove(object sender, System.Windows.Input.MouseButtonEventArgs e)
  36. {
  37. if (e.LeftButton == MouseButtonState.Pressed)
  38. {
  39. DragMove();
  40. }
  41. }
  42. /// <summary>
  43. /// 点击关闭按钮
  44. /// </summary>
  45. /// <param name="sender"></param>
  46. /// <param name="e"></param>
  47. private void Close_Button_Click(object sender, RoutedEventArgs e)
  48. {
  49. this.Close();
  50. }
  51. private void MemuClick(object sender, RoutedEventArgs e)
  52. {
  53. SideMenuItem smi = sender as SideMenuItem;
  54. switch (smi.Tag.ToString())
  55. {
  56. case "Motion":
  57. RightCard.Content = motion;
  58. break;
  59. case "Theme":
  60. RightCard.Content = theme;
  61. break;
  62. default:
  63. RightCard.Content = about;
  64. break;
  65. }
  66. }
  67. private static System.Windows.Window window = null;
  68. public static void Show(AppConfig appConfig, MainWindow mainWindow)
  69. {
  70. if (window == null || !window.Activate())
  71. {
  72. window = new ConfigWindow(appConfig, mainWindow);
  73. }
  74. window.Show();
  75. }
  76. }
  77. }