Example #1
0
        private void buttonCreateTimer_Click(object sender, EventArgs e)
        {
            int totalTime = 0;

            //Tab tempTab = new Tab(null, null, null, null);
            if (comboBoxUsers.Text != "" && (textBoxHours.Text != "" || textBoxMinutes.Text != ""))
            {
                if (textBoxHours.Text != "")
                {
                    totalTime = int.Parse(textBoxHours.Text) * 3600 * 1000;
                }

                if (textBoxMinutes.Text != "")
                {
                    totalTime = totalTime + (int.Parse(textBoxMinutes.Text) * 60 * 1000);
                }
                if (comboBoxUsers.Text == "IOURPG")
                {
                    _form1.createIOUTimer(totalTime);
                    MessageBox.Show("Timer for IOURPG created.");
                    listBoxTimers.Items.Clear();
                    refreshtimerListBox();
                }
                else
                {
                    foreach (Tab tab in _tabList)
                    {
                        if (comboBoxUsers.Text == tab.getUsername())
                        {
                            _form1.createTimer(totalTime, tab);
                            MessageBox.Show("Timer for " + tab.getUsername() + " created.");
                            listBoxTimers.Items.Clear();
                            refreshtimerListBox();
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Please select a user from the dropdown box and input a time.");
            }
        }