示例#1
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(IMessageDlgService messageDlgService, 
            IProgressDialogService progressDialogService, IAppSettingsService stgsService, ITimePusher timePusherService)
        {
            this.progressDialogService = progressDialogService;
            this.messageDlgService = messageDlgService;
            this.stgsService = stgsService;
            this.timePusherService = timePusherService;
            this.Settings = this.stgsService.ReadSettings();

            this.PostTimeEntries = new RelayCommand(async () =>
            {
                await this.DoOp(() => this.timePusherService.PushTime(this.Settings, DateTime.Now.AddDays(-7).Date, DateTime.Now.AddDays(1).Date), "posting logged time for today", "Time entries for today have been successfully posted.");
            });

            this.ClosingCommand = new RelayCommand(() =>
            {
                this.stgsService.SaveSettings(this.Settings);
            });


            ////if (IsInDesignMode)
            ////{
            ////    // Code runs in Blend --> create design time data.
            ////}
            ////else
            ////{
            ////    // Code runs "for real"
            ////}
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(IMessageDlgService messageDlgService,
                             IProgressDialogService progressDialogService, IAppSettingsService stgsService, ITimePusher timePusherService)
        {
            this.progressDialogService = progressDialogService;
            this.messageDlgService     = messageDlgService;
            this.stgsService           = stgsService;
            this.timePusherService     = timePusherService;
            this.Settings = this.stgsService.ReadSettings();

            this.PostTimeEntries = new RelayCommand(async() =>
            {
                await this.DoOp(() => this.timePusherService.PushTime(this.Settings, DateTime.Now.AddDays(-7).Date, DateTime.Now.AddDays(1).Date), "posting logged time for today", "Time entries for today have been successfully posted.");
            });

            this.ClosingCommand = new RelayCommand(() =>
            {
                this.stgsService.SaveSettings(this.Settings);
            });


            ////if (IsInDesignMode)
            ////{
            ////    // Code runs in Blend --> create design time data.
            ////}
            ////else
            ////{
            ////    // Code runs "for real"
            ////}
        }