public override ItemSearchPresenterResult Run(ItemSearchPresenterArgs itemSearchPresenterArgs) { this.searchArguments = itemSearchPresenterArgs; View.SetViewInfo(itemSearchPresenterArgs.Title); List <ItemTypeItem> itemTypes; if (!string.IsNullOrEmpty(searchArguments.ItemTypeName)) { itemTypes = new List <ItemTypeItem>() { new ItemTypeItem() { itemTypeName = searchArguments.ItemTypeName, itemTypeSingularLabel = searchArguments.ItemTypeSingularLabel } }; } else { itemTypes = searcher.GetItemTypes(); searchArguments.ItemTypeName = itemTypes.First().itemTypeName; } selectedType = itemTypes.First(it => it.itemTypeName == searchArguments.ItemTypeName); View.SetItemTypes(itemTypes, selectedType); LoadSearchSettings(); var savedSearches = searcher.GetSavedSearches(selectedType.itemTypeName); View.SetSavedSearch(savedSearches); SetSearchColumns(selectedType, searchArguments.PredefinedPropertyValues); View.SearchValueChanged += View_SearchValueChanged; View.ItemTypeChanged += View_ItemTypeChanged; View.PageSizeChanged += View_PageSizeChanged; View.SavedSearchChanged += View_SavedSearchChanged; View.SelectedItemChanged += View_SelectedItemChanged; View.RunSearch += View_RunSearch; View.ClearSearch += View_ClearSearch; View.Cancel += View_Cancel; View.Ok += View_Ok; View.NextPage += View_NextPage; View.PreviousPage += View_PreviousPage; View.ShowAsDialog(); return(new ItemSearchPresenterResult() { ItemId = selectedIds.First(), ItemType = selectedType.itemTypeName, DialogResult = View.DialogResult, LastSavedSearch = this.currentSearch.SavedSearchProperties.Cast <PropertyInfo>().ToList(), }); }