Exemple #1
0
        private void App_OnExit(object sender, ExitEventArgs e)
        {
            if (!_cleanExit)
            {
                return;
            }

            _isRunning.ReleaseMutex();

            PipeServerManager.GetInstance().Dispose();

            //add by gh - 自动启动隐藏后台图标
            if (SettingHelper.Get("Visible", true))
            {
                TrayIconManager.GetInstance().Dispose();
            }
            //----------//

            //comment by gh
            //TrayIconManager.GetInstance().Dispose();
            //----------//

            KeystrokeDispatcher.GetInstance().Dispose();
            ViewWindowManager.GetInstance().Dispose();
        }
        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();
            }
        }
Exemple #3
0
 private void App_OnExit(object sender, ExitEventArgs e)
 {
     if (_isFirstInstance)
     {
         PipeServerManager.GetInstance().Dispose();
         TrayIconManager.GetInstance().Dispose();
         BackgroundListener.GetInstance().Dispose();
     }
 }
Exemple #4
0
        private void App_OnExit(object sender, ExitEventArgs e)
        {
            if (_isFirstInstance)
            {
                _isRunning.ReleaseMutex();

                PipeServerManager.GetInstance().Dispose();
                TrayIconManager.GetInstance().Dispose();
                BackgroundListener.GetInstance().Dispose();
                ViewWindowManager.GetInstance().Dispose();
            }
        }
Exemple #5
0
        private void App_OnExit(object sender, ExitEventArgs e)
        {
            if (!_isFirstInstance)
            {
                return;
            }

            _isRunning.ReleaseMutex();

            PipeServerManager.GetInstance().Dispose();
            TrayIconManager.GetInstance().Dispose();
            KeystrokeDispatcher.GetInstance().Dispose();
            ViewWindowManager.GetInstance().Dispose();
        }
Exemple #6
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();
        }
Exemple #7
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();
        }
Exemple #8
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();
        }
Exemple #9
0
        private void CurrentPluginFailed(ExceptionDispatchInfo e)
        {
            var plugin = _currentMainWindow.Plugin.GetType();

            _currentMainWindow.BeginHide();

            TrayIconManager.GetInstance().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(PluginManager.GetInstance().DefaultPlugin);
            }
            else
            {
                e.Throw();
            }
        }
        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();
            }
        }
Exemple #11
0
        private void RunListener(StartupEventArgs e)
        {
            TrayIconManager.GetInstance();
            if (!e.Args.Contains("/autorun"))
            {
                TrayIconManager.GetInstance().ShowNotification("", "QuickLook is running in the background.");
            }
            if (e.Args.Contains("/first"))
            {
                AutoStartupHelper.CreateAutorunShortcut();
            }

            NativeMethods.QuickLook.Init();

            PluginManager.GetInstance();
            BackgroundListener.GetInstance();
            PipeServerManager.GetInstance().MessageReceived +=
                (msg, ea) => Dispatcher.BeginInvoke(
                    new Action(() => ViewWindowManager.GetInstance().InvokeViewer(msg as string, closeIfSame: true)),
                    DispatcherPriority.ApplicationIdle);
        }
Exemple #12
0
 internal static TrayIconManager GetInstance()
 {
     return(_instance ?? (_instance = new TrayIconManager()));
 }