public ResultPickerViewModel(ResultPickerItemViewModel[] results, Action<int> onSavedAction) { this.AllResults = results; this.SelectedEntry = 0; this.onSavedAction = onSavedAction; this.OkCommand = new RelayCommand(DoOkCommand); this.CancelCommand = new RelayCommand(DoCancelCommand); }
private string PickCorrectSearchResult(ResultPickerItemViewModel[] searchResult) { if (searchResult.Length == 1) { return searchResult.First().Address; } var searchResultPicked = ""; Application.Current.Dispatcher.Invoke((Action)delegate { var dialog = new SearchPickerDialogHandler(searchResult); dialog.StartDialog((int result) => { searchResultPicked = result != -1 ? searchResult[result].Address : ""; }); }); if (string.IsNullOrEmpty(searchResultPicked)) return string.Empty; WriteProgress($"User picked {searchResultPicked}...", SUCCESS); selected.url = "http://subscene.com/subtitles/" + searchResultPicked; return searchResultPicked; }
public SearchPickerDialogHandler(ResultPickerItemViewModel[] choices) { this.choices = choices; }