private void ChangeStatus() { switch (this._installer.Status) { case Status.Preparing: this.CanClose = true; this.Content = new PreparationViewModel(); break; case Status.Detected: this.CanClose = true; this.Content = new ConfirmationViewModel(this._installer.Operation) { ClickAction = () => this._installer.Start(), }; break; case Status.Planning: case Status.Applying: this.CanClose = false; if (this.Content is ProgressViewModel) break; this.Content = new ProgressViewModel(this._installer.Operation); break; case Status.Completed: this.CanClose = true; if (this._installer.Result != null && this._installer.Result.Value.IsSucceeded) { var content = new CompletionViewModel(this._installer.Operation, this._installer.Result.Value); switch (this._installer.Operation) { case Operation.Install: case Operation.Upgrade: content.ClickAction = () => { Launcher.Launch(); this.Close(); }; break; case Operation.Uninstall: content.ClickAction = () => this.Close(); break; } this.Content = content; break; } goto default; default: this.CanClose = true; this.Content = new ErrorViewModel(); break; } }
protected override void CloseCanceledCallbackCore() { base.CloseCanceledCallbackCore(); var current = this.Content; var cancel = new CancellationViewModel(current); cancel.CancelCancellationAction = () => this.Content = cancel.Fallback; cancel.PerformCancellationAction = () => this._installer.Cancel(); this.Content = cancel; }
protected void Transition(ViewModel viewModel, Type windowType, TransitionMode mode, bool isOwned) { var message = new TransitionMessage(windowType, viewModel, mode, isOwned ? "Window.Transition.Child" : "Window.Transition"); this.Messenger.Raise(message); }
/// <summary> /// 現在のウィンドウから、指定したウィンドウに <see cref="TransitionMode.NewOrActive"/> で遷移します。 /// </summary> public void Transition(ViewModel viewModel, Type windowType) { this.Transition(viewModel, windowType, TransitionMode.NewOrActive, false); }
/// <summary> /// 現在のウィンドウでダイアログを表示します。 /// </summary> public void Dialog(ViewModel viewModel, Type windowType) { this.Transition(viewModel, windowType, TransitionMode.Modal, true); }