Пример #1
0
 private DataTable GetSavedTimers()
 {
     Timers.ReadXml(DataFile);
     Timers.AcceptChanges();
     timersDataGridView.Update();
     return(Timers);
 }
Пример #2
0
        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);
            }
        }
Пример #3
0
 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();
     }
 }