Showing posts with label Janus Schedule. Show all posts
Showing posts with label Janus Schedule. Show all posts
-
Changing the background color of the rows in the Schedule [Janus GridEX WinForms Control v3.5 for .NET]
This tutorial is intended to show how to change the background color of the rows in the Schedule control using the WorkingHourSchema object
The following code shows how to format the rows based on the day of the week
In VB:
'Create a new ScheduleHourRange object to specify the format style settings and the
'time and days when the format style will be applied
Dim hourRange As New ScheduleHourRange()
'Specify the start and end time that you want to format
hourRange.EndTime = New TimeSpan(10, 0, 0)
hourRange.StartTime = New TimeSpan(8, 0, 0)
'Specify the days of the week that you want to format
hourRange.DayOfWeek = ScheduleDayOfWeek.Monday Or ScheduleDayOfWeek.Tuesday Or _
ScheduleDayOfWeek.Wednesday Or ScheduleDayOfWeek.Thursday Or ScheduleDayOfWeek.Friday
'Set the format style that you want to apply
hourRange.FormatStyle.BackColor = Color.Red
'Add the ScheduleHourRange to the WorkingHoursRange collection of the WorkingHourSchema
Me.Schedule1.WorkingHourSchema.WorkingHoursRange.Add(hourRange)
In C#
//Create a new ScheduleHourRange object to specify the format style settings and the
//time and days when the format style will be applied
ScheduleHourRange hourRange = new ScheduleHourRange();
//Specify the start and end time that you want to format
hourRange.EndTime = new TimeSpan(10, 0, 0);
hourRange.StartTime = new TimeSpan(8, 0, 0);
//Specify the days of the week that you want to format
hourRange.DayOfWeek = ScheduleDayOfWeek.Monday | ScheduleDayOfWeek.Thursday | ScheduleDayOfWeek.Wednesday | ScheduleDayOfWeek.Thursday | ScheduleDayOfWeek.Friday;
//Set the format style that you want to apply
hourRange.FormatStyle.BackColor = Color.Red;
//Add the ScheduleHourRange to the WorkingHoursRange collection of the WorkingHourSchema
this.Schedule1.WorkingHourSchema.WorkingHoursRange.Add(hourRange);
The following code shows how to use the Exceptions collection to format the rows for a specific Date
In VB:
'Create a new WorkingHourException
Dim exception As New WorkingHourException()
'Specify the date range where you want to give the format
'Note: The date range must be of at least one day, and use the StartTime and EndTime 'properties of the HourRange to set the time of the day where the format will be applied
exception.DateRange = New DateRange(New DateTime(2006, 1, 15), New DateTime(2006, 1, 16))
'Specify the start and end time that you want to format exception.HourRange.EndTime = New TimeSpan(14, 0, 0)
exception.HourRange.StartTime = New TimeSpan(10, 0, 0)
'Set the format style that you want to apply
exception.HourRange.FormatStyle.BackColor = Color.Red
'Add the WorkingHourException to the Exceptions collection of the WorkingHourSchema
Me.Schedule1.WorkingHourSchema.Exceptions.Add(exception)
In C#
//Create a new WorkingHourException
WorkingHourException exception = new WorkingHourException();
//Specify the date range where you want to give the format
//Note: The date range must be of at least one day, and use the StartTime and EndTime //properties of the HourRange to set the time of the day where the format will be applied
exception.DateRange = new DateRange(new DateTime(2006, 1, 16), new DateTime(2006, 1, 17));
//Specify the start and end time that you want to format
exception.HourRange.EndTime = new TimeSpan(14, 0, 0);
exception.HourRange.StartTime = new TimeSpan(10, 0, 0);
//Set the format style that you want to apply
exception.HourRange.FormatStyle.BackColor = Color.Green;
//Add the WorkingHourException to the Exceptions collection of the WorkingHourSchema
this.Schedule1.WorkingHourSchema.Exceptions.Add(exception);
The following code shows how to use the RecurrencePattern property of the ScheduleHourRange object to apply the format style for the rows based on a recurrence pattern
In VB:
Dim recurrencePattern As New WorkingHourRecurrencePattern()
'Call the BeginEdit before changing the properties of the RecurrencePattern
recurrencePattern.BeginEdit()
'Specify the recurrence pattern. In this case the 10th of every month is the date that 'will be formatted
recurrencePattern.SetDefaultValuesForDate(DateTime.Today)
recurrencePattern.PatternStartDate = DateTime.Today
recurrencePattern.RecurrenceEndMode = RecurrenceEndMode.NoEndDate
recurrencePattern.RecurrenceType = RecurrenceType.Monthly
recurrencePattern.StartTime = New TimeSpan(8, 0, 0)
recurrencePattern.EndTime = New TimeSpan(10, 0, 0)
recurrencePattern.DayOfMonth = 10
recurrencePattern.EndEdit()
'Create the new ScheduleHourRange that will be added to the WorkingHourSchema
Dim hourRange As New ScheduleHourRange()
'Set the RecurrencePattern that will be used
hourRange.RecurrencePattern = recurrencePattern
'Set the format style that you want to apply
hourRange.FormatStyle.BackColor = Color.Red
'Add the ScheduleHourRange to the WorkingHourSchema of the Schedule
Me.Schedule1.WorkingHourSchema.WorkingHoursRange.Add(hourRange)
In C#
WorkingHourRecurrencePattern recurrencePattern = new WorkingHourRecurrencePattern();
//Call the BeginEdit before changing the properties of the RecurrencePattern
recurrencePattern.BeginEdit();
//Specify the recurrence pattern. In this case the 10th of every month is the date that //will be formatted
recurrencePattern.SetDefaultValuesForDate(DateTime.Today);
recurrencePattern.PatternStartDate = DateTime.Today;
recurrencePattern.RecurrenceEndMode = RecurrenceEndMode.NoEndDate;
recurrencePattern.RecurrenceType = RecurrenceType.Monthly;
recurrencePattern.StartTime = new TimeSpan(8, 0, 0);
recurrencePattern.EndTime = new TimeSpan(10, 0, 0);
recurrencePattern.DayOfMonth = 10;
recurrencePattern.EndEdit();
//Create the new ScheduleHourRange that will be added to the WorkingHourSchema
ScheduleHourRange hourRange = new ScheduleHourRange();
//Set the RecurrencePattern that will be used
hourRange.RecurrencePattern = recurrencePattern;
//Set the format style that you want to apply
hourRange.FormatStyle.BackColor = Color.Red;
//Add the ScheduleHourRange to the WorkingHourSchema of the Schedule
this.Schedule1.WorkingHourSchema.WorkingHoursRange.Add(hourRange);
If you want to modify only the rows of a particular owner then use the WorkingHourSchema property of the ScheduleAppointment owner to add the ScheduleHourRange
In VB:
Dim owner As ScheduleAppointmentOwner = Me.Schedule1.Owners(0)
owner.WorkingHourSchema.WorkingHoursRange.Add(hourRange)
In C#
ScheduleAppointmentOwner owner = this.Schedule1.Owners[0];
owner.WorkingHourSchema.WorkingHoursRange.Add(hourRange);
Source Of Information : Janus v3.5 Help Files for VS 2008
more
-
Using a layout file to preserve user changes [Janus GridEX WinForms Control v3.5 for .NET]
This tutorial is intended to show you how to use a layout file to preserve Schedule control settings. Using a layout file you could be able to preserve even the changes to the layout made by the user.
Follow these steps to use a layout file at run time:
1) Define the layout at design time and then save it clicking in the "Save Layout File" button that is found in the "Layout Manager" tab of the Schedule control designer.
2) In the Load event of the form, load the layout from a file using the LoadLayoutFile method of the Schedule.
In VB:
Private Sub LoadLayout()
Dim layoutDir As String = "C:\ScheduleLayout.xml"
Dim layoutStream As FileStream = New FileStream(layoutDir, FileMode.Open)
Schedule1.LoadLayoutFile(layoutStream)
layoutStream.Close()
End Sub
In C#:
private void LoadLayout()
{
string layoutDir = @"C:\ScheduleLayout.xml";
FileStream layoutStream;
FileInfo fInfo = new FileInfo(layoutDir);
if (fInfo.Exists)
{
layoutStream = new FileStream(layoutDir, FileMode.Open);
schedule1.LoadLayoutFile(layoutStream);
layoutStream.Close();
}
}
3) (Optional) To preserve user changes to the layout, update the layout before it is changed in the CurrentLayoutChanging event of the Schedule.
In VB:
Private Sub Schedule1_CurrentLayoutChanging(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Schedule1.CurrentLayoutChanging
'To persist user changes in the current layout,
'call the Update method explicitly before changing the layout
If Not Schedule1.CurrentLayout Is Nothing Then
Schedule1.CurrentLayout.Update()
End If
End Sub
In C#:
private void schedule1_CurrentLayoutChanging(object sender, System.ComponentModel.CancelEventArgs e)
{
//To persist user changes in the current layout,
//call the Update method explicitly before changing the layout
if (schedule1.CurrentLayout != null)
{
schedule1.CurrentLayout.Update();
}
}
4) In the Closing event of the form, save the layout file again to be able to preserve the changes the user did (like view, format settings, dates, etc).
In VB:
Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
Dim Result As DialogResult
Dim LayoutDir As String
Dim LayoutStream As FileStream
Result = MessageBox.Show("Do you want to preserve the changes in the Schedule control layout?", "Preserve changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
If Result = Windows.Forms.DialogResult.Cancel Then
e.Cancel = True
ElseIf Result = Windows.Forms.DialogResult.Yes Then
LayoutDir = "C:\ScheduleLayout.xml"
LayoutStream = New FileStream(LayoutDir, FileMode.Open)
Schedule1.SaveLayoutFile(LayoutStream)
LayoutStream.Close()
End If
End Sub
In C#:
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
DialogResult result;
string layoutDir;
FileStream layoutStream;
result = MessageBox.Show("Do you want to preserve the changes in the Schedule control layout?", "Preserve changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (result == DialogResult.Cancel)
{
e.Cancel = true;
}
else if (result == DialogResult.Yes)
{
layoutDir = + @"C:\ScheduleLayout.xml";
layoutStream = new FileStream(layoutDir, FileMode.Open);
schedule1.SaveLayoutFile(layoutStream);
layoutStream.Close();
}
}
5) Run the project.
Source Of Information : Janus v3.5 Help Files for VS 2008
more
-
Using multiple layouts [Janus GridEX WinForms Control v3.5 for .NET]
This tutorial is intended to show you how to use multiple layouts in a Schedule control.
Follow these steps to create multiple layouts at design time:
1) Create a new Visual Basic or C# project using "Windows Application" Template
2) Add a Schedule control to Form1.
3) In the Designer window of the Schedule control, modify the layout as you want, changing the view, dates, owner, etc.
4) Select the "Layout Manager" Tab. A List View will appear with a "Draft Layout" in it. The Draft Layout contains the changes you just made to the Schedule but it is not saved as a layout in the Layouts collection.
5) Click on "Save Current Layout" button and set the name "MonthView" to the draft layout.
6) Once the "MonthView" layout has been saved, add a new layout for products. To add a new layout click on the "New Layout" button and Layout1 will appear.
7) Change the name of Layout1 for "WeekView".
8) Double click in the "WeekView" layout to select this empty layout. This action will set the "WeekView" layout you just created as the CurrentLayout in the Schedule control and all the changes you do will affect this layout only.
9) Change any properties in the new layout like view or owners.
10) Select "Layout Manager" Tab again.
11) Click in the "New Layout" button and Layout1 will appear.
12) Change the name of Layout1 for "WorkWeek".
13) Double click in the "WorkWeek" layout to select this empty layout. This action will set the "WorkWeek" layout you just created as the CurrentLayout in the Schedule control and all the changes you do will affect this layout only.
14) Change any properties in the new layout like view or owners.
15) You have finished adding layouts for the tutorial. To change a property in any of the layouts you have in the Layouts collection, select the layout from Layouts combo in the tool bar of the Schedule designer.
16) To select a layout at run time use the CurrentLayout property of the Schedule class. In the tutorial we are going to do that using buttons. So, add a button "Button1" and
change its Text property to "Show MonthView". In the Click event for this button write the following code that set the "MonthView" layout as the current layout in the Schedule control:
In VB:
If Schedule1.CurrentLayout Is Nothing OrElse Schedule1.CurrentLayout.Key <> "MonthView" Then
Schedule1.CurrentLayout = Schedule1.Layouts("MonthView")
End If
In C#
if (schedule1.CurrentLayout==null || schedule1.CurrentLayout.Key!="MonthView")
{
schedule1.CurrentLayout = schedule1.Layouts["MonthView"];
}
17) Add a buttons to show "WeekView" and "WorkWeek" layouts with similar code in the Click event for those buttons.
18) Run the project.
Source Of Information : Janus v3.5 Help Files for VS 2008
more
-
Saving and Loading Appointments from a stream [Janus GridEX WinForms Control v3.5 for .NET]
This tutorial is intended to show you how to save and load the Appointments, Fields and Owners collections from a stream.
The steps followed to create this project were:
1) Create a new Visual Basic or C# project using "Windows Application" Template
2) Add a Schedule control to Form1.
3) Add a Calendar control and bind it to the Schedule control.
4) Add a button and change its Text property to "Save"
5) In the Click event of the save button use the SaveAppointments method to save the appointments to a file.
In C#
this.Cursor = Cursors.WaitCursor;
string appointmentsDir = @"C:\Appointments.xml";
System.IO.FileStream appointmentsStream;
appointmentsStream = new System.IO.FileStream(appointmentsDir, System.IO.FileMode.Create);
schedule1.SaveAppointments(appointmentsStream);
appointmentsStream.Close();
this.Cursor = Cursors.Default;
In VB
Me.Cursor = Cursors.WaitCursor
Dim appointmentsDir As String = "C:\Appointments.xml"
Dim appointmentsStream As System.IO.FileStream
appointmentsStream = New System.IO.FileStream(appointmentsDir, System.IO.FileMode.Create)
Schedule1.SaveAppointments(appointmentsStream)
appointmentsStream.Close()
Me.Cursor = Cursors.Default
6) Add a button and change its Text property to "Load"
7) In the Click event of the load button, use the LoadAppointments method of the Schedule to load the appointment from a file
In VB
Me.Cursor = Cursors.WaitCursor
Dim AppointmentsDir As String = "C:\Appointments.xml"
Dim AppointmentsStream As System.IO.FileStream
AppointmentsStream = New System.IO.FileStream(AppointmentsDir, System.IO.FileMode.Open)
Schedule1.LoadAppointments(AppointmentsStream)
AppointmentsStream.Close()
Me.Cursor = Cursors.Default
In C#
this.Cursor = Cursors.WaitCursor;
string appointmentsDir = @"C:\Appointments.xml";
System.IO.FileStream appointmentsStream;
appointmentsStream = new System.IO.FileStream(appointmentsDir, System.IO.FileMode.Open);
schedule1.LoadAppointments(appointmentsStream);
appointmentsStream.Close();
this.Cursor = Cursors.Default;
8) Run the project.
Source Of Information : Janus v3.5 Help Files for VS 2008
more
-
Working with Multiple Appointment Owners in a Schedule control [Janus GridEX WinForms Control v3.5 for .NET]
This tutorial is intended to show how to handle appointments for more than one person.
1) Create a new "Windows Application" Project.
2) Drag a Schedule control from the toolbox into the Form designer.
3) Select the Schedule control in the Form and set the MultiOwner property to true in the properties window.
4) Right click in the Schedule control and select "Schedule Designer" menu. In the Schedule Designer dialog select Owners node.
5) In the Owners panel, Click Add button to add a new owner. Select the new owner and set the following properties in the properties window.
Text = John Doe
Value = Doe
6) Add another owner with the following properties values.
Text = Peter Barker
Value = Barker
Note: In design time the Value property of the ScheduleAppointmentOwner can only be a string. Set the Value in code if you want a different type.
7) In code create two appointments and add them to the Schedule control.
In C#
DateTime startDate = this.schedule1.Date.AddHours(8);
ScheduleAppointment app1 = new ScheduleAppointment(startDate, startDate.AddMinutes(30), "Phone Call");
ScheduleAppointment app2 = new ScheduleAppointment(startDate, startDate.AddMinutes(30), "Go to the dentist");
//The Owner property of the Appointment must be equal to the Value property of //one of the AppointmentOwners in the Schedule control.
app1.Owner = "Doe";
app2.Owner = "Barker";
this .schedule1.Appointments.Add(app1);
this .schedule1.Appointments.Add(app2);
In VB
Dim startDate As DateTime = Me.Schedule1.Date.AddHours(8)
Dim app1 As ScheduleAppointment = New ScheduleAppointment(startDate, startDate.AddMinutes(30), "Phone Call")
Dim app2 As ScheduleAppointment = New ScheduleAppointment(startDate, startDate.AddMinutes(30), "Go to the dentist")
'The Owner property of the Appointment must be equal to the Value property of
'one of the AppointmentOwners in the Schedule control.
app1.Owner = "Doe"
app2.Owner = "Barker"
Me.Schedule1.Appointments.Add(app1)
Me.Schedule1.Appointments.Add(app2)
8) Press F5 and run the project.
Source Of Information : Janus v3.5 Help Files for VS 2008
more
-
Using SchedulePrintDocument to Print the Control [Janus GridEX WinForms Control v3.5 for .NET]
The SchedulePrintDocument component allows the developer to print the contents of a Schedule control. In this tutorial, we use a SchedulePrintDocument to provide the application with Print Preview capabilities.
The steps followed to create this project were:
1) Open Form1 in Design mode
2) Drag a Schedule control from the Toolbox into the Form designer
3) Drag a SchedulePrintDocument component from the Toolbox and drop it over Form1
4) Select SchedulePrintDocument1 component in the Components tray and set the Schedule property equal to schedule1
5) Drag a PrintPreviewDialog component from the Toolbox and drop it over Form1
6) Set the Document property of PrintPreviewDialog1 equal to SchedulePrintDocument1
7) Add a button and change its Text property to "Print Preview..."
8) In the Click event of the button, call The ShowDialog method of the PrintPreviewDialog1 component.
9) Run the project.
Source Of Information : Janus v3.5 Help Files for VS 2008
more
-
Schedule and Calendar controls working together [Janus GridEX WinForms Control v3.5 for .NET]
This tutorial is intended to show you how to use a Calendar control as the date navigator for a Schedule control bound to it.
Follow these steps to reproduce this sample:
1) Create a new Visual Basic or C# project using "Windows Application" Template
2) Add a Schedule Control to a tab in the Toolbox window by right clicking in the Toolbox window and choosing "Choose Items..." menu. When the dialog appears, select ".Net Framework Components" tab, check "Schedule" control in the list and click OK.
Note: If the Schedule control doesn't appear as an option in the list, click the Browse button and open Janus.Windows.Schedule.dll.
3) Drag a Schedule control from the toolbox into the Form designer.
4) Add a Calendar Control to a tab in the Toolbox window by right clicking in the Toolbox window and choosing "Choose Items..." menu. When the dialog appears, select ".Net Framework Components" tab, check "Calendar" control in the list and click OK.
Note: If the Calendar control doesn't appear as an option in the list, click the Browse button and open Janus.Windows.Schedule.v3.dll.
5) Drag a Calendar control from the toolbox into the Form designer.
6) Select the Calendar control and set the following properties in the properties window:
Schedule = schedule1
SelectionStyle = Schedule
7) Set the AllowDrop property of the Calendar control to true in order to allow the user to drop appointments from the Schedule to any date in the Calendar.
Source Of Information : Janus v3.5 Help Files for VS 2008
more
-
Binding the Schedule Control to a DataSource [Janus GridEX WinForms Control v3.5 for .NET]
This tutorial is intended to show you how to bind the Schedule control to a DataSource available at design time.
Follow these steps to create a simple form using a Schedule control to display records from a table in a database.
1) Create a new Visual Basic or C# project using "Windows Application" Template
2) Add a new Data Source to the application:
Click in the "Add New Data Source..." menu under "Data" and follow the wizard to add "Appointments" table from Schedule.mdb database.
In the tutorial we used Provider = "Microsoft Access Database File (OLE DB)" and Database file name = "C:\Schedule.mdb".
3) Build the project to be able to see ScheduleDataSet and AppointmentsTableAdapter as components in the Toolbox.
4) Drag from the tool box ScheduleDataSet and AppointmentsTableAdapter components to the designer.
Now that the DataSet has been created, we can start using the TimeLine control in the project.
5) Add a Schedule Control to a tab in the Toolbox window by right clicking in the Toolbox window and choosing "Choose Items..." menu. When the dialog appears check "Schedule" control in the list and click OK.
Note: If Schedule control doesn't appear as an option in the list, click the Browse button and open Janus.Windows.Schedule.dll.
6) Drag a Schedule control from the toolbox into the Form designer.
7) Select the Schedule control in the Form and set the following properties in the properties window:
DataSource = scheduleDataSet1
DataMember = Appointments
StartTimeMember = StartDate
EndTimeMember = EndDate
TextMember = Subject
8) (Optional) Right click on the Schedule control and select "Retrieve Fields" menu. This action will force the control to read the data source structure and create the fields for the items in the table.
9) In the Load event of the Form fill the Appointments table in the dataset with the following code:
In VB.Net
Me.AppointmentsTableAdapter1.Fill(Me.ScheduleDataSet1.Appointments)
In C#.Net
this.appointmentsTableAdapter1.Fill(this.scheduleDataSet1.Appointments)
10) Press F5 and run the project.
Source Of Information : Janus v3.5 Help Files for VS 2008
more
Subscribe to:
Posts (Atom)