diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Datas/Brands.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Datas/Brands.cs
index e606fbf..eb8100b 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/Datas/Brands.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Datas/Brands.cs
@@ -6,6 +6,9 @@ using System.Threading.Tasks;
namespace Sinvo.EplanHpD.Plugin.WPFUI.Datas
{
+ ///
+ /// TODO: 品牌类型,线材逻辑不同应拆分为不同的服务实现
+ ///
public static class Brands
{
public const string UNKNOWN = "未知";
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/LectotypeWindow.xaml.cs b/Sinvo.EplanHpD.Plugin.WPFUI/View/LectotypeWindow.xaml.cs
index 0a9211a..ad9aa60 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/View/LectotypeWindow.xaml.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/LectotypeWindow.xaml.cs
@@ -394,8 +394,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
}
private void StartLayoutBtn_Click(object sender, RoutedEventArgs e)
{
- if (ViewModel.GetNotSavedLectotypeList() != null && ViewModel.GetNotSavedLectotypeList().Any())
- {
+ // 检查是否存在未保存的线信息
+ if (ViewModel.CheckNotSave())
+ {
+ //关闭前事件
CloseBefore(() =>
{
ToLayout();
@@ -429,11 +431,13 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
///
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
- if(ViewModel.GetNotSavedLectotypeList() != null && ViewModel.GetNotSavedLectotypeList().Any())
+ if(ViewModel.CheckNotSave())
{
+ // 存在未保存的线,取消关闭
e.Cancel = true;
CloseBefore(() =>
{
+ // 确定继续操作之后,清空未保存线的列表,再次触发关闭事件
ViewModel.ClearNotSavedLectotypeList();
this.Close();
});
@@ -445,6 +449,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
/// 关闭时要执行的操作
private void CloseBefore(Action closeAction)
{
+ // 弹出自定义Dialog窗口
HandyControl.Controls.Dialog.Show(new NotSavedWarningWindow(ViewModel.GetNotSavedLectotypeList()))
.Initialize(vm => vm.Result = false)
.GetResultAsync()
@@ -453,6 +458,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
{
if (x.Result)
{
+ // 执行继续操作回调
closeAction();
}
});
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs
index 79a0b46..4f04381 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs
@@ -24,12 +24,12 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
private readonly MotorExcelHelper motorExcelHelper = MotorExcelHelper.Instance;
private MotorLectotypeService motorService = new MotorLectotypeService();
- private Dictionary> CableTypeIndexs = new Dictionary>
- {
- { "编码器线", new Dictionary{ { 0, 1 } } },
- { "动力线", new Dictionary{ { 1, -1 } } },
- { "动力刹车线", new Dictionary{ { 2, -2 } } }
- };
+ //private Dictionary> CableTypeIndexs = new Dictionary>
+ //{
+ // { "编码器线", new Dictionary{ { 0, 1 } } },
+ // { "动力线", new Dictionary{ { 1, -1 } } },
+ // { "动力刹车线", new Dictionary{ { 2, -2 } } }
+ //};
///
/// 生成线列表
///
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LectotypeViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LectotypeViewModel.cs
index 1dded01..74d5b64 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LectotypeViewModel.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LectotypeViewModel.cs
@@ -764,25 +764,18 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
public void RemoveNotSavedLectotype(Dictionary value)
{
value.ForEach(it => NotSavedLectotypeList.Remove(it.Key));
-<<<<<<< HEAD
+
}
- internal async Task CheckSaved()
+ internal bool CheckNotSave()
{
+ bool notSave = false;
if (NotSavedLectotypeList != null && NotSavedLectotypeList.Any())
- {
- var isContinue = false;
-
- return isContinue;
- }
- else
- {
- return false;
+ {
+ notSave = true;
}
+ return notSave;
}
-=======
- }
->>>>>>> origin/master
internal Dictionary GetNotSavedLectotypeList()
{