| | |
| | | using System; |
| | | using System.Windows.Controls; |
| | | using HMI.Core.Api; |
| | | using HMI.Core.Setting; |
| | | using HMI.Core.Util; |
| | | using HMI.UI.Util; |
| | |
| | | /// <summary> |
| | | /// SystemConfig.xaml 的交互逻辑 |
| | | /// </summary> |
| | | public partial class SystemConfig : UserControl |
| | | public partial class SystemConfig : UserControl, IConfigManager |
| | | { |
| | | public SystemConfig() |
| | | { |
| | |
| | | InitializeComponent(); |
| | | } |
| | | |
| | | private void Button_Click(object sender, System.Windows.RoutedEventArgs e) |
| | | public object GetConfig() |
| | | { |
| | | try |
| | | return SystemSetting.Instance; |
| | | } |
| | | |
| | | public void ResetConfig() |
| | | { |
| | | var model = new SystemSettingModel(); |
| | | BeanUtil.Copy(SystemSetting.Instance, model); |
| | | DataContext = model; |
| | | } |
| | | |
| | | public void SaveConfig() |
| | | { |
| | | SystemSettingModel settingModel = (SystemSettingModel)DataContext; |
| | | XmlHelper.SerializeToXml(PathHelper.ConfigFolder + "\\SystemConfig.xml", settingModel); |
| | | SystemSetting.ReLoad(); |
| | | this.Success("保存成功"); |
| | | } |
| | | |
| | | private void Button_Click(object sender, System.Windows.RoutedEventArgs e) |
| | | { |
| | | try |
| | | { |
| | | } |
| | | catch (Exception ex) |
| | | { |