예제 #1
0
        /// <summary>
        /// ќбновить таймер в списке таймеров
        /// </summary>
        /// <param name="row"></param>
        private void UpdateTimerListItem(DataGridViewRow row)
        {
            TimerListItem timerListItem = row.Tag as TimerListItem;

            if (timerListItem != null)
            {
                if (timerListItem.TimeToAsterEnd == 0)
                {
                    row.DefaultCellStyle.BackColor = Color.FromArgb(255, 200, 200);
                    timerListItem.StopTurrets();
                }
                else if (timerListItem.LasersCount > 0 && timerListItem.IsSatrted)
                {
                    row.DefaultCellStyle.BackColor = timerListItem.IsEmptyClose
                                                                                ? Color.FromArgb(255, 255, 200)
                                                                                : Color.FromArgb(200, 255, 200);
                }



                row.Cells[ColumnTimeToEnd.Index].Value =
                    string.Format("{0:00}:{1:00}", Math.Floor(timerListItem.TimeToAsterEnd / 60), timerListItem.TimeToAsterEnd % 60);
                row.Cells[ColumnCycle.Index].Value =
                    string.Format("{0:00}:{1:00}", Math.Floor(timerListItem.TimeToCycleEnd / 60), timerListItem.TimeToCycleEnd % 60);
                row.Cells[ColumnCurrentQty.Index].Value = string.Format("{0}", timerListItem.CurrentVolume.ToString("F0"));

                if (timerListItem.TimeToAsterEnd == 0)
                {
                    row.Tag = null;
                }
            }
        }
예제 #2
0
 /// <summary>
 ///
 /// </summary>
 void RemoveRows()
 {
     foreach (DataGridViewRow row in dataGridViewTimers.Rows)
     {
         TimerListItem titem = row.Tag as TimerListItem;
         if (titem != null)
         {
             titem.StopTurrets();
         }
     }
     dataGridViewTimers.Rows.Clear();
 }
예제 #3
0
 /// <summary>
 /// Removes the row.
 /// </summary>
 /// <param name="index">The index.</param>
 void RemoveRow(int index)
 {
     if (index >= 0)
     {
         DataGridViewRow row   = dataGridViewTimers.Rows[index];
         TimerListItem   titem = row.Tag as TimerListItem;
         if (titem != null)
         {
             titem.StopTurrets();
         }
         dataGridViewTimers.Rows.Remove(dataGridViewTimers.Rows[index]);
     }
 }