internal static LaunchOptions FromContext(LaunchContext context) { bool startMinimized = false; string startUrl = null; if (context.Arguments.Length == 2 && context.Arguments[1] == "-u") { return(new LaunchOptions(LaunchOptions.LaunchMode.Unregister, null)); } else if (context.Arguments.Length == 2 && context.Arguments[1] == "-m") { startMinimized = true; } else if (context.Arguments.Length == 2 && context.Arguments[1] == "-r") { return(new LaunchOptions(LaunchOptions.LaunchMode.Register, null)); } else if (context.Arguments.Length == 2) { startUrl = context.Arguments[1]; } else if (context.Arguments.Length > 3 && context.Arguments[1] == "diff") { LaunchOptions.DiffToolModeOptions diffOptions = new LaunchOptions.DiffToolModeOptions(context); return(new LaunchOptions(LaunchOptions.LaunchMode.DiffTool, diffOptions)); } LaunchOptions.NormalModeOptions options = new LaunchOptions.NormalModeOptions(startMinimized, startUrl); return(new LaunchOptions(LaunchOptions.LaunchMode.Normal, options)); }
private static void onLaunchMainInstace(LaunchOptions options) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); cleanUpOldFiles(); bool runningAsUwp = new DesktopBridge.Helpers().IsRunningAsUwp(); Trace.TraceInformation(String.Format("[MainForm] Running as UWP = {0}", runningAsUwp ? "Yes" : "No")); if (runningAsUwp) { revertOldInstallations(); } string path = runningAsUwp ? Constants.UWP_Launcher_Name : Process.GetCurrentProcess().MainModule.FileName; if (!prepareGitEnvironment() || !integrateInDiffTool(path)) { return; } integrateInGitUI(); Version currentVersion = Environment.OSVersion.Version; Trace.TraceInformation(String.Format("OS Version is {0}", currentVersion.ToString())); LaunchOptions.NormalModeOptions normalOptions = options.SpecialOptions as LaunchOptions.NormalModeOptions; Application.Run(new MainForm(normalOptions.StartMinimized, runningAsUwp, normalOptions.StartUrl)); }
private static void onLaunchMainInstance(LaunchOptions options) { cleanUpOldFiles(); if (ApplicationUpdateHelper.ShowCheckForUpdatesDialog()) { Trace.TraceInformation("Application is exiting to install a new version"); return; } bool runningAsUwp = new DesktopBridge.Helpers().IsRunningAsUwp(); Trace.TraceInformation(String.Format("Running as UWP = {0}", runningAsUwp ? "Yes" : "No")); if (runningAsUwp) { revertOldInstallations(); } string path = runningAsUwp ? Constants.UWP_Launcher_Name : Process.GetCurrentProcess().MainModule.FileName; if (!prepareGitEnvironment() || !integrateInDiffTool(path)) { return; } bool integratedInGitExtensions = integrateInGitExtensions(); bool integratedInSourceTree = integrateInSourceTree(); Version osVersion = Environment.OSVersion.Version; Trace.TraceInformation(String.Format("OS version is {0}", osVersion.ToString())); Version clrVersion = Environment.Version; Trace.TraceInformation(String.Format("CLR version is {0}", clrVersion.ToString())); Trace.TraceInformation(String.Format(".NET Framework version is {0}", typeof(string).Assembly.ImageRuntimeVersion)); LaunchOptions.NormalModeOptions normalOptions = options.SpecialOptions as LaunchOptions.NormalModeOptions; Application.Run(new MainForm(normalOptions.StartMinimized, runningAsUwp, normalOptions.StartUrl, integratedInGitExtensions, integratedInSourceTree)); }