示例#1
0
        public MainViewModel()
        {
            this.Settings = SettingsViewModel.ReadSettingsFile();
            this.Settings.PropertyChanged += Settings_PropertyChanged;
            this.LastKnownDate             = DateTime.Now.Date;
            this.DateChangeTimer           = new Timer(HandleDateChangeTimerChange, null, 1000, 1000);
            this.GenerateLogSummaryForCurrentLogCommand = new RelayCommand <LogViewModel>(GenerateLogSummaryForCurrentLogCommand_Execute);

            this.LogListing = new LogListingViewModel(this.Settings);
            this.Summary    = new TimeSummaryViewModel();

            this.IdleCounter = new IdleCounter();
            this.IdleCounter.PropertyChanged += IdleCounter_PropertyChanged;

            if (!IsInDesignMode)
            {
                this.CurrentLog = LogViewModel.LoadByDate(DateTime.Now.Date, this.Settings);
            }
            else
            {
                this.CurrentLog = new LogViewModel(DateTime.Now, this.Settings);
            }

            this.MessengerInstance.Register <LoadLogMessage>(this, HandleLoadLogMessage);
        }