示例#1
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            //Hook Events
            cmdAppointment.Click         += new EventHandler(cmdAppointment_Click);
            cmdArea.Click                += new EventHandler(cmdArea_Click);
            cmdColumnHeader.Click        += new EventHandler(cmdColumnHeader_Click);
            cmdRowHeader.Click           += new EventHandler(cmdRowHeader_Click);
            cmdSchedule.Click            += new EventHandler(cmdSchedule_Click);
            cmdSelector.Click            += new EventHandler(cmdSelector_Click);
            cmdSelectedAppointment.Click += new EventHandler(cmdSelectedAppointment_Click);

            //Setup schedule
            Schedule1.ViewMode = Gravitybox.Controls.Schedule.ViewModeConstants.DayTopTimeLeft;
            Schedule1.SetMinMaxDate(DateTime.Now, DateTime.Now.AddDays(3));
            Schedule1.ColumnHeader.AutoFit = true;
            Schedule1.StartTime            = new DateTime(2004, 1, 1, 8, 0, 0);
            Schedule1.DayLength            = 10;

            //Add appointment
            Gravitybox.Objects.Appointment appointment;
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Now.AddDays(1), new DateTime(2004, 1, 1, 9, 0, 0), 150);
            appointment.Header.HeaderType = Gravitybox.Objects.AppointmentHeader.HeaderTypeConstants.TimeHeader;
            appointment.Subject           = "This is a test for you to see. I also have a tooltip.";
            appointment.ToolTipText       = "Just tooltip text.";

            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Now.AddDays(2), new DateTime(2004, 1, 1, 9, 30, 0), 150);
            appointment.Header.HeaderType = Gravitybox.Objects.AppointmentHeader.HeaderTypeConstants.TimeHeader;
            appointment.Subject           = "Some more text";
            appointment.ToolTipText       = "Tooltip 2.";

            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Now.AddDays(3), new DateTime(2004, 1, 1, 10, 0, 0), 150);
            appointment.Header.HeaderType = Gravitybox.Objects.AppointmentHeader.HeaderTypeConstants.TimeHeader;
            appointment.Subject           = "Yet again more text!";
            appointment.ToolTipText       = "Tooltip 3.";
        }
示例#2
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            //Setup the Schedule
            Schedule1.Appearance.BackColor = Color.LightYellow;
            Schedule1.StartTime            = new DateTime(2000, 1, 1, 8, 0, 0);
            Schedule1.DayLength            = 10;
            Schedule1.SetMinMaxDate(DateTime.Now, DateTime.Now.AddDays(4));
            Schedule1.ColumnHeader.AutoFit = true;
            Schedule1.MultiSelect          = true;

            Label1.Text = "Select one or more appointments. You can then use copy/cut/paste shortcuts or menus.  After you copy or cut, move the selector to the place you wish to place the appointments and paste. If you cut and paste, the appointment is moved. If you copy and paste, a new appointment is created (a copy).";

            //Add some appointments
            Schedule1.AppointmentCollection.Add("", Schedule1.MinDate, new DateTime(2000, 1, 1, 8, 0, 0), 60);
            Schedule1.AppointmentCollection.Add("", Schedule1.MinDate, new DateTime(2000, 1, 1, 9, 30, 0), 30);
            Schedule1.AppointmentCollection.Add("", Schedule1.MinDate, new DateTime(2000, 1, 1, 11, 0, 0), 120);
            Schedule1.AppointmentCollection.Add("", Schedule1.MinDate.AddDays(1), new DateTime(2000, 1, 1, 8, 30, 0), 60);
            Schedule1.AppointmentCollection.Add("", Schedule1.MinDate.AddDays(1), new DateTime(2000, 1, 1, 10, 0, 0), 90);
            Schedule1.AppointmentCollection.Add("", Schedule1.MinDate.AddDays(1), new DateTime(2000, 1, 1, 11, 0, 0), 60);

            foreach (Appointment appointment in Schedule1.AppointmentCollection)
            {
                appointment.Appearance.BackColor = Color.LightBlue;
                appointment.Subject           = "This is a test";
                appointment.Header.HeaderType = AppointmentHeader.HeaderTypeConstants.TimeHeader;
            }
        }
示例#3
0
        private void ColorForm_Load(object sender, System.EventArgs e)
        {
            schedule1.SetMinMaxDate(DateTime.Parse("1/1/2004"), DateTime.Parse("1/5/2004"));
            schedule1.StartTime = DateTime.Parse("8:00:00 AM");
            schedule1.DayLength = 10;
            Appointment appointment = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/2/2004"), DateTime.Parse("9:00:00 AM"), 120);

            appointment.Subject = "This is a test";

            //Appointment Color
            appointment.Appearance.BackColor = Color.BlanchedAlmond;
            appointment.Appearance.ForeColor = Color.DarkGray;

            //Other Colors
            schedule1.Appearance.BackColor             = Color.Yellow;
            schedule1.Appearance.ForeColor             = Color.Blue;
            schedule1.BackColor                        = Color.Green;
            schedule1.EventHeader.Appearance.BackColor = Color.DarkKhaki;
            schedule1.Selector.Appearance.BackColor    = Color.DarkRed;

            //RowHeader
            schedule1.RowHeader.Appearance.BackColor   = Color.Blue;           //Background
            schedule1.RowHeader.Appearance.ForeColor   = Color.Yellow;         //Text
            schedule1.RowHeader.Appearance.BorderColor = Color.LightGray;      //Border

            //ColumnHeader
            schedule1.ColumnHeader.Appearance.BackColor   = Color.Yellow;        //Background
            schedule1.ColumnHeader.Appearance.ForeColor   = Color.Blue;          //Text
            schedule1.ColumnHeader.Appearance.BorderColor = Color.DarkGreen;     //Border
        }
示例#4
0
        private void PrintForm_Load(object sender, System.EventArgs e)
        {
            //Setup schedule
            schedule1.SetMinMaxDate(DateTime.Parse("1/1/2004"), DateTime.Parse("1/5/2004"));
            schedule1.StartTime = DateTime.Parse("8:00:00 AM");
            schedule1.DayLength = 10;
            schedule1.EventHeader.AllowHeader = false;
            schedule1.AppointmentBar.BarType  = Gravitybox.Controls.Schedule.AppointmentBarConstants.Category;

            //Add Categories
            schedule1.CategoryCollection.Add("", "Category 1", Color.Blue);
            schedule1.CategoryCollection.Add("", "Category 2", Color.Yellow);
            schedule1.CategoryCollection.Add("", "Category 3", Color.LightGreen);

            //Add appointments
            Appointment appointment = null;

            appointment         = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/1/2004"), DateTime.Parse("9:00:00 AM"), 60);
            appointment.Subject = "Suzy Smith";
            appointment.CategoryList.Add(schedule1.CategoryCollection[2]);

            appointment         = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/2/2004"), DateTime.Parse("11:00:00 AM"), 60);
            appointment.Subject = "Walter Cline";
            appointment.CategoryList.Add(schedule1.CategoryCollection[1]);

            appointment         = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/3/2004"), DateTime.Parse("9:30:00 AM"), 60);
            appointment.Subject = "Jeff Newton";
            appointment.CategoryList.Add(schedule1.CategoryCollection[2]);

            appointment         = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/5/2004"), DateTime.Parse("1:30:00 PM"), 60);
            appointment.Subject = "Tom Jones";
            appointment.CategoryList.Add(schedule1.CategoryCollection[0]);
        }
示例#5
0
 private void IconForm_Load(object sender, System.EventArgs e)
 {
     schedule1.SetMinMaxDate(DateTime.Parse("1/1/2004"), DateTime.Parse("1/10/2004"));
     schedule1.StartTime = DateTime.Parse("8:00:00 AM");
     schedule1.DayLength = 10;
     lblDescription.Text = "Press the 'Add' button to add an appointment with 2 icons.";
 }
示例#6
0
        private void frmMain_Load(object sender, System.EventArgs e)
        {
            schedule1.SetMinMaxDate(DateTime.Parse("1/1/2003"), DateTime.Parse("1/1/2003"));
            schedule1.ColumnHeader.AutoFit = true;
            schedule1.AllowRemove          = false;

            //Add an appointments so that all of the dialogs will work!
            Appointment appointment = schedule1.AppointmentCollection.Add("", schedule1.MinDate, DateTime.Parse("9:00:00 AM"), 120);

            appointment.Subject    = "This is my subject!";
            schedule1.SelectedItem = appointment;
        }
示例#7
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            lblHeader.Text = "The dataset would normally be created by querying a database but in this example we will just build it manually.";
            ds             = CreateDataset();
            FillData(ds);
            PopulateSchedule(ds);

            //Setup the schedule
            schedule1.SetMinMaxDate(DateTime.Now, DateTime.Now.AddDays(5));
            schedule1.StartTime = new DateTime(2004, 1, 1, 8, 0, 0);
            schedule1.DayLength = 10;
            schedule1.ViewMode  = Gravitybox.Controls.Schedule.ViewModeConstants.DayTopTimeLeft;
        }
示例#8
0
        private void ReloadWeek(DateTime newDate)
        {
            //This will display the work week that contains the specified date
            int      dayIndex  = int.Parse(newDate.DayOfWeek.ToString("d"));
            DateTime weekStart = newDate.AddDays(-dayIndex + 1);
            DateTime weekEnd   = weekStart.AddDays(4);

            schedule1.SetMinMaxDate(weekStart, weekEnd);
            MonthCalendar1.SetSelectionRange(weekStart, weekEnd);

            //Add code to load appointments here
            //TODO
        }
示例#9
0
        private void RecurrenceForm_Load(object sender, System.EventArgs e)
        {
            lblDescription.Text = "By pressing the button you will add a recurrence pattern for this appointment every 2 days for 8 occurrences.";

            DateTime minDate = new DateTime(2006, 1, 1);

            schedule1.SetMinMaxDate(minDate, minDate.AddDays(20));
            schedule1.StartTime = new DateTime(2000, 1, 1, 8, 0, 0);
            schedule1.DayLength = 10;

            Gravitybox.Objects.Appointment appointment = schedule1.AppointmentCollection.Add("", minDate, schedule1.StartTime, 120);
            appointment.Subject = "This is a test";
        }
示例#10
0
        private void NextSlotForm_Load(object sender, System.EventArgs e)
        {
            this.WindowState     = FormWindowState.Maximized;
            this.Timer1.Interval = 800;

            lblDescription.Text = "This screen has a number of predefined appointments. An appointment will display in the top, left hand corner of the schedule and then move to the next free slot every 2 seconds. This functionality allows you query the schedule for available appointment space. Press 'Close' to close the screen.";

            schedule1.SetMinMaxDate(DateTime.Parse("1/1/2004"), DateTime.Parse("1/5/2004"));
            schedule1.DayLength            = 9;
            schedule1.RowHeader.Size       = 25;
            schedule1.ColumnHeader.AutoFit = true;
            schedule1.AllowSelector        = false;

            //Load some appointments
            schedule1.AppointmentCollection.Add("", DateTime.Parse("1/1/2004"), DateTime.Parse("10:00:00 AM"), 60);
            schedule1.AppointmentCollection.Add("", DateTime.Parse("1/1/2004"), DateTime.Parse("12:00:00 PM"), 90);
            schedule1.AppointmentCollection.Add("", DateTime.Parse("1/1/2004"), DateTime.Parse("2:00:00 PM"), 60);

            schedule1.AppointmentCollection.Add("", DateTime.Parse("1/2/2004"), DateTime.Parse("8:30:00 AM"), 30);
            schedule1.AppointmentCollection.Add("", DateTime.Parse("1/2/2004"), DateTime.Parse("10:00:00 AM"), 30);
            schedule1.AppointmentCollection.Add("", DateTime.Parse("1/2/2004"), DateTime.Parse("11:00:00 AM"), 60);
            schedule1.AppointmentCollection.Add("", DateTime.Parse("1/2/2004"), DateTime.Parse("3:00:00 PM"), 60);
            schedule1.AppointmentCollection.Add("", DateTime.Parse("1/2/2004"), DateTime.Parse("4:30:00 PM"), 30);

            schedule1.AppointmentCollection.Add("", DateTime.Parse("1/3/2004"), DateTime.Parse("8:00:00 AM"), 30);
            schedule1.AppointmentCollection.Add("", DateTime.Parse("1/3/2004"), DateTime.Parse("10:30:00 AM"), 120);
            schedule1.AppointmentCollection.Add("", DateTime.Parse("1/3/2004"), DateTime.Parse("3:30:00 PM"), 45);

            //Setup some appointment properties
            int ii = 1;

            foreach (Appointment element in schedule1.AppointmentCollection)
            {
                element.Subject = "This is appointment " + ii.ToString();
                ii += 1;
            }

            //*******************************************
            //Add the appointment for which we will search for slots
            //Its key is "xyz", this can be any unique string
            Appointment appointment;

            appointment         = schedule1.AppointmentCollection.Add("xyz", DateTime.Parse("1/1/2004"), DateTime.Parse("8:00:00 AM"), 60);
            appointment.Subject = "Test Appt";
            appointment.Appearance.BackColor = Color.LightBlue;
            Timer1.Enabled = true;

            //Refresh the schedule
            schedule1.Refresh();
        }
示例#11
0
        private void Button1_Click(System.Object sender, System.EventArgs e)
        {
            //Setup the schedule
            Schedule1.SetMinMaxDate(new DateTime(2004, 1, 1), new DateTime(2004, 1, 4));
            Schedule1.StartTime            = new DateTime(2004, 1, 1, 8, 0, 0);
            Schedule1.DayLength            = 10;
            Schedule1.ColumnHeader.AutoFit = true;
            Schedule1.AllowRemove          = true;

            //Create a dataset with an "Appointment" table
            System.Data.DataSet   ds = new System.Data.DataSet();
            System.Data.DataTable dt = ds.Tables.Add("appointment");

            //Create the necessary columns
            dt.Columns.Add("appointment_guid", typeof(string));
            dt.Columns.Add("start_date", typeof(DateTime));
            dt.Columns.Add("start_time", typeof(DateTime));
            dt.Columns.Add("length", typeof(int));

            //Mark to disallow DBNull
            dt.Columns["appointment_guid"].AllowDBNull = false;
            dt.Columns["start_date"].AllowDBNull       = false;
            dt.Columns["start_time"].AllowDBNull       = false;
            dt.Columns["length"].AllowDBNull           = false;

            //Mark the 'appointment_guid' column as a unique appointment_guid
            dt.Columns["appointment_guid"].Unique = true;

            //Optional Columns
            dt.Columns.Add("subject", typeof(string));
            dt.Columns.Add("ToolTipText", typeof(string));

            //Add datarows. This will be displayed by the schedule when it is databound
            System.Data.DataRow dr;
            dr = CreateDataRow(dt, Guid.NewGuid().ToString(), new DateTime(2004, 1, 1), new DateTime(2004, 1, 1, 8, 0, 0), 60, "Appointment 1");
            dr["ToolTipText"] = "This is a tip!";
            dr = CreateDataRow(dt, Guid.NewGuid().ToString(), new DateTime(2004, 1, 2), new DateTime(2004, 1, 2, 9, 0, 0), 60, "Appointment 2");
            dr = CreateDataRow(dt, Guid.NewGuid().ToString(), new DateTime(2004, 1, 3), new DateTime(2004, 1, 3, 10, 0, 0), 60, "Appointment 3");

            //Bind the dataset to the schedule
            Schedule1.DataSource = ds;
            Schedule1.Bind();

            DisplayAppointmentCount();

            this.Button2.Enabled = true;
            this.Button3.Enabled = true;
        }
示例#12
0
        private void MainForm_Load(object sender, System.EventArgs e)
        {
            this.SetBounds(0, 0, 800, 500);

            //Setup the Schedule properties
            Schedule1.HeaderDateFormat = "MM/dd";
            Schedule1.SetMinMaxDate(DateTime.Parse("1/12/2004"), DateTime.Parse("1/16/2004"));
            Schedule1.StartTime     = DateTime.Parse("8:00:00 AM");
            Schedule1.DayLength     = 10;
            Schedule1.BlockoutColor = Color.Blue;

            //Create the lunch hour
            Schedule1.ColoredAreaCollection.Add("", Color.LightGreen, DateTime.Parse("12:00:00 PM"), 60);
            Schedule1.ColumnHeader.AutoFit = true;
            Schedule1.RowHeader.AutoFit    = true;

            //Load the Rooms
            Schedule1.RoomCollection.Add("", "Room1");
            Schedule1.RoomCollection.Add("", "Room2");

            //Load some appointments
            Appointment appointment;

            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/12/2004"), Schedule1.RoomCollection[0], DateTime.Parse("9:00:00 AM"), 90);
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/13/2004"), Schedule1.RoomCollection[1], DateTime.Parse("3:00:00 PM"), 120);
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/13/2004"), Schedule1.RoomCollection[0], DateTime.Parse("10:00:00 AM"), 90);
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/13/2004"), Schedule1.RoomCollection[1], DateTime.Parse("9:00:00 AM"), 120);
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/13/2004"), Schedule1.RoomCollection[0], DateTime.Parse("11:00:00 AM"), 60);
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/13/2004"), Schedule1.RoomCollection[1], DateTime.Parse("4:00:00 PM"), 120);
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/14/2004"), Schedule1.RoomCollection[0], DateTime.Parse("8:00:00 AM"), 60);
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/14/2004"), Schedule1.RoomCollection[1], DateTime.Parse("9:00:00 AM"), 60);
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/14/2004"), Schedule1.RoomCollection[0], DateTime.Parse("9:30:00 AM"), 90);
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/14/2004"), Schedule1.RoomCollection[1], DateTime.Parse("11:00:00 AM"), 30);
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/15/2004"), Schedule1.RoomCollection[0], DateTime.Parse("8:30:00 AM"), 30);
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/15/2004"), Schedule1.RoomCollection[1], DateTime.Parse("3:30:00 AM"), 90);
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/15/2004"), Schedule1.RoomCollection[0], DateTime.Parse("1:30:00 AM"), 60);
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/15/2004"), Schedule1.RoomCollection[1], DateTime.Parse("1:30:00 PM"), 120);
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/15/2004"), Schedule1.RoomCollection[0], DateTime.Parse("3:00:00 PM"), 90);
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/16/2004"), Schedule1.RoomCollection[1], DateTime.Parse("9:00:00 AM"), 120);
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/16/2004"), Schedule1.RoomCollection[0], DateTime.Parse("10:30:00 AM"), 60);
            appointment = Schedule1.AppointmentCollection.Add("", DateTime.Parse("1/16/2004"), Schedule1.RoomCollection[1], DateTime.Parse("4:30:00 AM"), 30);

            foreach (Appointment element in Schedule1.AppointmentCollection)
            {
                element.Subject = RandomString();
            }
        }
示例#13
0
        private void UserDrawnForm_Load(object sender, System.EventArgs e)
        {
            //Setup the screen
            schedule1.SetMinMaxDate(DateTime.Parse("1/1/2004"), DateTime.Parse("1/10/2004"));
            schedule1.StartTime              = DateTime.Parse("8:00:00 AM");
            schedule1.DayLength              = 10;
            schedule1.TimeIncrement          = Gravitybox.Controls.Schedule.TimeIncrementConstants.Minute30;
            schedule1.AppointmentBar.BarType = Gravitybox.Controls.Schedule.AppointmentBarConstants.UserDrawn;
            schedule1.AppointmentBar.Size    = 10;
            lblDescription.Text              = "Press the 'Add' button to add an appointment with a user-drawn provider bar.";

            //Add some Providers to the schedule
            //The appointment is 90 minutes and the scehdule increment is 30 minutes
            //This divides equally to 3 providers one foreach (30 minute period
            schedule1.ProviderCollection.Add("", "Provider1", Color.Blue);
            schedule1.ProviderCollection.Add("", "Provider2", Color.Yellow);
            schedule1.ProviderCollection.Add("", "Provider3", Color.Green);
        }
示例#14
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            //Setup the schedule
            Schedule1.SetMinMaxDate(new DateTime(2004, 1, 1), new DateTime(2004, 1, 5));
            Schedule1.StartTime               = new DateTime(2004, 1, 1, 8, 0, 0);
            Schedule1.DayLength               = 10;
            Schedule1.TimeIncrement           = Gravitybox.Controls.Schedule.TimeIncrementConstants.Minute30;
            Schedule1.ColumnHeader.AutoFit    = true;
            Schedule1.EventHeader.AllowHeader = false;
            Schedule1.HeaderDateFormat        = "MMM dd";

            //Setup the dataset
            MyDataset = new GravityboxDataset();
            this.OleDbDataAdapter1.Fill(MyDataset, "Appointment");

            Schedule1.DataSource = MyDataset;
            Schedule1.Bind();
        }
示例#15
0
        private void XMLForm_Load(object sender, System.EventArgs e)
        {
            //Setup the screen
            schedule1.SetMinMaxDate(MINDATE, MINDATE.AddDays(DAYCOUNT - 1));
            schedule1.StartTime           = DateTime.Parse("8:00:00 AM");
            schedule1.DayLength           = 10;
            schedule1.TimeIncrement       = Gravitybox.Controls.Schedule.TimeIncrementConstants.Minute30;
            schedule1.AppointmentBar.Size = 10;
            lblDescription.Text           = "Press the buttons to save and load the appointments to/from an XML file.";

            Recurrence X = new Recurrence();
            string     S = X.ToXML();

            X.FromXML(S);
            System.Diagnostics.Debug.WriteLine(S);

            RandomAppointments();
        }
示例#16
0
        private void LoadSet1()
        {
            const int   Transparency = 40;
            Appointment appointment;

            schedule1.SetMinMaxDate(DateTime.Parse("1/1/2004"), DateTime.Parse("1/5/2004"));
            schedule1.AppointmentCollection.Clear();

            appointment                                = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/1/2004"), DateTime.Parse("8:00:00 AM"), 120);
            appointment.Subject                        = "Appointment 1";
            appointment.Appearance.IsRound             = true;
            appointment.Appearance.BackColor           = Color.LightBlue;
            appointment.Header.Appearance.AllowBreak   = true;
            appointment.Header.Appearance.Transparency = Transparency;

            appointment         = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/1/2004"), DateTime.Parse("11:00:00 AM"), 120);
            appointment.Subject = "Appointment 2";
            appointment.Appearance.BackColor           = Color.LightCoral;
            appointment.Appearance.Transparency        = Transparency;
            appointment.Header.Appearance.AllowBreak   = true;
            appointment.Header.Appearance.Transparency = appointment.Appearance.Transparency;

            appointment                                = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/2/2004"), DateTime.Parse("9:30:00 AM"), 60);
            appointment.Subject                        = "Appointment 3";
            appointment.Appearance.IsRound             = true;
            appointment.Appearance.Transparency        = Transparency;
            appointment.Appearance.BackColor           = Color.LightCyan;
            appointment.Header.Icon                    = schedule1.DefaultIcons.IconInfo;
            appointment.Header.Appearance.Transparency = appointment.Appearance.Transparency;

            appointment         = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/2/2004"), DateTime.Parse("12:30:00 PM"), 60);
            appointment.Subject = "Appointment 4";
            appointment.Appearance.Transparency        = Transparency;
            appointment.Appearance.BackColor           = Color.LightGoldenrodYellow;
            appointment.Header.HeaderType              = AppointmentHeader.HeaderTypeConstants.None;
            appointment.Header.Appearance.Transparency = appointment.Appearance.Transparency;

            appointment         = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/3/2004"), DateTime.Parse("10:00:00 AM"), 60);
            appointment.Subject = "Appointment 5";
            appointment.Appearance.Transparency        = Transparency;
            appointment.Appearance.IsRound             = true;
            appointment.Appearance.BackColor           = Color.LightGray;
            appointment.Header.HeaderType              = AppointmentHeader.HeaderTypeConstants.DateHeader;
            appointment.Header.Appearance.Transparency = appointment.Appearance.Transparency;

            appointment         = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/3/2004"), DateTime.Parse("1:30:00 PM"), 60);
            appointment.Subject = "Appointment 6";
            appointment.Appearance.Transparency        = Transparency;
            appointment.Appearance.BackColor           = Color.LightGreen;
            appointment.Header.HeaderType              = AppointmentHeader.HeaderTypeConstants.Text;
            appointment.Header.Text                    = "Custom";
            appointment.Header.Appearance.Transparency = appointment.Appearance.Transparency;

            appointment         = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/4/2004"), DateTime.Parse("8:30:00 AM"), 90);
            appointment.Subject = "Appointment 7";
            appointment.Appearance.Transparency        = Transparency;
            appointment.Appearance.BackColor           = Color.LightPink;
            appointment.Header.Appearance.Transparency = 0;

            appointment                                = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/5/2004"), DateTime.Parse("11:30:00 AM"), 90);
            appointment.Subject                        = "Appointment 8";
            appointment.Appearance.IsRound             = true;
            appointment.Appearance.Transparency        = Transparency;
            appointment.Appearance.BackColor           = Color.LightSeaGreen;
            appointment.Header.Appearance.Transparency = 0;
            appointment.Header.HeaderType              = AppointmentHeader.HeaderTypeConstants.None;

            schedule1.Refresh();
        }
示例#17
0
        private void RefreshRange(DateTime selectedDate)
        {
            try
            {
                DateTime startDate = DateTime.Now;
                DateTime endDate   = DateTime.Now;

                if (isRefreshing)
                {
                    return;
                }

                isRefreshing         = true;
                schedule1.AutoRedraw = false;

                //Uncheck all menu items
                mnuViewDay.Checked      = false;
                mnuViewWorkWeek.Checked = false;
                mnuViewWeek.Checked     = false;
                mnuViewMonth.Checked    = false;

                //Setup the display mode
                if (this.DisplayMode == DisplayModeConstants.Day)
                {
                    schedule1.Appearance.ForeColor = System.Drawing.Color.DarkGray;
                    mnuViewDay.Checked             = true;
                    schedule1.HeaderDateFormat     = "dddd, MMMM dd";
                    startDate                = selectedDate;
                    endDate                  = selectedDate;
                    schedule1.ViewMode       = Gravitybox.Controls.Schedule.ViewModeConstants.DayTopTimeLeft;
                    schedule1.RowHeader.Size = 25;
                }
                else if (this.DisplayMode == DisplayModeConstants.WorkWeek)
                {
                    schedule1.Appearance.ForeColor = System.Drawing.Color.DarkGray;
                    mnuViewWorkWeek.Checked        = true;
                    schedule1.HeaderDateFormat     = "ddd, MMM dd";
                    startDate = selectedDate.AddDays(-int.Parse(selectedDate.DayOfWeek.ToString("d")) + 1);
                    endDate   = startDate.AddDays(4);
                    //startDate = DateAdd(DateInterval.Day, -int.Parse(selectedDate.DayOfWeek.ToString("d")) + 1, selectedDate);
                    //endDate = DateAdd(DateInterval.Day, 4, startDate);
                    schedule1.ViewMode       = Gravitybox.Controls.Schedule.ViewModeConstants.DayTopTimeLeft;
                    schedule1.RowHeader.Size = 25;
                }
                else if (this.DisplayMode == DisplayModeConstants.Week)
                {
                    schedule1.Appearance.ForeColor = System.Drawing.Color.DarkGray;
                    mnuViewWeek.Checked            = true;
                    schedule1.HeaderDateFormat     = "ddd, MMM dd";
                    startDate = selectedDate.AddDays(-int.Parse(selectedDate.DayOfWeek.ToString("d")));
                    endDate   = startDate.AddDays(6);
                    //startDate = DateAdd(DateInterval.Day, -int.Parse(selectedDate.DayOfWeek.ToString("d")), selectedDate);
                    //endDate = DateAdd(DateInterval.Day, 6, startDate);
                    schedule1.ViewMode       = Gravitybox.Controls.Schedule.ViewModeConstants.DayTopTimeLeft;
                    schedule1.RowHeader.Size = 25;
                }
                else if (this.DisplayMode == DisplayModeConstants.Month)
                {
                    schedule1.Appearance.ForeColor = System.Drawing.Color.Black;
                    mnuViewMonth.Checked           = true;
                    startDate = selectedDate.AddDays(-selectedDate.Day + 1);
                    //startDate = DateAdd(DateInterval.Day, -selectedDate.Day + 1, selectedDate);
                    endDate = startDate.AddMonths(1).AddDays(-1);
                    //endDate = DateAdd(DateInterval.Month, 1, startDate);
                    //endDate = DateAdd(DateInterval.Day, -1, endDate);
                    schedule1.ViewMode = Gravitybox.Controls.Schedule.ViewModeConstants.Month;
                }

                if (this.DisplayMode == DisplayModeConstants.Month)
                {
                    this.MonthCalendar1.SetSelectionRange(selectedDate, selectedDate);
                    this.MonthCalendar1.SelectionRange.Start = selectedDate;
                    this.MonthCalendar1.SelectionRange.End   = selectedDate;
                    schedule1.SetMinMaxDate(startDate, endDate);
                }
                else
                {
                    this.MonthCalendar1.SetSelectionRange(startDate, endDate);
                    this.MonthCalendar1.SelectionRange.Start = startDate;
                    this.MonthCalendar1.SelectionRange.End   = endDate;
                    schedule1.SetMinMaxDate(MonthCalendar1.SelectionStart, MonthCalendar1.SelectionEnd);
                }

                schedule1.AutoRedraw = true;
                isRefreshing         = false;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#18
0
        private void MainForm_Load(object sender, System.EventArgs e)
        {
            //Setup Schedule
            schedule1.SetMinMaxDate(DateTime.Parse("1/1/2004"), DateTime.Parse("1/5/2004"));
            schedule1.StartTime              = DateTime.Parse("8:00:00 AM");
            schedule1.DayLength              = 10;
            schedule1.ConflictDisplay        = Gravitybox.Controls.Schedule.ConflictDisplayConstants.SideBySide;
            schedule1.ViewMode               = Gravitybox.Controls.Schedule.ViewModeConstants.DayRoomTopTimeLeft;
            schedule1.AppointmentBar.BarType = Gravitybox.Controls.Schedule.AppointmentBarConstants.None;
            schedule1.AllowSelector          = false;

            //Add NoDropAreas
            schedule1.NoDropAreaCollection.Add("", Color.Red, DateTime.Parse("12:00:00 PM"), 90);             //Lunch hour

            //Load Data
            Appointment appointment = null;
            Provider    provider    = null;
            Room        room        = null;
            Category    category    = null;

            //Load Providers
            provider = schedule1.ProviderCollection.Add("", "Sam", Color.LightGoldenrodYellow);
            provider = schedule1.ProviderCollection.Add("", "Julie", Color.LightGray);
            provider = schedule1.ProviderCollection.Add("", "Joe", Color.LightGreen);

            //Load Categories
            category = schedule1.CategoryCollection.Add("", "Major", Color.LightBlue);
            category = schedule1.CategoryCollection.Add("", "Cleaning", Color.LightCoral);
            category = schedule1.CategoryCollection.Add("", "Misc", Color.LightCyan);

            //Load Rooms
            room = schedule1.RoomCollection.Add("", "Exam I");
            room = schedule1.RoomCollection.Add("", "Exam II");

            //Load Appointments
            appointment         = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/1/2004"), schedule1.RoomCollection[0], DateTime.Parse("8:00:00 AM"), 60);
            appointment.Subject = "Sue Collins";
            appointment.CategoryList.Add(schedule1.CategoryCollection[0]);
            appointment.ProviderList.Add(schedule1.ProviderCollection[1]);

            appointment         = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/1/2004"), schedule1.RoomCollection[0], DateTime.Parse("9:30:00 AM"), 60);
            appointment.Subject = "Joe Jones";
            appointment.CategoryList.Add(schedule1.CategoryCollection[0]);
            appointment.ProviderList.Add(schedule1.ProviderCollection[2]);

            appointment         = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/1/2004"), schedule1.RoomCollection[0], DateTime.Parse("10:30:00 AM"), 60);
            appointment.Subject = "Bill Sellers";
            appointment.CategoryList.Add(schedule1.CategoryCollection[1]);
            appointment.ProviderList.Add(schedule1.ProviderCollection[1]);

            appointment         = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/1/2004"), schedule1.RoomCollection[1], DateTime.Parse("8:30:00 AM"), 60);
            appointment.Subject = "Jack Jones";
            appointment.CategoryList.Add(schedule1.CategoryCollection[1]);
            appointment.ProviderList.Add(schedule1.ProviderCollection[0]);

            appointment         = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/1/2004"), schedule1.RoomCollection[1], DateTime.Parse("9:30:00 AM"), 60);
            appointment.Subject = "Mike Martin";
            appointment.CategoryList.Add(schedule1.CategoryCollection[0]);
            appointment.ProviderList.Add(schedule1.ProviderCollection[1]);

            appointment         = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/1/2004"), schedule1.RoomCollection[1], DateTime.Parse("10:30:00 AM"), 90);
            appointment.Subject = "Ian Davis";
            appointment.CategoryList.Add(schedule1.CategoryCollection[2]);
            appointment.ProviderList.Add(schedule1.ProviderCollection[0]);

            appointment         = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/2/2004"), schedule1.RoomCollection[0], DateTime.Parse("9:00:00 AM"), 90);
            appointment.Subject = "Rusty Grey";
            appointment.CategoryList.Add(schedule1.CategoryCollection[1]);
            appointment.ProviderList.Add(schedule1.ProviderCollection[1]);

            appointment         = schedule1.AppointmentCollection.Add("", DateTime.Parse("1/2/2004"), schedule1.RoomCollection[0], DateTime.Parse("10:00:00 AM"), 90);
            appointment.Subject = "John Smith";
            appointment.CategoryList.Add(schedule1.CategoryCollection[2]);
            appointment.ProviderList.Add(schedule1.ProviderCollection[0]);

            //Format all appointments
            foreach (Appointment element in schedule1.AppointmentCollection)
            {
                element.Appearance.IsRound      = true;
                element.Appearance.Transparency = 30;
                element.Appearance.BackColor    = Color.LightBlue;
            }

            schedule1.Refresh();
        }