| | |
| | | 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; |
| | |
| | | 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; |
| | | } |
| | |
| | | |
| | | 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(() => |
| | |
| | | |
| | | } |
| | | |
| | | /// <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) |
| | |
| | | { |
| | | 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; |
| | | } |
| | | } |