Ejemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            CheckForIllegalCrossThreadCalls = false;

            // Runs subtoutine
            SubPreloadStuff();
            SubChangeDayColour();

            // Connection thread
            MyConnection = new Thread(new ThreadStart(SubCheckMyNetwork));
            MyConnection.IsBackground = true;
            MyConnection.Start();

            // Hourly report thread
            MyHourlyCheck = new Thread(new ThreadStart(SubHourlyCheck));
            MyHourlyCheck.IsBackground = true;
            MyHourlyCheck.Start();

            // Reminder check thread
            MyReminderCheck = new Thread(new ThreadStart(SubReminderCheck));
            MyReminderCheck.IsBackground = true;
            MyReminderCheck.Start();

            RBxReminder.Focus();
        }
Ejemplo n.º 2
0
 private void SubUpdateReminders()
 {
     // Runs Subroutine
     LBxRem.Items.Clear();
     foreach (string vAddingReminder in alStoreReminders)
     {
         LBxRem.Items.Add(vAddingReminder);
     }
     RBxReminder.Focus();
 }
Ejemplo n.º 3
0
 private void BtnClearReminderWritten_Click(object sender, EventArgs e)
 {
     // Clears text
     RBxReminder.Clear();
 }
Ejemplo n.º 4
0
        private void BtnAddReminder_Click(object sender, EventArgs e)
        {
            // Add reminder
            if (BtnAddReminder.Text == "Add Reminder")
            {
                if (CBxHours.SelectedIndex != -1 && CBxMinutes.SelectedIndex != -1 && CBxSeconds.SelectedIndex != -1)
                {
                    vReminderSetTime = vHSet + ":" + vMSet + ":" + vSSet + " ";
                    alStoreReminders.Add(vReminderSetTime + RBxReminder.Text);
                    SubUpdateReminders();
                    RBxReminder.Clear();

                    // Reset time entry field
                    CBxHours.SelectedIndex   = -1;
                    CBxMinutes.SelectedIndex = -1;
                    CBxSeconds.SelectedIndex = -1;
                }
                else
                {
                    // Display no time set error message
                    FrmNoTimeSet frmNoTimeSet = new FrmNoTimeSet();
                    frmNoTimeSet.ShowDialog();
                }
            }

            // Allows user to edit reminder
            else if (BtnAddReminder.Text == "Edit Reminder")
            {
                // Stores copy of reminder
                vtmpReminderStore = lblDisplayReminders.Text;

                // recovers reminder to text field
                RBxReminder.Text = vtmpReminderStore;

                // Disables button
                BtnDelteReminder.Enabled = false;

                // Runs subroutine
                SubDeleteReminder();

                // Runs subroutine
                SubUpdateReminders();

                // Changes text button to allow button
                // to perform a different fuction
                BtnAddReminder.Text = "Update Reminder";
            }
            else if (BtnAddReminder.Text == "Update Reminder")
            {
                // Updates reminder with user changes
                RBxReminder.Focus();
                alStoreReminders.Add(RBxReminder.Text);

                // Runs subroutine
                SubUpdateReminders();

                // Clears text field
                RBxReminder.Clear();

                // Changes button text to the
                // original function
                BtnAddReminder.Text = "Add Reminder";

                // Disables buttons
                BtnAddReminder.Enabled   = false;
                BtnDelteReminder.Enabled = false;
            }
        }
Ejemplo n.º 5
0
        // Subroutines

        private void SubPreloadStuff()
        {
            // Hourly reports
            alHourlyReport.Add("00:00:00");
            alHourlyReport.Add("01:00:00");
            alHourlyReport.Add("02:00:00");
            alHourlyReport.Add("03:00:00");
            alHourlyReport.Add("04:00:00");
            alHourlyReport.Add("05:00:00");
            alHourlyReport.Add("06:00:00");
            alHourlyReport.Add("07:00:00");
            alHourlyReport.Add("08:00:00");
            alHourlyReport.Add("09:00:00");
            alHourlyReport.Add("10:00:00");
            alHourlyReport.Add("11:00:00");
            alHourlyReport.Add("12:00:00");
            alHourlyReport.Add("13:00:00");
            alHourlyReport.Add("14:00:00");
            alHourlyReport.Add("15:00:00");
            alHourlyReport.Add("16:00:00");
            alHourlyReport.Add("17:00:00");
            alHourlyReport.Add("18:00:00");
            alHourlyReport.Add("19:00:00");
            alHourlyReport.Add("20:00:00");
            alHourlyReport.Add("21:00:00");
            alHourlyReport.Add("22:00:00");
            alHourlyReport.Add("23:00:00");

            // Checks for directory and reminders
            // if neither can be found, they will be
            // created automatically.

            if (!Directory.Exists(vSysDir))
            {
                Directory.CreateDirectory(vSysDir);
            }

            if (Directory.Exists(vSysDir))
            {
                if (!File.Exists(vSysDir + "Monday" + vFileEx))
                {
                    File.Create(vSysDir + "Monday" + vFileEx);
                }
                else
                {
                    lblDay.Text = "Monday";
                    if (lblDay.Text == DateTime.Now.DayOfWeek.ToString())
                    {
                        // Runs subroutines
                        SubOpenDayOfReminder();
                    }
                }

                if (!File.Exists(vSysDir + "Tuesday" + vFileEx))
                {
                    File.Create(vSysDir + "Tuesday" + vFileEx);
                }
                else
                {
                    lblDay.Text = "Tuesday";
                    if (lblDay.Text == DateTime.Now.DayOfWeek.ToString())
                    {
                        // Runs subroutines
                        SubOpenDayOfReminder();
                    }
                }

                if (!File.Exists(vSysDir + "Wednesday" + vFileEx))
                {
                    File.Create(vSysDir + "Wednesday" + vFileEx);
                }
                else
                {
                    lblDay.Text = "Wednesday";
                    if (lblDay.Text == DateTime.Now.DayOfWeek.ToString())
                    {
                        // Runs subroutines
                        SubOpenDayOfReminder();
                    }
                }

                if (!File.Exists(vSysDir + "Thursday" + vFileEx))
                {
                    File.Create(vSysDir + "Thursday" + vFileEx);
                }
                else
                {
                    lblDay.Text = "Thursday";
                    if (lblDay.Text == DateTime.Now.DayOfWeek.ToString())
                    {
                        // Runs subroutines
                        SubOpenDayOfReminder();
                    }
                }

                if (!File.Exists(vSysDir + "Friday" + vFileEx))
                {
                    File.Create(vSysDir + "Friday" + vFileEx);
                }
                else
                {
                    lblDay.Text = "Friday";
                    if (lblDay.Text == DateTime.Now.DayOfWeek.ToString())
                    {
                        // Runs subroutines
                        SubOpenDayOfReminder();
                    }
                }

                if (!File.Exists(vSysDir + "Saturday" + vFileEx))
                {
                    File.Create(vSysDir + "Saturday" + vFileEx);
                }
                else
                {
                    lblDay.Text = "Saturday";
                    if (lblDay.Text == DateTime.Now.DayOfWeek.ToString())
                    {
                        // Runs subroutines
                        SubOpenDayOfReminder();
                    }
                }

                if (!File.Exists(vSysDir + "Sunday" + vFileEx))
                {
                    File.Create(vSysDir + "Sunday" + vFileEx);
                }
                else
                {
                    lblDay.Text = "Sunday";
                    if (lblDay.Text == DateTime.Now.DayOfWeek.ToString())
                    {
                        // Runs subroutine
                        SubOpenDayOfReminder();
                    }
                }
            }

            // Gets current date from PC
            vDisplayDate = DateTime.Now.ToString("dd/MM/yy");

            // Gets current tine from PC
            vDisplayTime = DateTime.Now.ToString("HH:mm:ss");

            // Gets current day of the week
            vDisplayDay = DateTime.Now.DayOfWeek.ToString();

            // Displays the current time
            BtnShowTime.Text = vDisplayTime;

            // Displays current day of the week
            lblDay.Text = vDisplayDay;

            // Display the current date
            BtnShowDate.Text = vDisplayDate;

            // Enables Timer
            TmrClockTick.Enabled = true;

            // Default selected voice "David"
            Synth.SelectVoice("Microsoft David Desktop");
            frmlblVoice.Text = "David";

            // Volume preset at 50%
            Synth.Volume   = 50;
            lblVolume.Text = Synth.Volume.ToString() + "%";

            // Disables buttons
            BtnDelteReminder.Enabled        = false;
            BtnAddReminder.Enabled          = false;
            BtnClearReminderWritten.Enabled = false;
            BtnViewedReminder.Enabled       = false;
            lblDisplayReminders.Visible     = false;

            // Updates reminders
            SubUpdateReminders();

            // Gives focus to text entry field
            RBxReminder.Focus();

            // Starts Timer
            TmrClockTick.Start();
        }