Hi,
I have a client server solution. Several clients connect to a single database hosting the scheduler data. When a client changes the data in the database table (adding, removing, changing an appointment) the SQL message broker kicks in and all other clients execute a function to update their scheduler. So far this works like a charm:
The problem is in the commented code: After the databind is executed, the scheduler view is reset to 00:00 hour. I basically attempt to update the binding without updating the display, so when another workstation adds a appointment on a timeslot in view it just appears in the scheduler the user is looking at or (when in a timeslot out of view) would appear when scrolling. As an added bonus the scheduler contains several resources.
So how can I "detect" the start or end of the top _visible_ timeslot and then use "dv.DataAreaElement.Table.ScrollToTime(TimeSpan.FromHours(firstCell.Hour))" to Update the view after databind?
Or should I approach this differently?
regards,
Raoul
I have a client server solution. Several clients connect to a single database hosting the scheduler data. When a client changes the data in the database table (adding, removing, changing an appointment) the SQL message broker kicks in and all other clients execute a function to update their scheduler. So far this works like a charm:
''' <
summary
>
''' Sql Server notifies the scheduler table data is changed!
''' The current scheduler data needs to rebind to reflect the changes...
''' </
summary
>
''' <
param
name
=
"sender"
></
param
>
''' <
param
name
=
"e"
></
param
>
''' <
remarks
></
remarks
>
Private Sub AgendaWijziging(sender As Object, e As System.Data.SqlClient.SqlNotificationEventArgs)
If Me.InvokeRequired Then
RadScheduler1.BeginInvoke(New MethodInvoker(AddressOf radScheduler1_rebind))
Else
radScheduler1_rebind()
End If
End Sub
''' <
summary
>
''' Rebind the scheduler after a database change by another client
''' </
summary
>
''' <
remarks
></
remarks
>
Private Sub radScheduler1_rebind()
Try
Me.Cursor = Cursors.WaitCursor
' attempt to find current first time slot in view (user scrolled to this time slot)
'Dim dayView As SchedulerDayViewGroupedByResourceElement = TryCast(Me.RadScheduler1.SchedulerElement.ViewElement, SchedulerDayViewGroupedByResourceElement)
'Dim singleDayView As SchedulerDayViewElement = Nothing
'Dim resetToTime As DateTime? = Nothing
'Dim firstCell As SchedulerCellElement
'If dayView IsNot Nothing Then
' singleDayView = dayView.GetDayViewElements.FirstOrDefault
' If singleDayView IsNot Nothing Then
' firstCell = singleDayView.DataAreaElement.Table.Children.First
' If firstCell IsNot Nothing Then
' resetToTime = CType(cell, SchedulerCellElement).Date (date only... no time?)
' End If
' End If
'End If
RadScheduler1.DataBind()
' go back to the timeslot the user scrolled to.. (does not work :( resetToTime contains date only )
'If singleDayView IsNot Nothing AndAlso resetToTime IsNot Nothing Then
' singleDayView.DataAreaElement.Table.ScrollToTime(New TimeSpan(resetToTime.Value.Hour, resetToTime.Value.Minute, resetToTime.Value.Second))
'End If
' re-initialize the sql broker notification
_context.MonitorAgenda()
Catch ex As Exception
Dim currentMethode As MethodBase = MethodBase.GetCurrentMethod
FormHelper.LogError(ex, currentMethode.DeclaringType.ToString, currentMethode.ToString)
Finally
Me.Cursor = Cursors.Arrow
End Try
End Sub
The problem is in the commented code: After the databind is executed, the scheduler view is reset to 00:00 hour. I basically attempt to update the binding without updating the display, so when another workstation adds a appointment on a timeslot in view it just appears in the scheduler the user is looking at or (when in a timeslot out of view) would appear when scrolling. As an added bonus the scheduler contains several resources.
So how can I "detect" the start or end of the top _visible_ timeslot and then use "dv.DataAreaElement.Table.ScrollToTime(TimeSpan.FromHours(firstCell.Hour))" to Update the view after databind?
Or should I approach this differently?
regards,
Raoul