ConfigWindow.xaml.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. 
  2. using GalaSoft.MvvmLight.Command;
  3. using GeekDesk.Control.UserControls;
  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
  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. public MainWindow mainWindow;
  21. public ConfigWindow(AppConfig appConfig, MainWindow mainWindow)
  22. {
  23. InitializeComponent();
  24. this.DataContext = appConfig;
  25. RightCard.Content = about;
  26. this.Topmost = true;
  27. this.mainWindow = mainWindow;
  28. }
  29. /// <summary>
  30. /// 移动窗口
  31. /// </summary>
  32. /// <param name="sender"></param>
  33. /// <param name="e"></param>
  34. private void DragMove(object sender, System.Windows.Input.MouseButtonEventArgs e)
  35. {
  36. if (e.LeftButton == MouseButtonState.Pressed)
  37. {
  38. DragMove();
  39. }
  40. }
  41. /// <summary>
  42. /// 点击关闭按钮
  43. /// </summary>
  44. /// <param name="sender"></param>
  45. /// <param name="e"></param>
  46. private void Close_Button_Click(object sender, RoutedEventArgs e)
  47. {
  48. this.Close();
  49. }
  50. private void MemuClick(object sender, RoutedEventArgs e)
  51. {
  52. SideMenuItem smi = sender as SideMenuItem;
  53. switch (smi.Tag.ToString())
  54. {
  55. case "Motion":
  56. RightCard.Content = motion;
  57. break;
  58. case "Theme":
  59. RightCard.Content = theme;
  60. break;
  61. default:
  62. RightCard.Content = about;
  63. break;
  64. }
  65. }
  66. }
  67. }