Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Exception on calendar load (Read 8434 times)
tavo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 15
Joined: Dec 3rd, 2011
Exception on calendar load
Dec 3rd, 2011 at 10:00am
Print Post  
I use the following xaml code on my simple application

Code
Select All
<Window x:Class="Form_Prenotazioni"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="700" Width="700" xmlns:planner="http://mindfusion.eu/scheduling/wpf">

    <planner:Calendar Name="calendar" CurrentView="Timetable" Theme="Silver">
	  <planner:Calendar.TimetableSettings>
		<planner:TimetableSettings ShowCurrentTime="True" />
	  </planner:Calendar.TimetableSettings>
    </planner:Calendar>

</Window>
 



the proble is that when I Show the window with the Calendare control appears the following Exception on Output window of VS2010

Code
Select All
 System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=HeaderTextRotation; DataItem=null; target element is 'RotateTransform' (HashCode=46809697); target property is 'Angle' (type 'Double')

 



and whe i try to create a new appointement this Exception

Code
Select All
System.Windows.Data Error: 40 : BindingExpression path error: 'DescriptionText' property not found on 'object' ''ItemPresenter' (Name='')'. BindingExpression:Path=DescriptionText; DataItem='ItemPresenter' (Name=''); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
 



thanks in advance
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Exception on calendar load
Reply #1 - Dec 5th, 2011 at 8:28am
Print Post  
These are just binding expression errors that should not have any impact on the application. In any case, I am not able to reproduce them here. Can you send me your application or another sample illustrating this problem to meppy@mindfusion.eu?

Regards,
Meppy
  
Back to top
 
IP Logged
 
tavo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 15
Joined: Dec 3rd, 2011
Re: Exception on calendar load
Reply #2 - Dec 5th, 2011 at 1:48pm
Print Post  
I divided the routine that create the appointement on the control Calendar.

To populate of appointements do not take long time, the exception an the time increase when the property 'Date' and 'EndDate' changed.

I show you the routine used to do this.
Code
Select All
                    'directory
                    Dim root As String = "..."

                    'get the information about directory
                    Dim dir As New System.IO.DirectoryInfo(root)

                    'get the files list
                    Dim fileList = dir.GetFiles("*.*", System.IO.SearchOption.TopDirectoryOnly)

                    'analized only files txt called with b...
                    Dim fileQuery = From file In fileList _
                                    Where file.Name Like "*.txt" And file.Name Like "b*"
                                    Order By file.Name
                                    Select file

                    'declaration of a form with calendar control
                    Dim Form_Prenotazioni As New Form_Prenotazioni

                    'Create new appointment
                    Dim app As Appointment = Nothing

                    'Create new resource
                    Dim resource As Resource = Nothing

                    'To split the string into txt file
                    'Dim ParamSeparator() As Char = {";"}

                    For Each file In fileQuery


                        'new resource
                        resource = New Resource
                        resource.Name = file.Name

                        'add resource
                        Form_Prenotazioni.calendar.ItemResources.Add(resource)

                        'read file
                        Dim r As New IO.StreamReader(file.FullName)

                        'analized all content
                        While Not r.EndOfStream

                            'divido ogni riga in stringhe separate da ";"   startdate; enddate; header
                            Dim Stringa() As String = r.ReadLine.Split(ParamSeparator)

                            'startdate
                            If Stringa.Length > 2 Then

                                'only this year
                                If Now.Year = CDate(Stringa(0)).Year Then

                                    'new appointement
                                    app = New Appointment

                                    'set the header
                                    app.HeaderText = Stringa(2)

                                    'set the date
                                    app.StartTime = New DateTime(CDate(Stringa(0)).Year, CDate(Stringa(0)).Month, CDate(Stringa(0)).Day)
                                    app.EndTime = New DateTime(CDate(Stringa(1)).Year, CDate(Stringa(1)).Month, CDate(Stringa(1)).Day)

                                    'add the item
                                    app.Resources.Add(Form_Prenotazioni.calendar.ItemResources(Form_Prenotazioni.calendar.ItemResources.Count - 1))


                                    app.AllDayEvent = True

                                    'aggiunge l'item alla risorsa
                                    Form_Prenotazioni.calendar.Schedule.Items.Add(app)

                                End If

                            End If

                        End While

                        'chiudo lo stream
                        r.Close()

                    Next

                    'visualizza la form
                    Form_Prenotazioni.Show()


 




this routine is fast the problem is on event Form_Prenotazioni.loaded

Code
Select All
 Private Sub EventoLoaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
            'Me.calendar.Date = "01/06/2011"
            'Me.calendar.EndDate = "30/06/2011"
 End sub
 

  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Exception on calendar load
Reply #3 - Dec 6th, 2011 at 8:22am
Print Post  
The performance can be affected by various factors, including the number if items in the displayed interval and the current view settings. For example, if you are using a resource view with high resolution (for example, hours) and display an interval of 30 days, this will affect the initial load speed. You can reduce the load time roughly in half by wrapping the two assignments in a BeginInit/EndInit block:

Code
Select All
Me.calendar.BeginInit()
Me.calendar.Date = "01/06/2011"
Me.calendar.EndDate = "30/06/2011"
Me.calendar.EndInit() 


Can you also provide me with your view settings and an estimation of the number of items in the displayed interval?

Regards,
Meppy
  
Back to top
 
IP Logged
 
tavo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 15
Joined: Dec 3rd, 2011
Re: Exception on calendar load
Reply #4 - Dec 6th, 2011 at 9:08am
Print Post  
to testing the application I create 300 app into 80 itemresource to load in Calendar.

The time to create them programmatically it's no longer

Code
Select All
 VC_ts1 = New TimeSpan(Now.Ticks)

...code to create app

 VC_ts2 = New TimeSpan(Now.Ticks)

(VC_ts2 - VC_ts1).ToString = 00:00:00.8950512
 





Code
Select All
 VC_ts1 = New TimeSpan(Now.Ticks)

             'code to set the data

            If Me.Calendar1.SelectedDates.Count > 0 Then

                Me.Calendar1.BeginInit()
                Me.calendar.Date = Me.Calendar1.SelectedDates(0).Date
                If Me.Calendar1.SelectedDates(Me.Calendar1.SelectedDates.Count - 1).Date >= Me.calendar.Date Then
                    Me.calendar.EndDate = Me.Calendar1.SelectedDates(Me.Calendar1.SelectedDates.Count - 1).Date
                Else
                    Me.calendar.EndDate = Me.calendar.Date.AddDays(7)
                End If

                Me.Calendar1.EndInit()

            End If

 VC_ts2 = New TimeSpan(Now.Ticks)

(VC_ts2 - VC_ts1).ToString = 00:00:48.5137749

 




xaml code is the same code I find on simple for vs2010 distribuited with the pack

Code
Select All
       <planner:Calendar Name="calendar" CurrentView="ResourceView" GroupType="GroupByResources" Date="6/1/2011" EndDate="6/30/2011" Margin="12,71,197,12">
            <planner:Calendar.ItemSettings>
                <planner:ItemSettings ResizeBandSize="0" MoveBandSize="0" UseExtendedStyles="False" HeaderSize="60" />
            </planner:Calendar.ItemSettings>
            <planner:Calendar.ResourceViewSettings>
                <planner:ResourceViewSettings EnableSnapping="True" SnapUnit="Day" LaneSize="60" ExpandableRows="False">
                    <planner:ResourceViewSettings.HeaderStyle>
                        <planner:CalendarStyle Background="LightGray" Foreground="Black" />
                    </planner:ResourceViewSettings.HeaderStyle>
                    <planner:ResourceViewSettings.BottomTimelineSettings>
                        <planner:TimelineSettings Format="ddd" Size="24" ShowCurrentTime="False">
                            <planner:TimelineSettings.CalendarStyle>
                                <planner:CalendarStyle Background="LightGray" Foreground="Black" FontFamily="Verdana" FontWeight="Normal" />
                            </planner:TimelineSettings.CalendarStyle>
                        </planner:TimelineSettings>
                    </planner:ResourceViewSettings.BottomTimelineSettings>
                    <planner:ResourceViewSettings.MiddleTimelineSettings>
                        <planner:TimelineSettings Unit="Week" UnitCount="1" Format="MMM dd" Size="24" ShowCurrentTime="False">
                            <planner:TimelineSettings.CalendarStyle>
                                <planner:CalendarStyle Background="LightGray" Foreground="Black" FontFamily="Verdana" FontWeight="Normal" />
                            </planner:TimelineSettings.CalendarStyle>
                        </planner:TimelineSettings>
                    </planner:ResourceViewSettings.MiddleTimelineSettings>
                </planner:ResourceViewSettings>
            </planner:Calendar.ResourceViewSettings>
        </planner:Calendar>

 



the strange is that the same operation in WindowsForm with the same condition is more fast than WPF

thanks for your help
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Exception on calendar load
Reply #5 - Dec 6th, 2011 at 1:31pm
Print Post  
Currently the resource view's load speed is proportional to the number of items, resources, the displayed time interval and the view resolution, because the view creates the visual presentation of all elements at the start. We are currently in the process of implementing virtualization in this view but I am not yet able to give you an estimate of when it will be publicly available. Stay tuned for updates regarding this issue in the near future.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint