/// <summary> /// Enables condition based notifications for the area or source. /// </summary> private void SetEnabledStateMI_Click(object sender, System.EventArgs e) { try { // find current selection. Technosoftware.DaAeHdaClient.Ae.TsCAeBrowseElement selection = null; if (typeof(Technosoftware.DaAeHdaClient.Ae.TsCAeBrowseElement).IsInstanceOfType(browseTv_.SelectedNode.Tag)) { selection = (Technosoftware.DaAeHdaClient.Ae.TsCAeBrowseElement)browseTv_.SelectedNode.Tag; } else if (!typeof(TsCAeServer).IsInstanceOfType(browseTv_.SelectedNode.Tag)) { return; } // prompt user. bool enabled = false; bool result = new SetEnabledStateDlg().ShowDialog( mServer_, selection, out enabled, ref mRecursive_); if (!result) { return; } // apply changes. ArrayList elements = new ArrayList(); if (mRecursive_) { FindBrowseElements(browseTv_.SelectedNode, elements); } else { elements.Add(selection); } // seperate into areas and sources. ArrayList areas = new ArrayList(); ArrayList sources = new ArrayList(); foreach (Technosoftware.DaAeHdaClient.Ae.TsCAeBrowseElement element in elements) { if (element.NodeType == Technosoftware.DaAeHdaClient.Ae.TsCAeBrowseType.Area) { areas.Add(element.QualifiedName); } else { sources.Add(element.QualifiedName); } } // call server. if (enabled) { mServer_.EnableConditionByArea((string[])areas.ToArray(typeof(string))); mServer_.EnableConditionBySource((string[])sources.ToArray(typeof(string))); } else { mServer_.DisableConditionByArea((string[])areas.ToArray(typeof(string))); mServer_.DisableConditionBySource((string[])sources.ToArray(typeof(string))); } } catch (Exception exception) { MessageBox.Show(exception.Message); } }