From e9d7a5ef4c17e4804fb988dd193ff7d1fa36d52b Mon Sep 17 00:00:00 2001 From: chr <chr@chr.com> Date: 星期一, 12 八月 2024 09:08:43 +0800 Subject: [PATCH] 优化; --- PdmSwPlugin.PropertySetting/CommonSettingControl.xaml.cs | 75 ++++++++++++++++++++++--------------- 1 files changed, 45 insertions(+), 30 deletions(-) diff --git a/PdmSwPlugin.PropertySetting/CommonSettingControl.xaml.cs b/PdmSwPlugin.PropertySetting/CommonSettingControl.xaml.cs index e8e266b..2b8cc6e 100644 --- a/PdmSwPlugin.PropertySetting/CommonSettingControl.xaml.cs +++ b/PdmSwPlugin.PropertySetting/CommonSettingControl.xaml.cs @@ -82,9 +82,14 @@ if (string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(attr.defaultValue)) { value = attr.defaultValue; + // 榛樿鍊间笉鍐欏叆initData + } + else + { + // 鍏朵粬鍐欏叆initData + if (initData != null) initData[name] = value; } prop.SetValue(container, value); - if (initData != null) initData[name] = value; } }); return true; @@ -105,7 +110,14 @@ string name = attr.Name; string value = initData.Get(name, string.Empty); string newValue = prop.GetValue(container) as string; - if (value != newValue) + if (name == NameConstant.weight) + { + if (string.IsNullOrEmpty(value)) + { + return true; + } + } + else if (value != newValue) { return true; } @@ -365,20 +377,7 @@ public void UpdateUI(ModelDoc2 doc) { - IPropertyOpt opt = ActiveOpter as IPropertyOpt; - if (opt != null && opt.GetDocChanged()) - { - string Message = $"{Path.GetFileName(ReadDocPath)}灞炴�у彂鐢熷彉鏇达紝鏄惁淇濆瓨?"; - if (SwApp.SendMsgToUser2(Message, (int)swMessageBoxIcon_e.swMbWarning - , (int)swMessageBoxBtn_e.swMbYesNo) == (int)swMessageBoxResult_e.swMbHitYes) - { - SaveDoc(true); - } - else - { - opt.ResetProperty(out string errMsg); - } - } + AlertSaveWindow(); LastReadDoc = ReadDoc; ReadDoc = doc; Dispatcher.Invoke(() => @@ -775,6 +774,35 @@ } + /// <summary> + /// 鍒ゆ柇鏄惁闇�瑕佸脊绐楁彁绀轰繚瀛� + /// </summary> + public void AlertSaveWindow() + { + IPropertyOpt opt = ActiveOpter as IPropertyOpt; + if (opt != null && opt.GetDocChanged()) + { + // 鍘嗗彶鏂囨。鐩存帴閲嶇疆 + string fullName = Path.GetFileName(ReadDocPath); + if (NameUtil.IsHistoryDoc(fullName)) + { + opt.ResetProperty(out string errMsg); + return; + } + + string Message = $"{fullName}灞炴�у彂鐢熷彉鏇达紝鏄惁淇濆瓨?"; + if (SwApp.SendMsgToUser2(Message, (int)swMessageBoxIcon_e.swMbWarning + , (int)swMessageBoxBtn_e.swMbYesNo) == (int)swMessageBoxResult_e.swMbHitYes) + { + SaveDoc(true); + } + else + { + opt.ResetProperty(out string errMsg); + } + } + } + public void OnTabControlSelectionChange(object sender, SelectionChangedEventArgs e) { if (e.RemovedItems == null) @@ -788,20 +816,7 @@ { if (item.Content == this) { - IPropertyOpt opt = ActiveOpter as IPropertyOpt; - if (opt != null && opt.GetDocChanged()) - { - string Message = $"{Path.GetFileName(ReadDocPath)}灞炴�у彂鐢熷彉鏇达紝鏄惁淇濆瓨?"; - if (SwApp.SendMsgToUser2(Message, (int)swMessageBoxIcon_e.swMbWarning - , (int)swMessageBoxBtn_e.swMbYesNo) == (int)swMessageBoxResult_e.swMbHitYes) - { - SaveDoc(true); - } - else - { - opt.ResetProperty(out string errMsg); - } - } + AlertSaveWindow(); break; } } -- Gitblit v1.9.1