/// <summary> /// Constructor /// </summary> public VoidSelector() { InitializeComponent(); SelectedVoidTransactionType = VoidTransactionType.VOIDBUY; AddReleaseFingerprintsIfNeeded(); selectedValue = false; }
/// <summary> /// Process the index selection for the void transaction type /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void voidTransactionTypeComboBox_SelectedIndexChanged(object sender, EventArgs e) { selectedValue = false; //Determine which type was selected and match it to the enumeration if (this.voidTransactionTypeComboBox.SelectedIndex >= 0) { var sIdx = this.voidTransactionTypeComboBox.SelectedIndex; if (sIdx < this.voidTransactionTypeComboBox.Items.Count) { var strObj = this.voidTransactionTypeComboBox.Items[sIdx]; //Once we have determined we are within range, ensure string integrity if (strObj != null) { var strVal = strObj.ToString(); if (strVal.Equals(VOIDTRANSACTIONTYPES[sIdx], StringComparison.OrdinalIgnoreCase)) { //If the string selected matches the index back into the originating array, parse the //string index value into the proper enumerated type SelectedVoidTransactionType = (VoidTransactionType) Enum.Parse(typeof(VoidTransactionType), sIdx.ToString()); selectedValue = true; } } } } }