示例#1
0
        /// TODO: Handle global errors
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        //static void GlobalErrorHandler(object sender, UnhandledExceptionEventArgs args)
        //{
        //    if (!mmApp.HandleApplicationException(args.ExceptionObject as Exception))
        //        Environment.Exit(0);
        //}

        protected override void OnStartup(StartupEventArgs e)
        {
            var dir = Assembly.GetExecutingAssembly().Location;

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

            mmApp.SetTheme(mmApp.Configuration.ApplicationTheme, App.Current.MainWindow as MetroWindow);


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

                    try
                    {
                        AddinManager.Current.LoadAddins();
                        AddinManager.Current.RaiseOnApplicationStart();
                    }
                    catch (Exception ex)
                    {
                        mmApp.Log("Addin loading failed", ex);
                    }
                });
            }
        }
示例#2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            new TaskFactory().StartNew(LoadAddins);

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

            var dir = Assembly.GetExecutingAssembly().Location;

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

            mmApp.SetTheme(mmApp.Configuration.ApplicationTheme, App.Current.MainWindow as MetroWindow);


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

                    if (!Directory.Exists(mmApp.Configuration.InternalCommonFolder))
                    {
                        Directory.CreateDirectory(mmApp.Configuration.InternalCommonFolder);
                    }
                });
            }
        }
示例#3
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);
                    }
                });
            }
        }
示例#4
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);
        }