private void CheckAndLoadCategory() { if (this.category != null) { return; } if (this.Mode == ActionMode.Edit) { this.category = ConvertStringToCategory(this.Job.Category); } else { this.category = Categories[0]; } }
/// <summary> /// Convert a string into a Localizable job category /// </summary> /// <param name="source"></param> /// <returns></returns> internal LocalizableCategory ConvertStringToCategory(string source) { if (this.SmoCategories == null || this.SmoCategories.Length == 0) { throw new InvalidOperationException(); } LocalizableCategory category = null; for (int i = 0; i < this.SmoCategories.Length; ++i) { if (source == this.SmoCategories[i].SmoCategory.Name) { category = this.SmoCategories[i]; break; } } return(category); }