Beispiel #1
0
        private void StartTimer(TrackedProject project, string description = "")
        {
            var ct = tb.GetRunningTimer();

            if (ct != null && ct.pid == project.id && ct.description == description)
            {
                txtConsole.AppendTimeStampedLine($"A timer is already running for {project.name}.");
                runningTimeEntry = ct;
                if (!secondTimer.Enabled)
                {
                    secondTimer.Start();
                }
            }
            else
            {
                TimeEntryWrapper wrapper = new TimeEntryWrapper();
                wrapper.time_entry = new TimeEntry()
                {
                    description    = description
                    , wid          = project.wid
                    , pid          = project.id
                    , created_with = ".net"
                };
                var ted = tb.UnwrapWebResult <TimeEntryData>(tb.StartTimer(wrapper)).data;
                //lblTimer.Text = tb.CalculateDuration(ted.duration).TotalSeconds.ToString();
                secondTimer.Start();
                txtConsole.AppendTimeStampedLine($"Tracking started for {project.name}.", Color.Green);
                runningTimeEntry = ted;
            }
            aTimerIsRunning = true;
            lblTrackingProjectTitle.Text = project.name;
        }
Beispiel #2
0
 private static bool KeywordExistsInActiveWindowTitle(TrackedProject project, string currentActive)
 {
     if (project.projectKeywords != null)
     {
         foreach (var keyword in project.projectKeywords)
         {
             var match = Regex.Match(currentActive, keyword, RegexOptions.IgnoreCase);
             if (match.Success)
             {
                 return(true);
             }
         }
     }
     return(false);
 }