| | |
| | | using HMI.Base; |
| | | using HMI.Core.Entity; |
| | | using HMI.Core.Manager; |
| | | using HMI.Core.Setting; |
| | | using HMI.Core.Util; |
| | | using HMI.ParameterManage.Entity; |
| | | using HMI.ParameterManage.Util; |
| | | using HMI.UI.Util; |
| | | using HMI.Util; |
| | | using Microsoft.Win32; |
| | |
| | | using System.Linq; |
| | | using System.Windows; |
| | | using System.Windows.Controls; |
| | | using System.Windows.Markup; |
| | | |
| | | namespace HMI.ParameterManage |
| | | { |
| | |
| | | Set(ref datasource, value); |
| | | } |
| | | } |
| | | |
| | | public List<string> groups = new List<string>(); |
| | | |
| | | public ParameterSetting() |
| | | { |
| | |
| | | { |
| | | Datasource = ParameterManager.GetCommonParameter<ObservableCollection<ParameterData>>() |
| | | ?? new ObservableCollection<ParameterData>(); |
| | | groups = Datasource.Where(d => !string.IsNullOrEmpty(d.ShowGroup)).Select(d => d.ShowGroup).Distinct().ToList(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Datasource = new ObservableCollection<ParameterData>(); |
| | | groups = new List<string>(); |
| | | log.Error("Refresh Data Failed.", ex); |
| | | ToastHelper.Error(Window.GetWindow(this), $"{this.lang("App.RefreshFailed")}: {ex.Message}"); |
| | | } |
| | |
| | | Title = title, |
| | | Owner = Window.GetWindow(this) |
| | | }; |
| | | if (modal.Open(data ?? new ParameterData(), Datasource) == true) |
| | | if (modal.Open(data ?? new ParameterData(), Datasource, groups) == true) |
| | | { |
| | | if (index == -1) |
| | | { |
| | |
| | | Loaded -= UserControl_Loaded; |
| | | } |
| | | |
| | | public override bool CanActive() |
| | | { |
| | | if (ParamSetting.IsOptRequirePassword) |
| | | { |
| | | var win = new RequirePasswordWindow |
| | | { |
| | | Owner = Window.GetWindow(this), |
| | | WindowStartupLocation = WindowStartupLocation.CenterScreen |
| | | }; |
| | | return win.ShowDialog() == true; |
| | | } |
| | | else |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | } |