/// <summary> /// Starts the application. /// </summary> /// <param name="updateSignal">The update signal.</param> /// <param name="debugEnabled">if set to <c>true</c> [debug enabled].</param> private void StartApplication(UpdateSignal updateSignal, bool debugEnabled) { Logger.Initialize(debugEnabled, AppConstants.LogFilePath); var mainApplication = new ApplicationHost(); mainApplication.Initialize(); this.MainWindow = mainApplication.MainWindow; mainApplication.ThemeChanged += this.MainApplicationOnThemeChanged; if (updateSignal == UpdateSignal.Failed) { // Signal failed update. mainApplication.ShowBalloonToolTip("Update error", "An error occurred while installing the application updates.", BalloonIcon.Error); } else if (updateSignal == UpdateSignal.Success) { // Signal successful update. mainApplication.ShowBalloonToolTip("Updates installed", "Application updates has been successfully installed.", BalloonIcon.Info); } this.ApplyTheme(mainApplication.Settings.Theme, mainApplication.Settings.Accent); mainApplication.LoadExtensions(); }
/// <summary> /// Runs on SystemManagerInvoker.Update() /// </summary> public void ProcessUpdate() { if (!Enabled) { return; } _screenSizeProcessor.Process(null); _mousePositionProcessor.Process(null); _touchProcessor.Process(null); UpdateSignal.Emit(); }
public static void UpdateStatusSignal(string Name, string Signal) { try { Form form = Application.OpenForms["Form1"]; Label SignalS; if (form == null) { return; } SignalS = form.Controls.Find(Name + "S", true).FirstOrDefault() as Label; if (SignalS == null) { return; } if (SignalS.InvokeRequired) { UpdateSignal ph = new UpdateSignal(UpdateStatusSignal); SignalS.BeginInvoke(ph, Name, Signal); } else { switch (Signal) { case "Red": SignalS.ForeColor = Color.Red; break; case "Green": SignalS.ForeColor = Color.Green; break; } } } catch (Exception e) { logger.Error("UpdateStatusSignal: Update fail." + e.Message + "\n" + e.StackTrace); } }
/// <summary> /// Validates the arguments. /// </summary> /// <param name="arguments">The arguments.</param> /// <param name="identifier">The identifier.</param> /// <param name="updateSignal">The update signal.</param> /// <param name="debugEnabled">if set to <c>true</c> [debug enabled].</param> /// <returns>A value indicating whether the arguments are valid.</returns> private bool ValidateArguments(string[] arguments, out string identifier, out UpdateSignal updateSignal, out bool debugEnabled) { updateSignal = UpdateSignal.None; debugEnabled = false; identifier = string.Empty; if (Debugger.IsAttached) { // Skip validation in debug mode. return(true); } if (arguments == null || arguments.Length < 3) { return(false); } identifier = arguments[0]; if (identifier != Identifier) { return(false); } var updateStatusStr = arguments[1]; if (!Enum.TryParse(updateStatusStr, true, out updateSignal)) { return(false); } if (!bool.TryParse(arguments[2], out debugEnabled)) { return(false); } return(true); }