Exemple #1
0
        public bool?UserIsWorking()
        {
            var current = ProcessTools.GetCurrentWorkingProcess();

            if (current == null)
            {
                currentProcess = string.Empty; return(null);
            }
            if (current.ProcessName.Equals(browserHandler.BrowserProcessName))
            {
                var url = browserHandler.ExtractUrl(current);
                currentProcess = url;
                if (workingProcesses.Any(p => p.PostFix.Equals(url)))
                {
                    return(true);
                }
                else if (slackingProcesses.Any(p => p.PostFix.Equals(url)))
                {
                    return(false);
                }
                else if (string.IsNullOrEmpty(url))
                {
                    return(true);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                currentProcess = current.ProcessName;
                foreach (var p in workingProcesses)
                {
                    if (p.Name.Equals(current.ProcessName))
                    {
                        if (p.PostFix.Equals(current.MainWindowTitle))
                        {
                            return(true);
                        }
                    }
                }
                foreach (var p in slackingProcesses)
                {
                    if (p.Name.Equals(current.ProcessName))
                    {
                        return(false);
                    }
                }
                return(null);
            }
        }
Exemple #2
0
 public void KillCurrentWindow()
 {
     ProcessTools.KillCurrent();
 }