From de02248e7577fd7401ee9ce3e2184a7e05539d5a Mon Sep 17 00:00:00 2001 From: liufei Date: Sun, 9 Jan 2022 16:17:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=90=AF=E5=8A=A8=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Control/Other/IconInfoDialog.xaml.cs | 135 ++++++++++++++------------- 1 file changed, 68 insertions(+), 67 deletions(-) diff --git a/Control/Other/IconInfoDialog.xaml.cs b/Control/Other/IconInfoDialog.xaml.cs index e7e8444..0922b07 100644 --- a/Control/Other/IconInfoDialog.xaml.cs +++ b/Control/Other/IconInfoDialog.xaml.cs @@ -1,87 +1,88 @@ -using GeekDesk.Util; +using GeekDesk.Control.Windows; +using GeekDesk.Util; using GeekDesk.ViewModel; -using Microsoft.Win32; +using HandyControl.Controls; using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; - -namespace GeekDesk.Control.Other +namespace GeekDesk.Control.UserControls.Backlog { - /// - /// TextDialog.xaml 的交互逻辑 - /// - public partial class IconInfoDialog + + public enum ToDoType { - public HandyControl.Controls.Dialog dialog; - - public IconInfoDialog() + HISTORY = 1, + NEW = 2 + } + /// + /// BacklogControl.xaml 的交互逻辑 + /// + public partial class TodoControl : UserControl + { + public ToDoType type; + public TodoControl() { InitializeComponent(); } - public IconInfoDialog(IconInfo info) + private void DeleteMenu_Click(object sender, RoutedEventArgs e) { - this.DataContext = info; - InitializeComponent(); - } - - /// - /// 保存修改属性 - /// - /// - /// - private void SaveProperty(object sender, RoutedEventArgs e) - { - IconInfo info = this.DataContext as IconInfo; - info.BitmapImage = IconImg.Source as BitmapImage; - info.Name = IconName.Text; - info.AdminStartUp = IconIsAdmin.IsChecked.Value; - info.StartArg = StartArg.Text; - CommonCode.SaveAppData(MainWindow.appData); - dialog.Close(); - } - - /// - /// 修改图标为默认 - /// - /// - /// - private void ReStoreImage(object sender, RoutedEventArgs e) - { - IconInfo info = this.DataContext as IconInfo; - info.BitmapImage = ImageUtil.ByteArrToImage(info.DefaultImage); - CommonCode.SaveAppData(MainWindow.appData); - } - - /// - /// 修改图标 - /// - /// - /// - private void EditImage(object sender, RoutedEventArgs e) - { - try + ToDoInfo info = BacklogList.SelectedItem as ToDoInfo; + Growl.Ask("确认删除吗?", isConfirmed => { - OpenFileDialog ofd = new OpenFileDialog + if (isConfirmed) { - Multiselect = false, //只允许选中单个文件 - Filter = "所有文件(*.*)|*.*" - }; - if (ofd.ShowDialog() == true) - { - IconInfo info = this.DataContext as IconInfo; - info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName); + if (type == ToDoType.NEW) + { + MainWindow.appData.ToDoList.Remove(info); + } + else + { + MainWindow.appData.HiToDoList.Remove(info); + } CommonCode.SaveAppData(MainWindow.appData); } - } - catch (Exception e1) - { - HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!"); - LogUtil.WriteErrorLog(e1, "修改图标失败!"); - } - + return true; + }, "DeleteConfirm"); } + + private void DetailMenu_Click(object sender, RoutedEventArgs e) + { + ToDoInfo info = BacklogList.SelectedItem as ToDoInfo; + ToDoInfoWindow.ShowDetail(info); + } + + /// + /// 禁用设置按钮右键菜单 + /// + /// + /// + private void DataGridMenu_Initialized(object sender, EventArgs e) + { + BacklogList.ContextMenu = null; + } + + /// + /// 打开右键菜单 + /// + /// + /// + private void DataGridRow_MouseRightButtonDown(object sender, MouseButtonEventArgs e) + { + BacklogList.SelectedIndex = ((DataGridRow)sender).GetIndex(); + Menu.IsOpen = true; + } + } }