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