2025-08-15 16:34:31 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
using SWS.CAD.ViewModels.myViewModelBase;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using Telerik.Windows.Controls;
|
2025-09-04 18:28:02 +08:00
|
|
|
|
using Prism.Services.Dialogs;
|
|
|
|
|
using SWS.Commons;
|
|
|
|
|
using SWS.Model;
|
2025-08-15 16:34:31 +08:00
|
|
|
|
|
|
|
|
|
namespace SWS.CAD.ViewModels
|
|
|
|
|
{
|
|
|
|
|
public class DialogCablePreAssignResultViewModel : DialogBase, IDialogAware
|
|
|
|
|
{
|
|
|
|
|
#region 字段
|
|
|
|
|
private ObservableCollection<PreAssignCable> _PreAssignCables = new ObservableCollection<PreAssignCable>();
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 端子排参数信息列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ObservableCollection<PreAssignCable> PreAssignCables
|
|
|
|
|
{
|
|
|
|
|
get { return _PreAssignCables; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_PreAssignCables = value;
|
|
|
|
|
RaisePropertyChanged(nameof(PreAssignCables));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private StripParametersInfo _SelectedStripParametersInfo;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 当前选中的信号类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
public StripParametersInfo SelectedStripParametersInfo
|
|
|
|
|
{
|
|
|
|
|
get { return _SelectedStripParametersInfo; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_SelectedStripParametersInfo = value;
|
|
|
|
|
RaisePropertyChanged(nameof(SelectedStripParametersInfo));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private bool _IsReadOnly;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否可编辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsReadOnly
|
|
|
|
|
{
|
|
|
|
|
get { return _IsReadOnly; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_IsReadOnly = value;
|
|
|
|
|
RaisePropertyChanged(nameof(IsReadOnly));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 表格下拉列表
|
|
|
|
|
private List<string> _TermNamingType_ls = new List<string>() { "数字", "字母" };
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 端子编号类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<string> TermNamingType_ls
|
|
|
|
|
{
|
|
|
|
|
get { return _TermNamingType_ls; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_TermNamingType_ls = value;
|
|
|
|
|
RaisePropertyChanged(nameof(TermNamingType_ls));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private List<string> _TermNamingRule_ls = new List<string>() { "按端子排全局编号", "按通道内端子编号", "按通道编号" };
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 端子编号规则
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<string> TermNamingRule_ls
|
|
|
|
|
{
|
|
|
|
|
get { return _TermNamingRule_ls; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_TermNamingRule_ls = value;
|
|
|
|
|
RaisePropertyChanged(nameof(TermNamingRule_ls));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private List<string> _TermNamePrefix_ls = new List<string>() { "通道编号", "+,-,s", "无" };
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 端子前缀
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<string> TermNamePrefix_ls
|
|
|
|
|
{
|
|
|
|
|
get { return _TermNamePrefix_ls; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_TermNamePrefix_ls = value;
|
|
|
|
|
RaisePropertyChanged(nameof(TermNamePrefix_ls));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private List<string> _TermNameSuffix_ls = new List<string>() { "通道编号", "+,-,s", "无" };
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 端子后缀
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<string> TermNameSuffix_ls
|
|
|
|
|
{
|
|
|
|
|
get { return _TermNameSuffix_ls; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_TermNameSuffix_ls = value;
|
|
|
|
|
RaisePropertyChanged(nameof(TermNameSuffix_ls));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
#endregion
|
|
|
|
|
|
2025-09-04 18:28:02 +08:00
|
|
|
|
public string Title => "";
|
|
|
|
|
|
|
|
|
|
public event Action<IDialogResult> RequestClose;
|
2025-08-15 16:34:31 +08:00
|
|
|
|
public bool CanCloseDialog()
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnDialogClosed()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<ec_Cable> CablePreAssigns;
|
|
|
|
|
public async void OnDialogOpened(IDialogParameters parameters)
|
|
|
|
|
{
|
|
|
|
|
//title = parameters.GetValue<string>(GlobalObject.dialogPar.title.ToString());
|
|
|
|
|
title = "信号预分配结果";
|
|
|
|
|
_PreAssignCables = parameters.GetValue<ObservableCollection<PreAssignCable>>(GlobalObject.dialogPar.para1.ToString());
|
|
|
|
|
_IsReadOnly = parameters.GetValue<bool>(GlobalObject.dialogPar.para2.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void ExecuteOKCommandAsync(object para)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//返回结果
|
2025-09-04 18:28:02 +08:00
|
|
|
|
IDialogParameters res = new Prism.Services.Dialogs.DialogParameters();
|
2025-08-15 16:34:31 +08:00
|
|
|
|
//res.Add(GlobalObject.dialogPar.para1.ToString(), SelectedStripParametersInfo);
|
2025-09-04 18:28:02 +08:00
|
|
|
|
RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res));
|
2025-08-15 16:34:31 +08:00
|
|
|
|
}
|
|
|
|
|
public override void ExecuteCloseCommand(object parameter)
|
|
|
|
|
{
|
|
|
|
|
if (parameter as string == "ClickNo")
|
|
|
|
|
{
|
2025-09-04 18:28:02 +08:00
|
|
|
|
DialogResult res = new DialogResult(ButtonResult.No);
|
|
|
|
|
RequestClose.Invoke(res);
|
2025-08-15 16:34:31 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2025-09-04 18:28:02 +08:00
|
|
|
|
RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
|
2025-08-15 16:34:31 +08:00
|
|
|
|
}
|
|
|
|
|
this.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 方法
|
|
|
|
|
public ICommand EditEndCmd => new DelegateCommand(EditEnd);
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 编辑结束事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="parameter"></param>
|
|
|
|
|
public virtual void EditEnd(object parameter)
|
|
|
|
|
{
|
|
|
|
|
//做个标记表示该项修改过
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|