Ejemplo n.º 1
0
 /*
 public WindowChangeActivity(String p_name, String w_title, DateTime time, int score):base(time, score)
 {
     _newProcName = p_name;
     _newWinTitle = w_title;
 }
 */
 /// <summary>
 /// Initializes a new instance of the <see cref="WindowChangeActivity"/> class.
 /// </summary>
 /// <param name="newWindow">The new window.</param>
 /// <param name="time">The time.</param>
 /// <param name="score">The score.</param>
 public WindowChangeActivity(WindowInfo newWindow, DateTime time,  int score)
     : base(time, score)
 {
     this.newWindow = newWindow;
     this._newProcName = newWindow.ProcName;
     this._newWinTitle = newWindow.WinTitle;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Equalses the specified information.
 /// </summary>
 /// <param name="info">The information.</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
 public bool Equals(WindowInfo info)
 {
     return this.winHandle == info.winHandle;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Belongs to same process.
 /// </summary>
 /// <param name="info">The information.</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
 public bool BelongToSameProcess(WindowInfo info)
 {
     return this.procID == info.procID;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Appends the white window information.
 /// </summary>
 /// <param name="info">The information.</param>
 public void AppendWhiteWindowInfo(WindowInfo info)
 {
     this.acceptableWindowsInfos.Add(info);
     this.acceptableWindowTitles.Add(info.WinTitle);
     this.acceptableProcNames.Add(info.ProcName);
     this.acceptableHandles.Add(info.WindowHandle);
 }
Ejemplo n.º 5
0
 //this is called by non-browser windows
 /// <summary>
 /// Checks the windows.
 /// </summary>
 /// <param name="curWin">The current win.</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
 private bool CheckWindows(WindowInfo curWin)
 {
     //if handle matches, return yes.
     if (_workSphere.ContainsHandle(curWin.WindowHandle))
     {
         return true;
     }
     //if not, then check if it's a legit proc
     return _workSphere.ContainsProcName(curWin.ProcName);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Checks whether certain window is on primary task or not, here only determines Good and Bad states
        /// </summary>
        /// <param name="newWinInfo">The new win information.</param>
        public void CheckOnTask(WindowInfo newWinInfo)
        {
            bool temp = IsProcABrowser(newWinInfo.ProcName) ?
                                           CheckKeyWords(newWinInfo.WinTitle) //if it's a browser, disregard handle, title or proc, just look at keywords matching
                                         : CheckWindows(newWinInfo); //if it's not a browser, then don't check title, only Check proc and handle normally

            if (_onTask != temp) //different than before
            {
                curState = temp ? Globals.State.Good : Globals.State.Bad;
                _onTask = temp;
                OnJudgeStateChange(this, new JudgeStateEventArgs(curState)); //Broadcast new state
                if (curState == Globals.State.Good)
                {
                    CheckProcrastinate();
                    _procrastinateIteration = 0;
                }
            }
        }