pry 2 years ago
parent
commit
bc4fd0879d
2 changed files with 15 additions and 6 deletions
  1. +4
    -3
      BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs
  2. +11
    -3
      BeDesignerSCADA/ViewModel/MainViewModelNew.cs

+ 4
- 3
BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs View File

@@ -345,9 +345,10 @@ namespace BeDesignerSCADA.Controls
{ {
System.Windows.Controls.ComboBox toggle = (System.Windows.Controls.ComboBox)sender; System.Windows.Controls.ComboBox toggle = (System.Windows.Controls.ComboBox)sender;
if (toggle.Tag == null) return; if (toggle.Tag == null) return;
if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(toggle.Tag.ToString()))
CommunicationModel mode=viewModel.communicationPar?.CommunicationDevices?.ToList().Find(par => par.DeviceName == toggle.Tag.ToString());
if (mode != null)
{ {
Class_DataBus.GetInstance().Dic_DeviceData[toggle.Tag.ToString()].Keys?.ToList().ForEach(key => { viewModel.DevValueList.Add(key); });
mode?.VarTableModels?.ToList().ForEach(par => { viewModel.DevValueList.Add(par.VarName); });
} }
} }
} }
@@ -390,7 +391,7 @@ namespace BeDesignerSCADA.Controls
private void namebox_DropDownOpened(object sender, EventArgs e) private void namebox_DropDownOpened(object sender, EventArgs e)
{ {
viewModel.DevNameList = new System.Collections.ObjectModel.ObservableCollection<string>(); viewModel.DevNameList = new System.Collections.ObjectModel.ObservableCollection<string>();
Class_DataBus.GetInstance().Dic_DeviceData.Keys?.ToList().ForEach(key => { viewModel.DevNameList.Add(key); });
viewModel.communicationPar?.CommunicationDevices?.ToList().ForEach(x => { viewModel.DevNameList.Add(x.DeviceName); });
} }
#endregion #endregion
} }


+ 11
- 3
BeDesignerSCADA/ViewModel/MainViewModelNew.cs View File

@@ -1,6 +1,7 @@
using BeDesignerSCADA.Common; using BeDesignerSCADA.Common;
using BeDesignerSCADA.Controls; using BeDesignerSCADA.Controls;
using BeDesignerSCADA.View; using BeDesignerSCADA.View;
using BPASmart.Model;
using BPASmartClient.Compiler; using BPASmartClient.Compiler;
using BPASmartClient.DATABUS; using BPASmartClient.DATABUS;
using BPASmartClient.MessageName; using BPASmartClient.MessageName;
@@ -12,6 +13,7 @@ using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input; using Microsoft.Toolkit.Mvvm.Input;
using Microsoft.Win32; using Microsoft.Win32;
using System; using System;
using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
@@ -35,7 +37,7 @@ namespace BeDesignerSCADA.ViewModel
{ {
IsRunning = !IsRunning; IsRunning = !IsRunning;
}); });
DataBusModel.GetInstance().RefreshTheVariableManagerAction += RefreshTheVariableManagerActionHader;
DataBusModel.GetInstance().RefreshTheVariableManagerAction += RefreshTheVariableManagerActionHader;
} }


#region 变量 #region 变量
@@ -43,7 +45,10 @@ namespace BeDesignerSCADA.ViewModel
/// 变量管理器地址 /// 变量管理器地址
/// </summary> /// </summary>
public string VariablePath = string.Empty; public string VariablePath = string.Empty;

/// <summary>
/// 当前变量管理器变量
/// </summary>
public CommunicationPar communicationPar = new CommunicationPar();
/// <summary> /// <summary>
/// 是否正在运行状态 /// 是否正在运行状态
/// </summary> /// </summary>
@@ -211,7 +216,10 @@ namespace BeDesignerSCADA.ViewModel
{ {
if (path == VariablePath && !string.IsNullOrEmpty(VariablePath)) if (path == VariablePath && !string.IsNullOrEmpty(VariablePath))
{ {
if (DataBusModel.GetInstance().KeyValues.ContainsKey(VariablePath))
{
communicationPar = DataBusModel.GetInstance().KeyValues[VariablePath];
}
} }
} }
catch (Exception ex) catch (Exception ex)


Loading…
Cancel
Save