ToDoWindow.xaml.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using GeekDesk.Control.UserControls.Backlog;
  2. using GeekDesk.ViewModel;
  3. using HandyControl.Controls;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Collections.ObjectModel;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows;
  11. using System.Windows.Controls;
  12. using System.Windows.Data;
  13. using System.Windows.Documents;
  14. using System.Windows.Input;
  15. using System.Windows.Media;
  16. using System.Windows.Media.Imaging;
  17. using System.Windows.Shapes;
  18. namespace GeekDesk.Control.Windows
  19. {
  20. /// <summary>
  21. /// BacklogWindow.xaml 的交互逻辑
  22. /// </summary>
  23. public partial class ToDoWindow
  24. {
  25. private static TodoControl backlog = new TodoControl();
  26. private AppData appData = MainWindow.appData;
  27. private ToDoWindow()
  28. {
  29. InitializeComponent();
  30. RightCard.Content = backlog;
  31. backlog.BacklogList.ItemsSource = appData.ToDoList;
  32. this.Topmost = true;
  33. }
  34. /// <summary>
  35. /// 移动窗口
  36. /// </summary>
  37. /// <param name="sender"></param>
  38. /// <param name="e"></param>
  39. private void DragMove(object sender, System.Windows.Input.MouseButtonEventArgs e)
  40. {
  41. if (e.LeftButton == MouseButtonState.Pressed)
  42. {
  43. DragMove();
  44. }
  45. }
  46. /// <summary>
  47. /// 点击关闭按钮
  48. /// </summary>
  49. /// <param name="sender"></param>
  50. /// <param name="e"></param>
  51. private void Close_Button_Click(object sender, RoutedEventArgs e)
  52. {
  53. this.Close();
  54. }
  55. private void MemuClick(object sender, RoutedEventArgs e)
  56. {
  57. SideMenuItem smi = sender as SideMenuItem;
  58. switch (smi.Tag.ToString())
  59. {
  60. case "History":
  61. backlog.BacklogList.ItemsSource = appData.HiToDoList;
  62. break;
  63. default:
  64. backlog.BacklogList.ItemsSource = appData.ToDoList;
  65. break;
  66. }
  67. }
  68. /// <summary>
  69. /// 新建待办
  70. /// </summary>
  71. /// <param name="sender"></param>
  72. /// <param name="e"></param>
  73. private void CreateBacklog_BtnClick(object sender, RoutedEventArgs e)
  74. {
  75. ToDoInfoWindow.ShowNone();
  76. }
  77. private static System.Windows.Window window = null;
  78. public static void Show()
  79. {
  80. if (window == null || !window.Activate())
  81. {
  82. window = new ToDoWindow();
  83. }
  84. window.Show();
  85. }
  86. }
  87. }