protected void OnLoginFinished(bool result, Account account) { this.command.Enabled = true; if (result) { /* login successed */ if (log.IsDebugEnabled) { log.Debug("login successed."); } IProgressTask <float> task = this.viewModel.LoadScene(); task.OnPreExecute(() => { this.command.Enabled = false;/*by databinding, auto set button.interactable = false. */ }).OnFinish(() => { this.command.Enabled = true;/*by databinding, auto set button.interactable = true. */ this.Dismiss(); }).Start(); } else { /* login cancelled */ if (log.IsDebugEnabled) { log.Debug("login cancelled."); } } }
/// <summary> /// Simulate a loading task. /// </summary> public void Unzip() { Loading loading = null; IProgressTask <float> task = this.viewModel.Unzip(); task.OnPreExecute(() => { loading = Loading.Show(); this.command.Enabled = false;/*by databinding, auto set button.interactable = false. */ }).OnFinish(() => { loading.Dispose(); this.OpenLoginWindow(); this.command.Enabled = true;/*by databinding, auto set button.interactable = true. */ }).Start(30); }