/// <summary> /// Populates the tree with the conditions for the source. /// </summary> private void BrowseSource(TreeNodeCollection nodes, OpcClientSdk.Ae.TsCAeBrowseElement source) { // fetch conditions. string[] conditions = m_server.QueryConditionNames(source.QualifiedName); // add conditions to tree. for (int ii = 0; ii < conditions.Length; ii++) { // create node. TreeNode node = new TreeNode(conditions[ii]); node.ImageIndex = Resources.IMAGE_EXPLODING_BOX; node.SelectedImageIndex = Resources.IMAGE_EXPLODING_BOX; node.Tag = new Condition(conditions[ii]); // add dummy child to ensure '+' sign is visible. node.Nodes.Add(new TreeNode()); // add to tree. nodes.Add(node); } }
/// <summary> /// Populates the tree view with the conditions. /// </summary> private void FetchConditions(TreeNode parent, TsCAeServer server, int categoryID) { string[] conditions = server.QueryConditionNames(categoryID); for (int ii = 0; ii < conditions.Length; ii++) { TreeNode node = new TreeNode(conditions[ii]); node.ImageIndex = Resources.IMAGE_YELLOW_SCROLL; node.SelectedImageIndex = Resources.IMAGE_YELLOW_SCROLL; node.Tag = conditions[ii]; // add sub-conditions. FetchSubConditions(node, server, conditions[ii]); parent.Nodes.Add(node); } }
/// <summary> /// Find attributes for condition by searching all categories. /// </summary> private void FindAttributes() { try { Technosoftware.DaAeHdaClient.Ae.TsCAeCategory[] categories = mServer_.QueryEventCategories((int)TsCAeEventType.Condition); for (int ii = 0; ii < categories.Length; ii++) { // fetch conditions for category. string[] conditions = mServer_.QueryConditionNames(categories[ii].ID); // check if this is the category containing the current condition. bool found = false; for (int jj = 0; jj < conditions.Length; jj++) { if (conditions[jj] == mCondition_) { mCategoryId_ = categories[ii].ID; found = true; break; } } // fetch the attributes when found. if (found) { mAttributes_ = mServer_.QueryEventAttributes(categories[ii].ID); break; } } } catch (Exception e) { MessageBox.Show(e.Message); return; } }