예제 #1
0
파일: Form1.cs 프로젝트: Rizhiy825/Timer
        private void ForegroundChanged(string name)
        {
            if (stopwatch.Running == true)
            {
                stopwatch.Pause();
                var entity = new Session();
                entity.stopDate      = DateTime.Now;
                entity.timeSpanTicks = stopwatch.programElapsed.Ticks;
                entity.programName   = programName;
                entity.category      = selectedCategory;
                sessions.Add(entity);
                stopwatch.ResetProgramElapsed();
                stopwatch.Start();

                ActiveWindowLabel.Invoke((MethodInvoker) delegate
                {
                    ActiveWindowLabel.Text = programName;
                });
            }
            programName = name;
        }
예제 #2
0
        private void ForegroundChanged(string name)
        {
            programName = name;

            if (stopwatch.Running == true)
            {
                stopwatch.Pause();
                var entity = new Entity();
                entity.stopDate      = DateTime.Now;
                entity.timeSpanTicks = stopwatch.programElapsed.Ticks / 10000000;
                entity.programName   = name;
                entities.Add(entity);
                stopwatch.ResetProgramElapsed();
                stopwatch.Start();

                ActiveWindowLabel.Invoke((MethodInvoker) delegate
                {
                    ActiveWindowLabel.Text = programName;
                });
            }
        }