Exemplo n.º 1
0
        public AlarmForm()
        {
            InitializeComponent();

            _alarms = new Alarms();
            _alarm = new Alarm();

            categoryComboBox.DataSource = _alarm.AlarmCategories;
        }
        static void Main(string[] args)
        {
            Alarm a1 = new Alarm();
            a1.AlarmClock += SetAlarm;
            //a1.SimulateAlarm(5, "hello");

            foreach (int item in Fibonacci.GetSequence(5))
            {
                Console.WriteLine(item);
            }

            string[] arr = { "a", "b", "d", "o" };
            Console.WriteLine(arr.BinSearsh<string>("b", null));
            Console.Read();
        }
Exemplo n.º 3
0
        public AlarmForm(Alarm alarm)
        {
            InitializeComponent();
            _alarms = new Alarms();
            _alarm = new Alarm();

            categoryComboBox.DataSource = _alarm.AlarmCategories;

            hourNumericUpDown.Value = alarm.AlarmTime.Hour;
            minuteNumericUpDown.Value = alarm.AlarmTime.Minute;
            categoryComboBox.SelectedIndex = Convert.ToInt32(alarm.AlarmCategory);
            enabledCheckBox.Checked = alarm.Enabled;

            SetErrorLabel();
        }
Exemplo n.º 4
0
        public void LoadAlarmsFromFile()
        {
            if (File.Exists(fileLocation) == false) { return; }

            using (StreamReader streamReader = new StreamReader(File.Open(fileLocation, FileMode.Open)))
            {
                int x = Convert.ToInt32(streamReader.ReadLine());

                for (int i = 0; i < x; i++)
                {
                    Alarm alarm = new Alarm();
                    alarm.AlarmTime = Convert.ToDateTime(streamReader.ReadLine());
                    alarm.AlarmCategory = streamReader.ReadLine();
                    alarm.Enabled = (streamReader.ReadLine() == "True" ? true : false);
                    Add(alarm);
                }
            }
            Console.WriteLine("Loaded {0} alarms from file", _alarms.Count);
        }
Exemplo n.º 5
0
 public bool Add(Alarm Alarm)
 {
     _alarms.Add(Alarm);
     return true;
 }
Exemplo n.º 6
0
 public void AddAlarm(Alarm alarm)
 {
     Alarms.Add(alarm);
 }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            Alarm myClock = new Alarm();

            myClock.Initialize();
        }