public void Update(IActivityReport activityReport) { _activityReport = activityReport; Content = string.Empty; foreach (var section in activityReport.Sections.Values) { var sectionName = section.SectionName; var activities = section.Activities; if (sectionName == string.Empty) { continue; } var totalTime = activityReport.ElapsedActivityTimeString(sectionName); Content += $"=== [{totalTime}] [{section.Clicks}] [{section.KeyStrokes}] {sectionName.ToUpperInvariant()} ===" + Environment.NewLine; if (!_processTimes.ContainsKey(sectionName)) { _processTimes.Add(sectionName, new Dictionary <string, TimeSpan>()); } foreach (var activity in activities) { _processTimes[sectionName][activity.ProcessDescription] = activity.Elapsed; } UpdateProcess(sectionName); } _coupledControl.SetPropertyThreadSafe(_propertyName, Content); }
public void StartReporterThread() { var settings = new Settings(new SettingsReader("ActivityLogger.ini")); ActivityReport = new ActivityReport(); _activityLogger = ActivityLogger.Instance(ActivityReport, settings); var mouseClickLogger = MouseClickLogger.Instance(); var mouseClickReporter = MouseClickReporter.Instance(_activityLogger); mouseClickReporter.Subscribe(mouseClickLogger); var keyLogger = KeyLogger.Instance(); var keyReporter = KeyReporter.Instance(_activityLogger); keyReporter.Subscribe(keyLogger); Task.Factory.StartNew(() => { var activityReporter = new ActivityReporter(_activityReceiver); activityReporter.Subscribe(_activityLogger); var mouseLogger = new MouseLogger(); var mouseReporter = new MouseReporter(_activityLogger); mouseReporter.Subscribe(mouseLogger); var processLogger = new ProcessLogger(); var processReporter = new ProcessReporter(_activityLogger); processReporter.Subscribe(processLogger); var timeLogger = new TimeLogger(); var timeReporter = new TimeReporter(_activityLogger); timeReporter.Subscribe(timeLogger); var activityTypeLogger = new ActivityTypeLogger(settings); var activityTypeReporter = new ActivityTypeReporter(_activityLogger); activityTypeReporter.Subscribe(activityTypeLogger); while (true) { Thread.Sleep(1000); // KeyLogger & MouseClickLogger will log when keystrokes/clicks are // recorded, so no need to tell it to log here. mouseLogger.Log(); processLogger.Log(); timeLogger.Log(); activityTypeLogger.DetermineActivityType( processReporter.ProcessReport, mouseReporter.MouseReport, MouseClickReporter.Instance().MouseClickReport, KeyReporter.Instance().KeyReport); activityTypeLogger.Log(); _activityLogger.Log(); } }); }
public void Update(IActivityReport activityReport) { while (activityReport.LogMessages.Count > _nextIndex) { var logMessage = activityReport.LogMessages.ElementAt(_nextIndex); LogMessage(logMessage); _nextIndex++; } }
public void Update(IActivityReport activityReport) { _activityReport = activityReport; DrawBorder(); DrawBackground(); DrawAxisY(); DrawAxisX(); DrawKpmGraph(); }
public void Update(IActivityReport activityReport) { var elapsed = TimeSpan.FromSeconds(0).ToString("g"); if (activityReport.CurrentActivity != null) { elapsed = activityReport.CurrentActivity.Elapsed.ToString("g"); } _coupledControl.SetPropertyThreadSafe(_propertyName, elapsed); }
public void Update(IActivityReport activityReport) { var activityType = activityReport.ActivityType; if (!activityReport.UserIsActive) { activityType = activityReport.UserIsIdle ? "Idle" : "Other"; } _coupledControl.SetPropertyThreadSafe(_propertyName, $"{activityReport.ProcessDescription} ({activityType})"); }
public static int[] GetKpmList(IActivityReport activityReport) { var kpmList = activityReport?.KeyStrokesPerMinute; if (kpmList == null || kpmList.Count == 0) { return new [] { 1 } } ; return(activityReport.KeyStrokesPerMinute .Select(x => x.Value) .Reverse() .Take(GraphProperties.Width / GraphProperties.BarWidth) .Reverse() .ToArray()); }
public void ReportActivity(IActivityReport activityReport) { lock (ThreadLock) { _activityReport = activityReport; } if (!_graphThreadStarted) { StartGraphThread( new KeyStrokeCountElement(labelAxisX, "Text"), new ActivityGraphElement(CreateGraphics())); } foreach (var control in _controls) { control.Update(activityReport); } }
public void Update(IActivityReport activityReport) { Color color; if (activityReport.UserIsActive) { color = Color.DarkGreen; } else if (activityReport.UserIsIdle) { color = Color.DarkRed; } else { color = Color.OrangeRed; } _coupledControl.SetPropertyThreadSafe(_propertyName, color); }
public void Update(IActivityReport activityReport) { _coupledControl.SetPropertyThreadSafe(_propertyName, (int)(activityReport.CurrentActivityShare * 100)); }
public void Update(IActivityReport activityReport) { _coupledControl.SetPropertyThreadSafe(_propertyName, activityReport.ElapsedCurrentActivityTimeString); }
public void Update(IActivityReport activityReport) { var kpmList = ActivityGraphHelper.GetKpmList(activityReport); _coupledControl.SetPropertyThreadSafe(_propertyName, kpmList.Max().ToString()); }
public void Update(IActivityReport activityReport) { _coupledControl.SetPropertyThreadSafe(_propertyName, activityReport.PercentOfWorkDay()); }
public void Update(IActivityReport activityReport) { _coupledControl.SetPropertyThreadSafe(_propertyName, activityReport.TimeUntilIdlePercentage); }