예제 #1
0
        private static void StartTimer(Project project, string description = "")
        {
            var ct = tb.GetRunningTimer();

            if (ct != null && ct.pid == project.pid && ct.description == description)
            {
                clt($"A timer is already running for {project.name}.");
            }
            else
            {
                TimeEntryWrapper wrapper = new TimeEntryWrapper();
                wrapper.time_entry = new TimeEntry()
                {
                    description    = description
                    , wid          = int.Parse(ConfigurationManager.AppSettings["WorkspaceID"])
                    , pid          = project.pid
                    , created_with = ".net"
                };
                tb.StartTimer(wrapper);
                logTimerStart(project.name);
                clt($"Tracking started for {project.name}.");
            }
            aTimerIsRunning = true;
        }