Browse Source

1

样式分支
fyf 2 years ago
parent
commit
eee3b953e5
3 changed files with 21 additions and 15 deletions
  1. +13
    -2
      BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs
  2. +0
    -5
      BeDesignerSCADA/ViewModel/DataBusModel.cs
  3. +8
    -8
      BeDesignerSCADA/ViewModel/MainViewModelNew.cs

+ 13
- 2
BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs View File

@@ -345,7 +345,13 @@ namespace BeDesignerSCADA.Controls
{
System.Windows.Controls.ComboBox toggle = (System.Windows.Controls.ComboBox)sender;
if (toggle.Tag == null) return;
CommunicationModel mode=viewModel.communicationPar?.CommunicationDevices?.ToList().Find(par => par.DeviceName == toggle.Tag.ToString());

CommunicationPar communication = null;
if (DataBusModel.GetInstance().KeyValues.ContainsKey(viewModel.VariablePath))
{
communication = DataBusModel.GetInstance().KeyValues[viewModel.VariablePath];
}
CommunicationModel mode= communication?.CommunicationDevices?.ToList().Find(par => par.DeviceName == toggle.Tag.ToString());
if (mode != null)
{
mode?.VarTableModels?.ToList().ForEach(par => { viewModel.DevValueList.Add(par.VarName); });
@@ -391,7 +397,12 @@ namespace BeDesignerSCADA.Controls
private void namebox_DropDownOpened(object sender, EventArgs e)
{
viewModel.DevNameList = new System.Collections.ObjectModel.ObservableCollection<string>();
viewModel.communicationPar?.CommunicationDevices?.ToList().ForEach(x => { viewModel.DevNameList.Add(x.DeviceName); });
CommunicationPar communication = null;
if (DataBusModel.GetInstance().KeyValues.ContainsKey(viewModel.VariablePath))
{
communication = DataBusModel.GetInstance().KeyValues[viewModel.VariablePath];
}
communication?.CommunicationDevices?.ToList().ForEach(x => { viewModel.DevNameList.Add(x.DeviceName); });
}
#endregion
}


+ 0
- 5
BeDesignerSCADA/ViewModel/DataBusModel.cs View File

@@ -46,10 +46,6 @@ namespace BeDesignerSCADA.ViewModel
}
#endregion
/// <summary>
/// 刷新界面
/// </summary>
public Action<string> RefreshTheVariableManagerAction;
/// <summary>
/// 刷新界面管理器
/// </summary>
/// <param name="path"></param>
@@ -68,7 +64,6 @@ namespace BeDesignerSCADA.ViewModel
KeyValues = new ConcurrentDictionary<string, CommunicationPar>();
}
KeyValues[path] = val;
RefreshTheVariableManagerAction?.Invoke(path);
IsSucess = true;
}
}


+ 8
- 8
BeDesignerSCADA/ViewModel/MainViewModelNew.cs View File

@@ -37,7 +37,7 @@ namespace BeDesignerSCADA.ViewModel
{
IsRunning = !IsRunning;
});
DataBusModel.GetInstance().RefreshTheVariableManagerAction += RefreshTheVariableManagerActionHader;
//DataBusModel.GetInstance().RefreshTheVariableManagerAction += RefreshTheVariableManagerActionHader;
}

#region 变量
@@ -214,13 +214,13 @@ namespace BeDesignerSCADA.ViewModel
{
try
{
if (path == VariablePath && !string.IsNullOrEmpty(VariablePath))
{
if (DataBusModel.GetInstance().KeyValues.ContainsKey(VariablePath))
{
communicationPar = DataBusModel.GetInstance().KeyValues[VariablePath];
}
}
//if (path == VariablePath && !string.IsNullOrEmpty(VariablePath))
//{
// if (DataBusModel.GetInstance().KeyValues.ContainsKey(VariablePath))
// {
// communicationPar = DataBusModel.GetInstance().KeyValues[VariablePath];
// }
//}
}
catch (Exception ex)
{


Loading…
Cancel
Save