Exemple #1
0
        private void stopButton_Click(object sender, EventArgs e)
        {
            for (int index = 0; index < count; index++)
            {
                if (timerArray[index] != null)
                {
                    Console.WriteLine(" Alarm " + (index + 1) + "is not null");
                    if (timerArray[index].Enabled == true)
                    {
                        Console.WriteLine(" Alarm " + (index + 1) + "is enabled");

                        AlarmObject myObject = (AlarmObject)listBox.Items[index];
                        if (DateTime.Compare(DateTime.Now, myObject.getTargetTime()) >= 0)
                        {
                            timerArray[index].Stop();
                            outputLabel.Text = "Status : alarm stopped";

                            myObject.setEnabled("off");

                            listBox.Items.RemoveAt(index);
                            listBox.Items.Insert(index, myObject);
                            SaveFunction = FileManage.Save;
                            SaveFunction(listBox, count, editButton);
                        }
                    }
                }
            }
        }
Exemple #2
0
 public Form1()
 {
     InitializeComponent();
     timerArray   = new Timer[10];
     count        = 0;
     ReadFunction = FileManage.Read;
     ReadFunction(listBox, count, editButton);
 }
Exemple #3
0
 private void saveToFile()
 {
     SaveFunction = FileManage.Save;
     SaveFunction(listBox, count, editButton);
 }