Example #1
0
        // ----------------------------------------------------------------------
        public CollectorViewModel()
        {
            // commands
            clearPeriodLimitsCommand  = new GenericCommand(this, ClearType.TimeRange);
            clearPeriodFilterCommand  = new GenericCommand(this, ClearType.Filter);
            clearCollectPeriodCommand = new GenericCommand(this, ClearType.CollectingRange);
            previousPeriodCommand     = new GenericCommand(this, PeriodSelectType.Previous);
            currentPeriodCommand      = new GenericCommand(this, PeriodSelectType.Current);
            nextPeriodCommand         = new GenericCommand(this, PeriodSelectType.Next);
            collectYearsCommand       = new GenericCommand(this, CollectType.Year);
            collectMonthsCommand      = new GenericCommand(this, CollectType.Month);
            collectDaysCommand        = new GenericCommand(this, CollectType.Day);
            collectHoursCommand       = new GenericCommand(this, CollectType.Hour);

            // lookups
            for (int day = 1; day <= TimeSpec.MaxDaysPerMonth; day++)
            {
                monthDays.Add(day);
            }
            for (int hour = 0; hour < TimeSpec.HoursPerDay; hour++)
            {
                dayHours.Add(hour);
            }

            // filter
            yearFilter = new CheckableItemCollection <int>();
            int currentYear = DateTime.Now.Year;

            for (int year = currentYear - 5; year < currentYear + 15; year++)
            {
                yearFilter.AddValue(year);
            }
            yearMonthFilter = new CheckableItemCollection <YearMonth>(new EnumValueList <YearMonth>());
            dayFilter       = new CheckableItemCollection <int>();
            for (int day = 1; day <= TimeSpec.MaxDaysPerMonth; day++)
            {
                dayFilter.AddValue(day);
            }
            dayOfWeekFilter = new CheckableItemCollection <DayOfWeek>(new EnumValueList <DayOfWeek>());

            // working period
            WorkingTimePeriod = TimePeriodMode.Year;

            // status
            ResetStatus();
        }         // CollectorDemoViewModel
        // ----------------------------------------------------------------------
        public CollectorViewModel()
        {
            // commands
            clearPeriodLimitsCommand = new GenericCommand( this, ClearType.TimeRange );
            clearPeriodFilterCommand = new GenericCommand( this, ClearType.Filter );
            clearCollectPeriodCommand = new GenericCommand( this, ClearType.CollectingRange );
            previousPeriodCommand = new GenericCommand( this, PeriodSelectType.Previous );
            currentPeriodCommand = new GenericCommand( this, PeriodSelectType.Current );
            nextPeriodCommand = new GenericCommand( this, PeriodSelectType.Next );
            collectYearsCommand = new GenericCommand( this, CollectType.Year );
            collectMonthsCommand = new GenericCommand( this, CollectType.Month );
            collectDaysCommand = new GenericCommand( this, CollectType.Day );
            collectHoursCommand = new GenericCommand( this, CollectType.Hour );

            // lookups
            for ( int day = 1; day <= TimeSpec.MaxDaysPerMonth; day++ )
            {
                monthDays.Add( day );
            }
            for ( int hour = 0; hour < TimeSpec.HoursPerDay; hour++ )
            {
                dayHours.Add( hour );
            }

            // filter
            yearFilter = new CheckableItemCollection<int>();
            int currentYear = DateTime.Now.Year;
            for ( int year = currentYear - 5; year < currentYear + 15; year++ )
            {
                yearFilter.AddValue( year );
            }
            yearMonthFilter = new CheckableItemCollection<YearMonth>( new EnumValueList<YearMonth>() );
            dayFilter = new CheckableItemCollection<int>();
            for ( int day = 1; day <= TimeSpec.MaxDaysPerMonth; day++ )
            {
                dayFilter.AddValue( day );
            }
            dayOfWeekFilter = new CheckableItemCollection<DayOfWeek>( new EnumValueList<DayOfWeek>() );

            // working period
            WorkingTimePeriod = TimePeriodMode.Year;

            // status
            ResetStatus();
        }