/// <summary> /// Imports communication lines and devices. /// </summary> private void Import(out bool noData) { noData = true; ImportedCommLines = new List <Settings.CommLine>(); ImportedDevices = new List <Settings.KP>(); Settings settings = instance.CommApp.Settings; foreach (TreeNode commLineNode in treeView.Nodes) { if (commLineNode.Checked) { CommLine commLineEntity = (CommLine)commLineNode.Tag; Settings.CommLine commLineSettings = CommLineSettings; if (commLineSettings == null) { // import communication line noData = false; commLineSettings = SettingsConverter.CreateCommLine(commLineEntity); commLineSettings.Parent = settings; settings.CommLines.Add(commLineSettings); ImportedCommLines.Add(commLineSettings); } foreach (TreeNode kpNode in commLineNode.Nodes) { if (kpNode.Checked) { // import device noData = false; KP kpEntity = (KP)kpNode.Tag; Settings.KP kpSettings = SettingsConverter.CreateKP(kpEntity, project.ConfigBase.KPTypeTable); kpSettings.Parent = commLineSettings; if (commEnvironment.TryGetKPView(kpSettings, true, null, out KPView kpView, out string errMsg)) { kpSettings.SetReqParams(kpView.DefaultReqParams); } commLineSettings.ReqSequence.Add(kpSettings); ImportedDevices.Add(kpSettings); } } } } }
private void btnDeviceProps_Click(object sender, EventArgs e) { // show the device properties if possible if (environment.TryGetKPView(kp, false, commLine.CustomParams, out KPView kpView, out string errMsg)) { if (kpView.CanShowProps) { kpView.ShowProps(); if (kpView.KPProps.Modified) { kp.CmdLine = kpView.KPProps.CmdLine; ChildFormTag.SendMessage(this, CommMessage.UpdateLineParams); } } else { ScadaUiUtils.ShowWarning(CommShellPhrases.NoDeviceProps); } }