Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic WeekRange view issue (Read 4042 times)
BudMan
YaBB Newbies
*
Offline


Credidi me felem vidisse

Posts: 45
Joined: Jul 14th, 2007
WeekRange view issue
Mar 4th, 2008 at 1:08pm
Print Post  
My calendar works wonderfully when the CalendarView is set to TimeTable or SingleMonth. But when I try to switch to WeekRange, an unhandled exception of System.ArgumentOutOfRangeException gets raised and the calendar control gets painted with a big red "X". The exception Message is "The added or subtracted value results in un-representable DateTime. Parameter name: t"

Any idea what is happening here?  Could it have anything to do with the NumberOfDays setting which is -571?

The Calendar.dll version is 4.3.0.24470, and I am running it on version 3.5 of the .NET Framework.

Following are the complete WeekRangeSettings:
    DayDistance: 0
    DayNamesHeaderHeight: 24
    DayOfWeekFormat: SingleLetter {0}
    DaySettings: {MindFusion.Scheduling.WinForms.CellSettings}
    EvenMonthsBrush: {MindFusion.Drawing.SolidBrush}
    GroupWeekends: Enabled {1}
    GroupWeekendsTitleSeparator: "/"
    HeaderShadowColor: "{Name=64000000, ARGB=(100, 0, 0, 0)}"
    HeaderShadowOffset: 3
    HeaderShadowStyle: None {0}
    HeaderStyle: None {0}
    Margin: 1
    NumberOfDays: -571
    OddMonthsBrush: Nothing
    ReferenceHeaderHeight: 0
    ShowDayOfWeek: Enabled {1}
    Style: {MindFusion.Scheduling.Style}
    TimePeriodHeaderHeight: 0
    TitleFormat: "dd MMM"
    TitleSeparator: " - "
    ViewStyle: WeekPerRow {0}
    VisibleColumns: 1
    VisibleRows: 2

The first lines of the exception Stack Trace follow:
System.ArgumentOutOfRangeException was unhandled
  Message="The added or subtracted value results in an un-representable DateTime.\r\nParameter name: t"
  Source="mscorlib"
  ParamName="t"
  StackTrace:
      at System.DateTime.op_Subtraction(DateTime d, TimeSpan t)
      at MindFusion.Scheduling.Schedule.x539ca5fc41591efe(DateTime x477389e11fa53d12, DateTime xdcf2dd20ebc67806, IComparer xccf897dbab20ed8c)
      at MindFusion.Scheduling.WinForms.CalendarCell.HitTest(Point point, HitTestInfo info)
      at MindFusion.Scheduling.WinForms.Cell.HitTest(Point point, HitTestInfo info)
      at MindFusion.Scheduling.WinForms.MultiCalendarCell.HitTest(Point point, HitTestInfo info)
      at MindFusion.Scheduling.WinForms.Calendar.OnMouseMove(MouseEventArgs e)
      at System.Windows.Forms.Control.WmMouseMove(Message& m)
      at System.Windows.Forms.Control.WndProc(Message& m)

The critical TargetSite values are:
{System.Reflection.RuntimeMethodInfo}
    System.Reflection.RuntimeMethodInfo: {System.Reflection.RuntimeMethodInfo}
    Attributes: 2198
    CallingConvention: Standard {1}
    ContainsGenericParameters: False
    DeclaringType: {Name = "DateTime" FullName = "System.DateTime"}
  
Back to top
 
IP Logged
 
BudMan
YaBB Newbies
*
Offline


Credidi me felem vidisse

Posts: 45
Joined: Jul 14th, 2007
Problem solved!
Reply #1 - Mar 4th, 2008 at 2:36pm
Print Post  
I figured out what was raising the Exception—and also what was causing the WeekRange view to come up 'empty' before. It was the EndDate setting of the Calender control. I had wiped that out in the Properties window, effectively making the EndDate Jan 1, 0001. When I changed it to a 'reasonable' date like 12/31/2008, the WeekRange view worked fine.

I see the EndDate setting is critical for optimum performance. When I changed it to a ridiculous future date of 12/31/9998 (which I thnk is the maximum value allowed), the calendar took forever to display—even though the Schedule.Items.Count was only 2.
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: WeekRange view issue
Reply #2 - Mar 5th, 2008 at 6:41am
Print Post  
Indeed, setting the EndDate to the maximum possible date results in three million day cells that need to be created and set up before the view can be displayed. This is something we can try optimizing in the future.

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