/// <summary> /// Update the CheckedListBox control based on the network dataset attributes (checking the ones currently chosen by the solver) /// </summary> private void PopulateAttributeControl(CheckedListBox chklstBox, INetworkDataset networkDataset, IStringArray strArray, esriNetworkAttributeUsageType usageType) { chklstBox.Items.Clear(); // Loop through the network dataset attributes for (int i = 0; i < networkDataset.AttributeCount; i++) { INetworkAttribute networkAttribute = networkDataset.get_Attribute(i); if (networkAttribute.UsageType == usageType) { string attributeName = networkAttribute.Name; CheckState checkState = CheckState.Unchecked; // If the attribute is in the strArray, it should be checked for (int j = 0; j < strArray.Count; j++) { if (strArray.get_Element(j) == attributeName) { checkState = CheckState.Checked; } } // Add the attribute to the control chklstBox.Items.Add(attributeName, checkState); } } }
private void FrmNecCdfAttributeSelection_Load(object sender, EventArgs e) { IStringArray atArray = rsUtil.getNetCdfVariables(netCdf); for (int i = 0; i < atArray.Count; i++) { string s = atArray.get_Element(i); cmbVariable.Items.Add(s); cmbX.Items.Add(s); cmbY.Items.Add(s); cmbBands.Items.Add(s); } }
private bool IsStringInStringArray(string inputString, IStringArray stringArray) { int numInArray = stringArray.Count; for (int i = 0; i < numInArray; i++) { if (inputString.Equals(stringArray.get_Element(i))) { return(true); } } return(false); }
/// <summary> /// Deserialize the argument object from the stream provided /// </summary> /// <param name="data">Xml stream to deserialize the argument object from</param> public void Deserialize(IXMLSerializeData data) { int nameIndex = data.Find("Names"); int valIndex = data.Find("Values"); if (nameIndex != -1 && valIndex != -1) { IStringArray myNames = (IStringArray)data.GetVariant(nameIndex); IVariantArray myValues = (IVariantArray)data.GetVariant(valIndex); for (int i = 0; i < myNames.Count; ++i) { myProperties.SetProperty(myNames.get_Element(i), myValues.get_Element(i)); } } }
private bool IsStringInStringArray(string inputString, IStringArray stringArray) { int numInArray = stringArray.Count; for (int i = 0; i < numInArray; i++) { if (inputString.Equals(stringArray.get_Element(i))) return true; } return false; }