Exemplo n.º 1
0
        private void CurrentPluginFailed(string path, ExceptionDispatchInfo e)
        {
            var plugin = _viewerWindow.Plugin.GetType();

            _viewerWindow.BeginHide();

            TrayIconManager.ShowNotification("", $"Failed to preview {Path.GetFileName(path)}", true);

            Debug.WriteLine(e.SourceException.ToString());
            Debug.WriteLine(e.SourceException.StackTrace);

            const string source = "QuickLook Preview Error";

            if (!EventLog.SourceExists(source))
            {
                EventLog.CreateEventSource(source, "Application");
            }
            EventLog.WriteEntry(source, e.SourceException.ToString(),
                                EventLogEntryType.Error);

            if (plugin != PluginManager.GetInstance().DefaultPlugin.GetType())
            {
                BeginShowNewWindow(path, PluginManager.GetInstance().DefaultPlugin);
            }
            else
            {
                e.Throw();
            }
        }
Exemplo n.º 2
0
        /* comment by gh
         * private void CheckUpdate()
         * {
         *  if (DateTime.Now.Ticks - SettingHelper.Get<long>("LastUpdateTicks") < TimeSpan.FromDays(7).Ticks)
         *      return;
         *
         *  Task.Delay(120 * 1000).ContinueWith(_ => Updater.CheckForUpdates(true));
         *  SettingHelper.Set("LastUpdateTicks", DateTime.Now.Ticks);
         * }
         *///----------//


        private void RunListener(StartupEventArgs e)
        {
            //comment by gh - 启动不显示启动提示
            //TrayIconManager.GetInstance();
            //if (!e.Args.Contains("/autorun") && !IsUWP)
            //TrayIconManager.ShowNotification("", TranslationHelper.Get("APP_START"));
            //if (e.Args.Contains("/first"))
            //AutoStartupHelper.CreateAutorunShortcut();
            //----------//

            //add by gh - 自动启动隐藏后台图标
            if (SettingHelper.Get("Visible", true))
            {
                TrayIconManager.GetInstance();
                if (!e.Args.Contains("/autorun") && !IsUWP)
                {
                    TrayIconManager.ShowNotification("", TranslationHelper.Get("APP_START"));
                }
            }
            else if (e.Args.Contains("/setvisible"))
            {
                SettingHelper.Set("Visible", true);
                TrayIconManager.GetInstance();
                if (!IsUWP)
                {
                    TrayIconManager.ShowNotification("", TranslationHelper.Get("APP_START"));
                }
            }
            //自己添加的功能,与quick look无关
            if (SettingHelper.Get("Watcher", false))
            {
                DesktopWatcher.GetInstance().WatcherStart();
            }

            if (e.Args.Contains("/first"))
            {
                AutoStartupHelper.CreateAutorunShortcut();
            }
            //----------//

            NativeMethods.QuickLook.Init();

            PluginManager.GetInstance();
            ViewWindowManager.GetInstance();
            KeystrokeDispatcher.GetInstance();
            PipeServerManager.GetInstance();
        }
Exemplo n.º 3
0
        private void RunListener(StartupEventArgs e)
        {
            TrayIconManager.GetInstance();
            if (!e.Args.Contains("/autorun") && !IsUWP)
            {
                TrayIconManager.ShowNotification("", TranslationHelper.GetString("APP_START"));
            }
            if (e.Args.Contains("/first"))
            {
                AutoStartupHelper.CreateAutorunShortcut();
            }

            NativeMethods.QuickLook.Init();

            PluginManager.GetInstance();
            ViewWindowManager.GetInstance();
            BackgroundListener.GetInstance();
            PipeServerManager.GetInstance();
        }
Exemplo n.º 4
0
        private void UpgradeSettings()
        {
            if (!Settings.Default.Upgraded)
            {
                return;
            }

            Updater.CollectAndShowReleaseNotes();

            try
            {
                Settings.Default.Upgrade();
            }
            catch (Exception)
            {
                TrayIconManager.ShowNotification("", "Configuration file is currupted and has been removed.", true);
            }
            Settings.Default.Upgraded = false;
            Settings.Default.Save();
        }
Exemplo n.º 5
0
        private void CurrentPluginFailed(string path, ExceptionDispatchInfo e)
        {
            var plugin = _viewerWindow.Plugin.GetType();

            _viewerWindow.BeginHide();

            TrayIconManager.ShowNotification("", $"Failed to preview {Path.GetFileName(path)}", true);

            Debug.WriteLine(e.SourceException.ToString());
            Debug.WriteLine(e.SourceException.StackTrace);

            if (plugin != PluginManager.GetInstance().DefaultPlugin.GetType())
            {
                BeginShowNewWindow(path, PluginManager.GetInstance().DefaultPlugin);
            }
            else
            {
                e.Throw();
            }
        }
Exemplo n.º 6
0
        private void CurrentPluginFailed(string path, ExceptionDispatchInfo e)
        {
            var plugin = _viewerWindow.Plugin.GetType();

            _viewerWindow.BeginHide();

            TrayIconManager.ShowNotification($"Failed to preview {Path.GetFileName(path)}", "Consider reporting this incident to QuickLook’s author.", true);

            Debug.WriteLine(e.SourceException.ToString());

            ProcessHelper.WriteLog(e.SourceException.ToString());

            if (plugin != PluginManager.GetInstance().DefaultPlugin.GetType())
            {
                BeginShowNewWindow(path, PluginManager.GetInstance().DefaultPlugin);
            }
            else
            {
                e.Throw();
            }
        }