Example #1
0
 private void notifyIcon_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     theme.HandleDarkMode();
     MouseClickTrayIcon?.Invoke(sender, e);
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         if (backgroundWorker.IsBusy)
         {
             return;
         }
         //右键单击弹出托盘菜单
         contextMenu.IsOpen = true;
         //激活主窗口,用于处理关闭托盘菜单
         App.Current.MainWindow.Activate();
     }
 }
Example #2
0
        /// <summary>
        /// 是否跳过本次休息
        /// </summary>
        /// <returns>true跳过,false不跳过</returns>
        public bool IsBreakReset()
        {
            if (!config.options.General.Noreset)
            {
                //深色主题切换判断
                theme.HandleDarkMode();

                //0.全屏跳过判断
                if (config.options.Behavior.IsFullScreenBreak)
                {
                    var info = Win32APIHelper.GetFocusWindowInfo();
                    if (info.IsFullScreen)
                    {
                        return(true);
                    }
                }

                //1.进程跳过判断
                if (config.options.Behavior.IsBreakProgressList)
                {
                    Process[] processes = Process.GetProcesses();
                    foreach (Process process in processes)
                    {
                        try
                        {
                            if (config.options.Behavior.BreakProgressList.Contains(process.ProcessName))
                            {
                                return(true);
                            }
                        }
                        catch
                        {
                        }
                    }
                }

                return(false);
            }

            return(true);
        }