private void ShowAttributes(AFAttributes attrs) { foreach (AFAttribute attr in attrs) { ShowAttribute(attr); } }
private void afTreeView1_AfterSelect(object sender, TreeViewEventArgs e) { //Initialise objects. AFElement selectedElement = afTreeView1.AFSelection as AFElement; AFAttributes attributeTree = null; //Clear data items lbCurrentVal.Text = ""; lbTagName.Text = ""; afStartDate.Text = ""; afEndTime.Text = ""; lbTimestamp.Text = ""; lbData.Items.Clear(); cbUOM.Items.Clear(); btnInspectTag.Hide(); lbAttribName.Text = ""; afDataChart.Series["dataSeries"].Points.Clear(); //Check for null case if (selectedElement != null) { //Get attributes of selected element attributeTree = selectedElement.Attributes; //Fill afTreeView2 with attributeList afTreeView2.AFRoot = attributeTree; } }
// Attributes /// <summary> /// Uses the Element Path to access the Attributes. /// </summary> /// <remarks> The AFTreeView is implemented with ToolTipText is the path to the selected Element. </remarks> /// <param name="path"> The pathway to the Element</param> /// <returns> AFAttributes containing the Attributes of the selected Element. </returns> public AFAttributes getAttributes(string path) { mainForm.Status("Getting Attributes..."); List <string> searchPaths = new List <string> { path }; AFKeyedResults <string, AFElement> result = AFElement.FindElementsByPath(searchPaths, null); AFElement elem = result[path]; AFAttributes atts = elem.Attributes; return(atts); }
private void GetEventFrames_Click(object sender, EventArgs e) { if (afTreeView1.AFSelectedPath == afTreeView1.AFRootPath) { MessageBox.Show("Please Select Element from ElementTree"); } else { //Clear ListBoxes EFListView.Items.Clear(); EFAttrView.Items.Clear(); myElement = myAFDatabase.Elements[afTreeView1.AFSelectedPath]; AFAttributes myAFAttributes = myElement.Attributes; if (myAFAttributes.Count == 0) { //MessageBox.Show("No Attribute Found"); } else { AFNamedCollectionList <AFEventFrame> EFs; String SearchString = "ElementName:" + myElement.Name; //Use EventFrameTemplate for searching myElementTemplate = myAFDatabase.ElementTemplates[EventFrameTemplateComboBox.SelectedItem.ToString()]; EFs = myElement.GetEventFrames(AFSearchMode.Overlapped, StartTimeTextBox.Text, EndTimeTextBox.Text, "", null, myElementTemplate, AFSortField.StartTime, AFSortOrder.Descending, 0, 1000); foreach (AFEventFrame EF in EFs) { string[] displayvalues = new string[5]; displayvalues[0] = EF.Name; TimeSpan EFDuration = EF.EndTime - EF.StartTime; //Not ending eventframe returns 9999 year. if (EFDuration.TotalSeconds < 5000000) { displayvalues[1] = EFDuration.TotalSeconds.ToString(); } else { displayvalues[1] = "-"; } displayvalues[2] = EF.StartTime.LocalTime.ToString(); displayvalues[3] = EF.EndTime.LocalTime.ToString(); displayvalues[4] = EF.UniqueID; ListViewItem lvi = new ListViewItem(displayvalues); EFListView.Items.Add(lvi); } } } }
private void ProcessAttributes(AFAttributes attributes, string prefix, TypeFilterHandler filterHandler, ComboBox comboBox) { foreach (AFAttribute attr in attributes) { string attrName = prefix + "|" + attr.Name; if (attr != fDataReference.Attribute) { if (filterHandler(attr.Type)) { comboBox.Items.Add(attrName); } } ProcessAttributes(attr.Attributes, attrName, filterHandler, comboBox); } }
private static void ListAttributes(AFElement element, StreamWriter outputFile) { AFAttributes attributes = element.Attributes; foreach (AFAttribute attribute in attributes) { String tagName; try { tagName = attribute.PIPoint.Name; } catch (Exception) { tagName = "NONE"; } outputFile.WriteLine(attribute.GetPath() + "," + tagName); } }
private void ProcessAttributes(AFAttributes attributes, string prefix, ComboBox comboBox) { foreach (AFAttribute attr in attributes) { string attrName = prefix + "|" + attr.Name; if (attr != dataReference.Attribute) { if (attr.DataReference != null && attr.DataReference.PIPoint != null) { comboBox.Items.Add(attrName); } } ProcessAttributes(attr.Attributes, attrName, comboBox); } }
private void ProcessAttributes(AFAttributes attributes, string prefix) { foreach (AFAttribute attr in attributes) { if (attr == dataReference.Attribute) { continue; } string attrName = prefix + "|" + attr.Name; if (BitmaskCore.IsIntVal(attr.Type)) { txtAttribute.Items.Add(attrName); } ProcessAttributes(attr.Attributes, attrName); } }
private void ProcessAttributes(AFAttributes attributes, string prefix) { foreach (AFAttribute attr in attributes) { if (attr == fDataReference.Attribute) { continue; } string attrName = prefix + "|" + attr.Name; if (Extensions.IsNumericType(attr.Type)) { txtAttribute.Items.Add(attrName); } ProcessAttributes(attr.Attributes, attrName); } }
private void ProcessAttributes(AFAttributes attributes, string prefix) { foreach (AFAttribute attr in attributes) { if (attr == fDataReference.Attribute) { continue; } string attrName = prefix + "|" + attr.Name; if (TransformerCore.IsNumericVal(attr.Type)) { cmbSourceAttribute.Items.Add(attrName); } ProcessAttributes(attr.Attributes, attrName); } }
private void EFListView_SelectedIndexChanged(object sender, EventArgs e) { if (EFListView.SelectedItems.Count == 1) { EFAttrView.Items.Clear(); ListViewItem SelectedEF = EFListView.SelectedItems[0]; Guid myEFGUID = Guid.Empty; String myguidstring = SelectedEF.SubItems[4].Text; try { myEFGUID = Guid.Parse(myguidstring); } catch { MessageBox.Show("Cannot convert GUID"); } AFEventFrame myEF = AFEventFrame.FindEventFrame(myAFServer, myEFGUID); AFAttributes myEFAttrs = myEF.Attributes; foreach (AFAttribute attr in myEFAttrs) { string[] displayvalues = new string[4]; displayvalues[0] = attr.Name; try { displayvalues[1] = attr.Data.RecordedValue(myEF.EndTime, AFRetrievalMode.AtOrAfter, null).ToString(); } catch { try { displayvalues[1] = attr.GetValue().ToString(); } catch (Exception ex2) { MessageBox.Show(ex2.Message); } } displayvalues[2] = myEF.Name; displayvalues[3] = myEF.UniqueID; ListViewItem lvi = new ListViewItem(displayvalues); EFAttrView.Items.Add(lvi); } } }
private void afTreeView1_AfterSelect(object sender, TreeViewEventArgs e) { if (afTreeView1.AFSelectedPath == afTreeView1.AFRootPath) { //MessageBox.Show("Please Select Element from ElementTree"); } else { myElement = myAFDatabase.Elements[afTreeView1.AFSelectedPath]; AFAttributes myAFAttributes = myElement.Attributes; AttributeList.Items.Clear(); if (myAFAttributes.Count == 0) { //MessageBox.Show("No Attribute Found"); } else { foreach (AFAttribute at in myAFAttributes) { try { string[] displayvalues = new string[2]; displayvalues[0] = at.Name; displayvalues[1] = at.GetValue().Value.ToString(); ListViewItem lvi = new ListViewItem(displayvalues); lvi.Text = at.Name; AttributeList.Items.Add(lvi); } catch { MessageBox.Show("Error"); } } } } }
/// <summary> /// Shows the list of Attributes and their values in the AFViewControl. /// </summary> /// <param name="atts">AFAttributes to be shown.</param> private void InitializeAttributeListBox(AFAttributes atts) { avcAttributes.AFSetObject(atts, afDatabasePicker1.AFDatabase, null, null); }