Example #1
0
        private void NewProject_Click(object sender, EventArgs e)
        {
Retry:
            string NewProjectName = Microsoft.VisualBasic.Interaction.InputBox("Enter project name:", "New Project", "ProjectName");

            if (((NewProjectName.IndexOf(" ") + 1)
                 > 0))
            {
                Microsoft.VisualBasic.Interaction.MsgBox("That project name included spaces. Please use only alphanumerical characters.");
                goto Retry;
            }

            string currentProjectsInIni = ReadAndWriteIni.ReadIni(GlobalVariables.iniFile, "Projects", "list");

            if (((currentProjectsInIni.IndexOf("ERROR:") + 1)
                 > 0))
            {
                currentProjectsInIni = "";
            }

            ReadAndWriteIni.writeIni(GlobalVariables.iniFile, "Projects", "list", (currentProjectsInIni
                                                                                   + (NewProjectName + ",")));
            ProjectSelector.Items.Clear();
            GlobalVariables.projects = ReadAndWriteIni.ReadIni(GlobalVariables.iniFile, "Projects", "list");
            this.PopulateComboBox();
            ReadAndWriteIni.writeIni(GlobalVariables.iniFile, "Times", NewProjectName, "0,0,0,0");
            ReadAndWriteIni.writeIni(GlobalVariables.iniFile, "History", NewProjectName, "");
        }
Example #2
0
        private void DeleteProject_Click(object sender, EventArgs e)
        {
            string toBeDeleted = ProjectSelector.SelectedItem.ToString();
            string projectsNow = GlobalVariables.projects.Replace((toBeDeleted + ","), "");

            ReadAndWriteIni.writeIni(GlobalVariables.iniFile, "Projects", "list", projectsNow);
            ReadAndWriteIni.deleteKeyFromIni(GlobalVariables.iniFile, "Times", toBeDeleted);
            ReadAndWriteIni.deleteKeyFromIni(GlobalVariables.iniFile, "History", toBeDeleted);
            ProjectSelector.Items.Clear();
            GlobalVariables.projects = ReadAndWriteIni.ReadIni(GlobalVariables.iniFile, "Projects", "list");
            this.PopulateComboBox();
        }
Example #3
0
        private void StartStop_Click(object sender, EventArgs e)
        {
            DateTime moment = DateTime.Now;

            if ((StartStop.Text == "Start timer"))
            {
                DayTimer.Enabled    = true;
                HourTimer.Enabled   = true;
                MinuteTimer.Enabled = true;
                SecondTimer.Enabled = true;
                HistoryBox.Text     = (HistoryBox.Text + ("START: "
                                                          + (moment.ToString() + Environment.NewLine)));
            }
            else
            {
                DayTimer.Enabled    = false;
                HourTimer.Enabled   = false;
                MinuteTimer.Enabled = false;
                SecondTimer.Enabled = false;
                HistoryBox.Text     = (HistoryBox.Text + ("STOP: "
                                                          + (moment.ToString() + Environment.NewLine)));
                ReadAndWriteIni.writeIni(GlobalVariables.iniFile, "Times", GlobalVariables.CurrentProject, (Days.Text + (","
                                                                                                                         + (Hours.Text + (","
                                                                                                                                          + (Minutes.Text + ("," + Seconds.Text)))))));
                string History;
                History = HistoryBox.Text.Replace(Environment.NewLine, ",").ToString();
                ReadAndWriteIni.writeIni(GlobalVariables.iniFile, "History", GlobalVariables.CurrentProject, History.Replace(("Selected Project: "
                                                                                                                              + (GlobalVariables.CurrentProject + ",,")), ""));
            }

            if ((StartStop.Text == "Start timer"))
            {
                StartStop.Text = "Stop timer";
            }
            else
            {
                StartStop.Text = "Start timer";
            }
        }