Beispiel #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            if (_noStart)
            {
                return;
            }

            var dotnetVersion = ComputerInfo.GetDotnetVersion();

            if (String.Compare(dotnetVersion, "4.6", StringComparison.Ordinal) < 0)
            {
                new TaskFactory().StartNew(() => MessageBox.Show("Markdown Monster requires .NET 4.6 or later to run.\r\n\r\n" +
                                                                 "Please download and install the latest version of .NET version from:\r\n" +
                                                                 "https://www.microsoft.com/net/download/framework\r\n\r\n" +
                                                                 "Exiting application and navigating to .NET Runtime Downloads page.",
                                                                 "Markdown Monster",
                                                                 MessageBoxButton.OK,
                                                                 MessageBoxImage.Warning
                                                                 ));

                Thread.Sleep(10000);
                ShellUtils.GoUrl("https://www.microsoft.com/net/download/framework");
                Environment.Exit(0);
            }

            new TaskFactory().StartNew(LoadAddins);

            if (mmApp.Configuration.DisableHardwareAcceleration)
            {
                RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;
            }

            // always set directory tocurrent location
            var dir = Assembly.GetExecutingAssembly().Location;

            Directory.SetCurrentDirectory(Path.GetDirectoryName(dir));

            ThemeCustomizations();

            if (!mmApp.Configuration.DisableAddins)
            {
                new TaskFactory().StartNew(() =>
                {
                    ComputerInfo.EnsureBrowserEmulationEnabled("MarkdownMonster.exe");
                    ComputerInfo.EnsureSystemPath();
                    ComputerInfo.EnsureAssociations();

                    if (!Directory.Exists(mmApp.Configuration.InternalCommonFolder))
                    {
                        Directory.CreateDirectory(mmApp.Configuration.InternalCommonFolder);
                    }
                });
            }
        }
Beispiel #2
0
        /// <summary>
        /// Uninstall registry and configuration settings
        /// </summary>
        private void UninstallSettings()
        {
            ComputerInfo.EnsureBrowserEmulationEnabled("MarkdownMonster.exe", uninstall: true);
            ComputerInfo.EnsureSystemPath(uninstall: true);
            ComputerInfo.EnsureAssociations(uninstall: true);

            Console.WriteLine("Markdown Monster settings uninstalled from registry");
            MessageBox.Show("Markdown Monster settings uninstalled from registry");

            noStart = true;
            Environment.Exit(0);
        }