|
|
@@ -113,6 +113,33 @@ namespace BeDesignerSCADA |
|
|
|
|
|
|
|
#region 其他事件操作 |
|
|
|
/// <summary> |
|
|
|
/// 传入变量管理器地址 |
|
|
|
/// </summary> |
|
|
|
/// <param name="path"></param> |
|
|
|
public void VariableManagerPath(string path) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
viewModel.VariablePath = path; |
|
|
|
DataBusModel.GetInstance().RefreshVariableManager(path); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
private void LoadBtnValue_Click(object sender, RoutedEventArgs e) |
|
|
|
{ |
|
|
|
OpenFileDialog ofd = new OpenFileDialog(); |
|
|
|
ofd.Filter = "变量管理器文件|*.json"; |
|
|
|
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) |
|
|
|
{ |
|
|
|
viewModel.VariablePath = ofd.FileName; |
|
|
|
bool isSucess= DataBusModel.GetInstance().RefreshVariableManager(ofd.FileName); |
|
|
|
System.Windows.MessageBox.Show(isSucess ? "加载成功!" : "加载失败!"); |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 运行 |
|
|
|
/// </summary> |
|
|
|
/// <param name="sender"></param> |
|
|
@@ -288,9 +315,16 @@ namespace BeDesignerSCADA |
|
|
|
{ |
|
|
|
System.Windows.Controls.ComboBox toggle = (System.Windows.Controls.ComboBox)sender; |
|
|
|
if (toggle.Tag == null) return; |
|
|
|
if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(toggle.Tag.ToString())) |
|
|
|
|
|
|
|
CommunicationPar communication = null; |
|
|
|
if (DataBusModel.GetInstance().KeyValues.ContainsKey(viewModel.VariablePath)) |
|
|
|
{ |
|
|
|
Class_DataBus.GetInstance().Dic_DeviceData[toggle.Tag.ToString()].Keys?.ToList().ForEach(key => { viewModel.DevValueList.Add(key); }); |
|
|
|
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); }); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -332,11 +366,17 @@ namespace BeDesignerSCADA |
|
|
|
/// <param name="e"></param> |
|
|
|
private void namebox_DropDownOpened(object sender,EventArgs e) |
|
|
|
{ |
|
|
|
//viewModel.DevNameList = new System.Collections.ObjectModel.ObservableCollection<string>(); |
|
|
|
//Class_DataBus.GetInstance().Dic_DeviceData.Keys?.ToList().ForEach(key => { viewModel.DevNameList.Add(key); }); |
|
|
|
viewModel.DevNameList = new System.Collections.ObjectModel.ObservableCollection<string>(); |
|
|
|
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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |