ConfigWindow.xaml.cs 1.9 KB

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