private PowerLogEntry ToPowerLogEntry(EventRecord record) { PowerLogEntry pwle = null; if (record.IsPowerOnEvent()) { pwle = new PowerLogEntry { Id = record.Id, Provider = this.GetSourceName(record.ProviderName), Timestamp = record.TimeCreated.Value - PreferenceService.Preference.DayOffset, StartTime = record.TimeCreated.Value }; } else if (record.IsPowerOffEvent()) { pwle = new PowerLogEntry { Id = record.Id, Provider = this.GetSourceName(record.ProviderName), Timestamp = record.TimeCreated.Value - PreferenceService.Preference.DayOffset, EndTime = record.TimeCreated.Value }; } return(pwle); }