protected override void OnNavigatedTo(NavigationEventArgs e) { if (e.Parameter is not ViewModel vm) { throw ProgrammerError.Auto(); } this._mainViewModel = vm; }
protected override void OnNavigatedTo(NavigationEventArgs e) { var(controller, args) = PagedControlAccessor.FromNavigationArguments <EditComicInfoDialogNavigationArguments>( e.Parameter ?? throw ProgrammerError.Unwrapped("e.Parameter")); this.PagedControlAccessor = controller; this._viewModel = new EditComicInfoDialogViewModel(args.MainViewModel, args.ComicItem); }
private async void SaveChangesButton_Click(object sender, RoutedEventArgs e) { await this.ViewModel.SaveComicInfoAsync( displayTitle : this.DisplayTitleTextBox.Text, title : this.TitleTextBox.Text, author : this.AuthorTextBox.Text, category : this.CategoryTextBox.Text, dateAdded : this.DateAddedTextBox.Text, tags : this.ComicTagsTextBox.Text, loved : this.ComicLovedCheckBox.IsChecked ?? throw ProgrammerError.Unwrapped() ); this.PagedControlAccessor !.CloseContainer(); }
public static async Task <ContentDialogResult> ScheduleShowAsync(this ContentDialog dialog) { scheduledContentDialogs.Enqueue(dialog); while (!scheduledContentDialogs.TryPeek(out var first) || first != dialog) { await Task.Delay(100); } lastResult = null; await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync( CoreDispatcherPriority.Normal, async() => lastResult = await dialog.ShowAsync() ); while (lastResult == null) { await Task.Delay(100); } while (true) { if (scheduledContentDialogs.TryDequeue(out var first)) { if (first != dialog) { throw ProgrammerError.Auto(); } break; } await Task.Delay(100); } return((ContentDialogResult)lastResult); }