Files
GeekDesk/Control/Other/IconInfoDialog.xaml.cs

89 lines
2.4 KiB
C#
Raw Normal View History

2022-01-09 16:17:13 +08:00
using GeekDesk.Control.Windows;
using GeekDesk.Util;
2021-05-14 16:48:26 +08:00
using GeekDesk.ViewModel;
2022-01-09 16:17:13 +08:00
using HandyControl.Controls;
2021-05-26 17:19:04 +08:00
using System;
2022-01-09 16:17:13 +08:00
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2021-05-14 16:48:26 +08:00
using System.Windows;
using System.Windows.Controls;
2022-01-09 16:17:13 +08:00
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
2021-05-14 16:48:26 +08:00
using System.Windows.Media.Imaging;
2022-01-09 16:17:13 +08:00
using System.Windows.Navigation;
using System.Windows.Shapes;
2021-05-14 16:48:26 +08:00
2022-01-09 16:17:13 +08:00
namespace GeekDesk.Control.UserControls.Backlog
2021-05-14 16:48:26 +08:00
{
2022-01-09 16:17:13 +08:00
public enum ToDoType
{
HISTORY = 1,
NEW = 2
}
2021-05-14 16:48:26 +08:00
/// <summary>
2022-01-09 16:17:13 +08:00
/// BacklogControl.xaml 的交互逻辑
2021-05-14 16:48:26 +08:00
/// </summary>
2022-01-09 16:17:13 +08:00
public partial class TodoControl : UserControl
2021-05-14 16:48:26 +08:00
{
2022-01-09 16:17:13 +08:00
public ToDoType type;
public TodoControl()
2021-05-14 16:48:26 +08:00
{
InitializeComponent();
}
2022-01-09 16:17:13 +08:00
private void DeleteMenu_Click(object sender, RoutedEventArgs e)
2021-05-14 16:48:26 +08:00
{
2022-01-09 16:17:13 +08:00
ToDoInfo info = BacklogList.SelectedItem as ToDoInfo;
Growl.Ask("确认删除吗?", isConfirmed =>
{
if (isConfirmed)
{
if (type == ToDoType.NEW)
{
MainWindow.appData.ToDoList.Remove(info);
}
else
{
MainWindow.appData.HiToDoList.Remove(info);
}
CommonCode.SaveAppData(MainWindow.appData);
}
return true;
}, "DeleteConfirm");
2021-05-14 16:48:26 +08:00
}
2022-01-09 16:17:13 +08:00
private void DetailMenu_Click(object sender, RoutedEventArgs e)
2021-05-14 16:48:26 +08:00
{
2022-01-09 16:17:13 +08:00
ToDoInfo info = BacklogList.SelectedItem as ToDoInfo;
ToDoInfoWindow.ShowDetail(info);
2021-05-14 16:48:26 +08:00
}
/// <summary>
2022-01-09 16:17:13 +08:00
/// 禁用设置按钮右键菜单
2021-05-14 16:48:26 +08:00
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2022-01-09 16:17:13 +08:00
private void DataGridMenu_Initialized(object sender, EventArgs e)
2021-05-14 16:48:26 +08:00
{
2022-01-09 16:17:13 +08:00
BacklogList.ContextMenu = null;
2021-05-14 16:48:26 +08:00
}
/// <summary>
2022-01-09 16:17:13 +08:00
/// 打开右键菜单
2021-05-14 16:48:26 +08:00
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2022-01-09 16:17:13 +08:00
private void DataGridRow_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
2021-05-14 16:48:26 +08:00
{
2022-01-09 16:17:13 +08:00
BacklogList.SelectedIndex = ((DataGridRow)sender).GetIndex();
Menu.IsOpen = true;
2021-05-14 16:48:26 +08:00
}
2022-01-09 16:17:13 +08:00
2021-05-14 16:48:26 +08:00
}
}