Exemplo n.º 1
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     #region Notifications
     TimeSpan diffbetween = DateTime.Now.Minute > 20 && DateTime.Now.Minute < 50 ? new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, 50, 0) - DateTime.Now
         : new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Minute < 50 ? DateTime.Now.Hour : DateTime.Now.AddHours(1).Hour, 20, 0) - DateTime.Now;
     //Get time to the nearest 20 or 50 minute interval.
     _Notifications.Interval = (int)diffbetween.TotalMilliseconds;
     _Notifications.Tick    += new EventHandler(DisplayNotification);
     _Notifications.Start();
     #endregion
     _Appointments = new Appointments();
     if (!_Appointments.Load())
     {
         MessageBox.Show("No appointment file exists or an error occured while trying to load the appointments file",
                         "Creating New File",
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Warning);
     }
     _TodaysAppointments     = new Appointments();
     labelDisplayedDate.Text = DateTime.Now.ToLongDateString();
     GetAppointmentsOnSelectedDate(DateTime.Now);
     vScrollBar.Height  = panelDailyView.ClientRectangle.Size.Height;
     vScrollBar.Maximum = 47 - (panelDailyView.ClientRectangle.Size.Height / PanelRowHeight);
     // Chaned this so that it starts closer to the DateTime.Now.
     //The vScrollBar range at the start-up resolution is capped at 38. So we have to make sure it's no higher than that.
     _SelectedRow     = Utility.ConvertTimeToRow(DateTime.Now);
     vScrollBar.Value = Math.Min(38, _SelectedRow);
 }
Exemplo n.º 2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            _Appointments = new Appointments();

            // Initialise everything for 9am on today's date
            _TodaysAppointments     = new Appointments();
            labelDisplayedDate.Text = DateTime.Now.ToLongDateString();
            GetAppointmentsOnSelectedDate(DateTime.Now);
            vScrollBar.Height  = panelDailyView.ClientRectangle.Size.Height;
            vScrollBar.Maximum = 47 - (panelDailyView.ClientRectangle.Size.Height / PanelRowHeight);
            // 18 is the bar corresponding to 9am.
            vScrollBar.Value = 18;
            _SelectedRow     = 18;
        }
Exemplo n.º 3
0
        public bool Load()
        {
            XmlSerializer  xs              = new XmlSerializer(typeof(c_Appointments));
            XmlTextReader  reader          = new XmlTextReader(FILENAME);
            c_Appointments newAppointments = (c_Appointments)xs.Deserialize(reader);

            foreach (Appointment appointment in newAppointments.appointments)
            {
                IAppointments newAppointment = new IAppointments();
                newAppointment.Start  = appointment.start;
                newAppointment.Length = appointment.length;
                newAppointment.DisplayableDescription = appointment.displayableDescription;
                this.Add(newAppointment);
            }
            return(true);
        }
Exemplo n.º 4
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     _Appointments = new Appointments();
     if (!_Appointments.Load())
     {
         MessageBox.Show("No appointment file exists or an error occured while trying to load the appointments file",
                         "Creating New File",
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Warning);
     }
     // Initialise everything for 9am on today's date
     _TodaysAppointments     = new Appointments();
     labelDisplayedDate.Text = DateTime.Now.ToLongDateString();
     GetAppointmentsOnSelectedDate(DateTime.Now);
     vScrollBar.Height  = panelDailyView.ClientRectangle.Size.Height;
     vScrollBar.Maximum = 47 - (panelDailyView.ClientRectangle.Size.Height / PanelRowHeight);
     // 18 is the bar corresponding to 9am.
     vScrollBar.Value = 18;
     _SelectedRow     = 18;
 }