public SingleSelectPrompt(string name, string label, ObservableCollection <T> promptItems, IPromptItem defaultSelection) : base(name, label) { AvailableItems = promptItems; SelectedItem = defaultSelection; SetReadyForReportExecutionChangedIfNeeded(); }
public IPrompt BuildFrom(PromptInfo promptInfo) { var promptItems = new ObservableCollection <T>(); if (promptInfo.DefaultValues.Count() > 1) { throw new DropDownBuilderException(); } var defaultValue = promptInfo.DefaultValues.SingleOrDefault(); IPromptItem defaultItem = null; foreach (var availableItem in promptInfo.PromptLevelInfo.AvailableItems) { var promptItem = _promptItemProvider.Get( promptInfo.Name , promptInfo.PromptLevelInfo.ParameterName , availableItem); if (defaultValue != null) { if (defaultValue.Value == availableItem.Value) { defaultItem = promptItem; } } promptItems.Add(promptItem); } return(_promptProvider.Get(promptInfo.Name, promptInfo.Label, promptItems, defaultItem)); }
protected virtual IPromptItem FindSelectedItemInEnumeration(IPromptItem itemToSelect) { if (itemToSelect == null) { return(null); } return(AvailableItems.Where(i => i.Equals(itemToSelect)).Single()); }
public void Setup() { Mock.Of <IPromptItem>(i => i.Value == "Value 1"); _promptItem1 = Mock.Of <IPromptItem>(i => i.Value == "Value 1"); _promptItem2 = Mock.Of <IPromptItem>(i => i.Value == "Value 1"); _promptItem3 = Mock.Of <IPromptItem>(i => i.Value == "Value 1"); _promptItems = A.ObservableCollection(_promptItem1, _promptItem2, _promptItem3); }
public SearchableSingleSelectPrompt( string name, string label, IPromptItem defaultSelection, ISearchService searchService) : base(name, label, searchService.GetAll(), defaultSelection) { _searchService = searchService; Search = new RelayCommand(OnSearch); AvailableItems = new ObservableCollection <ISearchablePromptItem>(searchService.GetAll().ToArray()); }
public SingleSelectHierarchy( string name , string label , ObservableCollection <ITreeNode> promptItems , IPromptItem defaultSelection) : base( name , label , promptItems , defaultSelection) { }
protected override IPromptItem FindSelectedItemInEnumeration(IPromptItem itemToSelect) { var itemsToSelect = new List <IPromptItem>(); RecurseTree(AvailableItems, n => { if (itemToSelect != null) { if (n == itemToSelect) { n.IsSelected = true; itemsToSelect.Add(n); } else { n.IsSelected = false; } } }); return(itemsToSelect.SingleOrDefault()); }
public IPrompt Get(string name, string label, ObservableCollection <ISearchablePromptItem> availableItems, IPromptItem defaultSelection) { var searchablePromptItemCollection = new SearchablePromptItems(availableItems); var searchProvider = new SearchProvider(); var searchStringParser = new SearchStringParser <ISearch>("*", searchProvider); var searchService = new SearchService(searchablePromptItemCollection, searchStringParser); return(new SearchableSingleSelectPrompt(name, label, defaultSelection, searchService)); }
public void Setup() { Mock.Of<IPromptItem>(i => i.Value == "Value 1"); _promptItem1 = Mock.Of<IPromptItem>(i => i.Value == "Value 1"); _promptItem2 = Mock.Of<IPromptItem>(i => i.Value == "Value 1"); _promptItem3 = Mock.Of<IPromptItem>(i => i.Value == "Value 1"); _promptItems = A.ObservableCollection(_promptItem1, _promptItem2, _promptItem3); }
protected virtual void OnItemSelected(IPromptItem value) { _selectedItem = FindSelectedItemInEnumeration(value); SetReadyForReportExecutionChangedIfNeeded(); RaisePropertyChanged("SelectedItem"); }
public IPrompt Get(string name, string label, ObservableCollection <ITreeNode> availableItems, IPromptItem defaultSelection) { return(new SingleSelectHierarchy(name, label, availableItems, defaultSelection)); }