/// <summary> /// Shows a Ok/Cancel dialog. /// </summary> /// <returns>True if Ok</returns> public static string OkCancel(List <ImgurAlbum> list) { var dialog = new PickAlbumDialog(); dialog.PrepareOkCancel(list); var result = dialog.ShowDialog(); if (!result.HasValue || !result.Value) { return(null); } var item = dialog.MainDataGrid.SelectedItem as ImgurAlbum; return(item?.Id); }
public static async Task <string> AskForAlbum() { var albums = await GetAlbums(); //This looks ugly. var selected = Application.Current.Dispatcher.Invoke(() => Application.Current.Windows[0].Dispatcher.Invoke(() => PickAlbumDialog.OkCancel(albums))); return(selected); }
public static async Task <string> AskForAlbum(ImgurPreset preset) { var albums = await GetAlbums(preset); return(Application.Current.Dispatcher.Invoke <string>(() => PickAlbumDialog.OkCancel(albums))); }