static void UserButton_OnInterrupt(uint data1, uint data2, DateTime time) { var newEvent = new ButtonEvent(time, data2 == 1); _repository.Add(newEvent); PrintContent(); }
public static ButtonEvent ToEntity(string value) { string[] tokens = value.Split(Separator); DateTime dt = ToDateTime(tokens[0]); bool state = ToState(tokens[1]); var result = new ButtonEvent(dt, state); return result; }
public void Add(ButtonEvent buttonEvent) { string content = ButtonEventConverter.ToString(buttonEvent); lock(_sync) { using (TextWriter writer = new StreamWriter(_filePath, true)) { writer.WriteLine(content); } } }
public static string ToString(ButtonEvent value) { var sb = new StringBuilder(); var str = ToString(value.EventTime); sb.Append(str); sb.Append(Separator); str = ToString(value.State); sb.Append(str); string result = sb.ToString(); return result; }