private void HandleCredentialsInput(string input) { if (credentialsPhase == CredentialsPhase.Username) { credentialsUsername = input; credentialsPhase = CredentialsPhase.Password; RenderScreen(); } else { var networkDevice = app.GetNetworkDeviceByPath(credentialsTarget.Path); networkDevice.Username = credentialsUsername; networkDevice.Password = input; //clear prompt & render before rebooting - rebooting currently blocks credentialsPhase = CredentialsPhase.None; RenderScreen(); var success = app.RebootNetworkDevice(credentialsTarget); if (success) { AddNotification(String.Format("Rebooting {0}", credentialsTarget.Path)); app.NetworkDevicesConfiguration.SaveNetworkDevicesConfiguration(); } else { AddNotification(String.Format("Unable to reboot {0}", credentialsTarget.Path)); networkDevice.Username = String.Empty; networkDevice.Password = String.Empty; } } }
protected override void HandleInputCanceled() { credentialsPhase = CredentialsPhase.None; RenderScreen(); }
protected override void SetupApplication() { RenderSplashScreen(); app.SetupMiningEngineEvents(); app.LoadPreviousHistory(); app.DataModified += (object sender, EventArgs e) => { ScreenDirty = true; }; app.ConfigurationModified += (object sender, EventArgs e) => { ScreenDirty = true; }; app.ProgressStarted += (object sender, ProgressEventArgs e) => { currentProgress = e.Text; RenderScreen(); }; app.ProgressCompleted += (object sender, EventArgs e) => { currentProgress = String.Empty; RenderScreen(); }; app.NotificationReceived += (object sender, NotificationEventArgs e) => { notifications.Add(e); ScreenDirty = true; }; app.NotificationDismissed += (object sender, NotificationEventArgs e) => { notifications.RemoveAll(n => !String.IsNullOrEmpty(n.Id) && n.Id.Equals(e.Id)); ScreenDirty = true; }; app.PromptReceived += (object sender, PromptEventArgs e) => { currentPrompt = e; promptTime = DateTime.Now; RenderScreen(); }; app.CredentialsRequested += (object sender, CredentialsEventArgs e) => { e.CredentialsProvided = false; credentialsPhase = CredentialsPhase.Username; credentialsTarget = app.LocalViewModel.GetNetworkDeviceByFriendlyName(e.ProtectedResource); RenderScreen(); }; app.Context = threadContext; mineOnStartTimer.Elapsed += (object sender, ElapsedEventArgs e) => { if (app.StartupMiningCountdownSeconds > 0) { currentProgress = string.Format("Mining will start automatically in {0} seconds...", app.StartupMiningCountdownSeconds); } else { currentProgress = String.Empty; mineOnStartTimer.Enabled = false; } RenderScreen(); }; RegisterCommands(); RegisterScreens(); RegisterSettings(); }
protected override void SetupApplication() { RenderSplashScreen(); app.SetupMiningEngineEvents(); app.LoadPreviousHistory(); app.DataModified += (object sender, EventArgs e) => { ScreenDirty = true; }; app.ConfigurationModified += (object sender, EventArgs e) => { ScreenDirty = true; }; app.ProgressStarted += (object sender, ProgressEventArgs e) => { currentProgress = e.Text; RenderScreen(); }; app.ProgressCompleted += (object sender, EventArgs e) => { currentProgress = String.Empty; RenderScreen(); }; app.NotificationReceived += (object sender, NotificationEventArgs e) => { notifications.Add(e); ScreenDirty = true; }; app.NotificationDismissed += (object sender, NotificationEventArgs e) => { notifications.RemoveAll(n => !String.IsNullOrEmpty(n.Id) && n.Id.Equals(e.Id)); ScreenDirty = true; }; app.PromptReceived += (object sender, PromptEventArgs e) => { currentPrompt = e; promptTime = DateTime.Now; RenderScreen(); }; app.CredentialsRequested += (object sender, CredentialsEventArgs e) => { e.CredentialsProvided = false; credentialsPhase = CredentialsPhase.Username; credentialsTarget = app.LocalViewModel.GetNetworkDeviceByFriendlyName(e.ProtectedResource); RenderScreen(); }; app.Context = threadContext; mineOnStartTimer.Elapsed += (object sender, ElapsedEventArgs e) => { if (app.StartupMiningCountdownSeconds > 0) currentProgress = string.Format("Mining will start automatically in {0} seconds...", app.StartupMiningCountdownSeconds); else { currentProgress = String.Empty; mineOnStartTimer.Enabled = false; } RenderScreen(); }; RegisterCommands(); RegisterScreens(); RegisterSettings(); }