Esempio n. 1
0
        private void ChildItem_CheckStateChanged(object sender, EventArgs e)
        {
            ToolStripItem menuItem = (ToolStripItem)sender;

            SingleTimerLib.SingleTimer _t = TimersList[menuItem.Text.SubStringByIndexOf("-[").Trim()];
            Color _fc = Color.Black;
            Color _bc = Color.White;

            if (_t != null)
            {
                if (_t.TimerIsRunning)
                {
                    _fc = Color.NavajoWhite;
                    _bc = Color.LightSeaGreen;

                    _t.StopTimer();
                    DebugPrint(string.Format("{0}: {1} is no longer running!", "ChildItem_CheckStateChanged", _t.Name));
                }
                else
                {
                    _t.StartTimer();
                    DebugPrint(string.Format("{0}: {1} is now running!", "ChildItem_CheckStateChanged", _t.Name));
                }
                menuItem.BackColor = _t.TimerIsRunning ? Color.LightSeaGreen : Color.LightPink;
                menuItem.ForeColor = _t.TimerIsRunning ? Color.NavajoWhite : Color.MintCream;
                Rows[_t.RowIndex].Cells[1].Style.BackColor = menuItem.BackColor;
                Rows[_t.RowIndex].Cells[1].Style.ForeColor = menuItem.ForeColor;
            }
            else
            {
                menuItem.BackColor = SystemColors.InactiveCaption;
                menuItem.ForeColor = SystemColors.InactiveCaptionText;
            }
        }
Esempio n. 2
0
 private void NewTimerToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     SingleTimerLib.SingleTimer _t = StartNewTimer;
     if (_t != null)
     {
         if (AnswerYesNo(string.Format("Run timer '{0}'?", _t.Name), _t.Name) == DialogResult.Yes)
         {
             _t.StartTimer();
         }
     }
     else
     {
         MessageBox.Show("Adding new Timer failed.\nDid you cancel or attempt to add a duplicate name?");
     }
 }