/// <summary> /// The Selected has changed. /// </summary> /// <param name="control"></param> /// <param name="selectedIndex"></param> public void OnSelectedIndexChanged(LabelComboBoxControl control, int selectedIndex, object selectedItem) { // if the control and selectedItem both exist if ((NullHelper.Exists(control, selectedItem)) && (this.HasSelectedIgnoreFolderException)) { // set the exceptionType IgnoreFolderExceptionTypeEnum exceptionType = ParseExceptionType(selectedItem); // Set the exceptionType this.SelectedIgnoreFolderException.IgnoreExceptionType = exceptionType; } }
/// <summary> /// This method returns the Exception Type /// </summary> public IgnoreFolderExceptionTypeEnum ParseExceptionType(object selectedItem) { // initial value IgnoreFolderExceptionTypeEnum exceptionType = IgnoreFolderExceptionTypeEnum.Do_Not_Add_Any_Content; // If the selectedItem object exists if (NullHelper.Exists(selectedItem)) { // get the text of the selectedItem string text = selectedItem.ToString(); // Determine the action by the text switch (text) { case "Do Not Add Any Content": // Set the return value exceptionType = IgnoreFolderExceptionTypeEnum.Do_Not_Add_Any_Content; // required break; case "Do Not Add Matching Extensions": // Set the return value exceptionType = IgnoreFolderExceptionTypeEnum.Do_Not_Add_Matching_Extensions; // required break; case "Do Not Add Matching Names": // Set the return value exceptionType = IgnoreFolderExceptionTypeEnum.Do_Not_Add_Matching_Names; // required break; case "Do Not Copy The Folder": // Set the return value exceptionType = IgnoreFolderExceptionTypeEnum.Do_Not_Copy_The_Folder; // required break; case "Add Matching Extensions": // Set the return value exceptionType = IgnoreFolderExceptionTypeEnum.Add_Matching_Extensions; // required break; case "Add Matching Names": // Set the return value exceptionType = IgnoreFolderExceptionTypeEnum.Add_Matching_Names; // required break; } } // return value return(exceptionType); }