Пример #1
0
        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;
                });
            }
        }