private DataTable GetSavedTimers() { Timers.ReadXml(DataFile); Timers.AcceptChanges(); timersDataGridView.Update(); return(Timers); }
private void WriteDataToXml() { Timers.EnsureCanonicalTimerNames(); Timers.AcceptChanges(); Timers.WriteXml(DataFile); string message = string.Format("Writing {0} rows to database: '{1}'", Timers.Rows.Count, DataFile); DebugPrint(message); foreach (DataRow _r in Timers.Rows) { message = string.Format("Timer Name {0} is at {1} of elapsed time!", _r[0].ToString(), _r[1].ToString()); DebugPrint(message); } }
private void TreadSafeDeleteDataGridViewRows() { if (timersDataGridView.InvokeRequired) { timersDataGridView.Invoke(new Action(TreadSafeDeleteDataGridViewRows)); return; } foreach (DataGridViewRow _dr in timersDataGridView.SelectedRows) { string name = timersDataGridView.CurrentRow.TimerCanonicalName(); SingleTimerLib.SingleTimer _t = TimersList[name]; _t.SingleTimerChanged -= SingleTimer_SingleTimerChanged; _t.PropertyChanged -= SingleTimer_PropertyChanged; _t.TimerReset -= SingleTimer_OnTimerReset; _t.StopTimer(); Debug.Assert(_t.CanonicalName == Timers.Rows[_t.RowIndex].TimerCanonicalName()); Timers.Rows.RemoveAt(_t.RowIndex); Timers.AcceptChanges(); ThreadSafeUpdateDataGridView(); TimerName2RowIndexDictionary.Remove(name); TimersList.Remove(name); _t.Dispose(); } }