public void DisplayedWeeksCaptionTest()
        {
            SchedulerViewModel scheduler = new SchedulerViewModel(null, new CultureInfo("en-US"), false, false);
            SchedulerMonthViewModel target = new SchedulerMonthViewModel(scheduler, null);
            DateTime date = new DateTime(2010, 1, 1);
            target.Initialize(new DateTime(2010, 2, 1));

            try
            {
                target.PropertyChanged += new PropertyChangedEventHandler(OnPropertyChanged);

                PreparePropertyChangedTest();
                target.SetView(date);
                Assert.AreEqual(5, target.DisplayedWeeks, "DisplayedWeeks must be set 5.");
                Assert.IsTrue(NotifiedProperties.Contains("DisplayedWeeks"), "PropertyChanged event wasn't raised on property 'DisplayedWeeks' changing to 5.");

                PreparePropertyChangedTest();
                target.SetView(date.AddDays(40));
                Assert.AreEqual(4, target.DisplayedWeeks, "DisplayedWeeks must be set 4.");
                Assert.IsTrue(NotifiedProperties.Contains("DisplayedWeeks"), "PropertyChanged event wasn't raised on property 'DisplayedWeeks' changing to 4.");
            }
            finally
            {
                target.PropertyChanged -= new PropertyChangedEventHandler(OnPropertyChanged);
            }
        }
Пример #2
0
        private void CreateViewModel(DisplayMode displayMode, DateTime date)
        {
            lock (this)
            {
                switch (displayMode)
                {
                case DisplayMode.Day:
                    ViewModels[(int)displayMode] = new SchedulerWeekViewModel(this, occurrences, DisplayedDays.Day);
                    break;

                case DisplayMode.WorkWeek:
                    ViewModels[(int)displayMode] = new SchedulerWeekViewModel(this, occurrences, DisplayedDays.WorkWeek);
                    break;

                case DisplayMode.Week:
                    ViewModels[(int)displayMode] = new SchedulerWeekViewModel(this, occurrences, DisplayedDays.Week);
                    break;

                case DisplayMode.Month:
                    ViewModels[(int)displayMode] = new SchedulerMonthViewModel(this, occurrences);
                    break;
                }
                if (ViewModels[(int)displayMode] != null)
                {
                    ViewModels[(int)displayMode].Initialize(date);
                }
            }
        }
Пример #3
0
 private void CreateViewModel(DisplayMode displayMode, DateTime date)
 {
     lock (this)
     {
         switch (displayMode)
         {
             case DisplayMode.Day:
                 ViewModels[(int)displayMode] = new SchedulerWeekViewModel(this, occurrences, DisplayedDays.Day);
                 break;
             case DisplayMode.WorkWeek:
                 ViewModels[(int)displayMode] = new SchedulerWeekViewModel(this, occurrences, DisplayedDays.WorkWeek);
                 break;
             case DisplayMode.Week:
                 ViewModels[(int)displayMode] = new SchedulerWeekViewModel(this, occurrences, DisplayedDays.Week);
                 break;
             case DisplayMode.Month:
                 ViewModels[(int)displayMode] = new SchedulerMonthViewModel(this, occurrences);
                 break;
         }
         if (ViewModels[(int)displayMode] != null)
             ViewModels[(int)displayMode].Initialize(date);
     }
 }