private void ShowProgramsButton_Click(object sender, RoutedEventArgs e)
        {
            foreach (Process p in processList)
            {
                DateTime startTime   = p.StartTime;
                DateTime currentTime = DateTime.Now;
                TimeSpan h1          = startTime - currentTime;
                TimeSpan h2          = currentTime - startTime;

                TimeSpan diff = currentTime - startTime;
                TimeSpan StateTimeSpanInSeconds;
                TimeSpan StateTimeSpan;
                string   StateTime;

                StateTimeSpanInSeconds = TimeSpan.FromSeconds(diff.TotalSeconds);
                StateTimeSpan          = DateTime.Now.Subtract(startTime);
                StateTime = StateTimeSpanInSeconds.ToString(TIMEFORMAT);

                Debug.WriteLine(p.ProcessName);
                // Debug.WriteLine(@"Elapsed Time: {0:s\:fff} seconds", DateTime.Now - startTime);
                WriteTimeDetails(StateTimeSpan);
                //  FormatTimeString(StateTimeSpan);
                OutputListBox.Items.Add($"ID: {p.Id}  |   Name:{p.ProcessName}  |  Title: {p.MainWindowTitle} | diff: {StateTime}");
            }
        }
Пример #2
0
 public void StateTimer_Tick(object sender, EventArgs e)
 {
     StateTimeSpan          = DateTime.Now.Subtract(StateStartTime);
     StateTimeSpanInSeconds = TimeSpan.FromSeconds(StateTimeSpan.TotalSeconds);
     StateTime = StateTimeSpanInSeconds.ToString(ClockFormat);
 }