| | |
| | | using HMI.UI.Util; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Linq; |
| | | using System.Windows; |
| | | using System.Windows.Controls; |
| | |
| | | List<string> ids = Model.DataSource.Where(x => x.Selected).Select(x => x.Id).ToList(); |
| | | if (ids == null || ids.Count <= 0) |
| | | { |
| | | ToastHelper.Warning(Window.GetWindow(this), LangUtil.Get("HMI.Menu.NoDeleteData")); |
| | | ToastHelper.Warning(Window.GetWindow(this), LangUtil.Get("HMI.NoDeleteData")); |
| | | return; |
| | | } |
| | | |
| | | var res = MsgBoxHelper.WarnMessage(Window.GetWindow(this), |
| | | string.Format(LangUtil.Get("HMI.Menu.MakeSureDeletes"), ids.Count)); |
| | | string.Format(LangUtil.Get("HMI.MakeSureDeletes"), ids.Count)); |
| | | if (res == MessageBoxResult.OK) |
| | | { |
| | | Model.DeleteMenuByIds(ids); |
| | |
| | | { |
| | | var data = (MenuData)((Button)sender).DataContext; |
| | | var res = MsgBoxHelper.WarnMessage(Window.GetWindow(this), |
| | | string.Format(LangUtil.Get("HMI.Menu.MakeSureDeleteSingle"), data.Name)); |
| | | string.Format(LangUtil.Get("HMI.MakeSureDeleteSingle"), data.Name)); |
| | | if (res == MessageBoxResult.OK) |
| | | { |
| | | Model.DeleteMenuById(data.Id); |
| | |
| | | } |
| | | } |
| | | |
| | | public override void DoClose(object sender, EventArgs e) |
| | | { |
| | | try |
| | | { |
| | | Model?.sqliteHelper?.Close(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | log.Warn("Do Close Failed.", ex); |
| | | } |
| | | } |
| | | |
| | | private void DataGrid_Loaded(object sender, RoutedEventArgs e) |
| | | { |
| | | Model.LoadData(); |