-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml.vb
51 lines (45 loc) · 2.14 KB
/
MainWindow.xaml.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Imports DevExpress.Mvvm
Imports System
Imports System.Collections.Generic
Imports System.Windows
Imports System.Windows.Controls
Namespace CustomWorkTimeExample
''' <summary>
''' Interaction logic for MainWindow.xaml
''' </summary>
Public Partial Class MainWindow
Inherits Window
Public Sub New()
Me.InitializeComponent()
End Sub
#Region "#CustomWorkTime"
Private Sub SchedulerControl_CustomWorkTime(ByVal sender As Object, ByVal e As DevExpress.Xpf.Scheduling.CustomWorkTimeEventArgs)
If e.Resource.Id.Equals("1") Then
If e.Interval.Start.Day Mod 2 = 0 Then
Dim workTimes As List(Of TimeSpanRange) = New List(Of TimeSpanRange)()
workTimes.Add(New TimeSpanRange(TimeSpan.FromHours(0), TimeSpan.FromHours(3)))
workTimes.Add(New TimeSpanRange(TimeSpan.FromHours(5), TimeSpan.FromHours(8)))
workTimes.Add(New TimeSpanRange(TimeSpan.FromHours(10), TimeSpan.FromHours(11)))
e.WorkTimes = workTimes
Else
e.WorkTime = New TimeSpanRange(TimeSpan.FromHours(8), TimeSpan.FromHours(20))
End If
End If
If e.Resource.Id.Equals("2") Then
If e.Interval.Start.Day Mod 2 = 0 Then
e.WorkTime = New TimeSpanRange(TimeSpan.FromHours(14), TimeSpan.FromHours(18))
Else
e.WorkTime = New TimeSpanRange(TimeSpan.FromHours(8), TimeSpan.FromHours(12))
End If
End If
If e.Resource.Id.Equals("3") Then e.WorkTime = New TimeSpanRange(TimeSpan.FromHours(14), TimeSpan.FromHours(21))
If e.Resource.Id.Equals("4") Then
Dim workTimes As List(Of TimeSpanRange) = New List(Of TimeSpanRange)()
workTimes.Add(New TimeSpanRange(TimeSpan.FromHours(8), TimeSpan.FromHours(11)))
workTimes.Add(New TimeSpanRange(TimeSpan.FromHours(13), TimeSpan.FromHours(17)))
e.WorkTimes = workTimes
End If
End Sub
#End Region ' #CustomWorkTime
End Class
End Namespace