public void Reset() { _defaultSetting = _settingFacade.GetDefaultSettings(); PdfSetting = CreateNewPdfSetting(_defaultSetting.Pdfsetting); if (_workedTimeViewModel == null) { _workedTimeViewModel = new WorkedTimeSettingViewModel(_defaultSetting.Time, _defaultSetting.Time, _defaultSetting.TimeTickInMinutes); _workedTimeViewModel.OnTimeChanged += (object sender, WorkedTimeEventArgs args) => { CancelChangesCommand.RaiseCanExecuteChanged(); SaveSettingsCommand.RaiseCanExecuteChanged(); }; _workedTimeViewModel.OnTimeTickChanged += (object sender, EventArgs args) => { CancelChangesCommand.RaiseCanExecuteChanged(); SaveSettingsCommand.RaiseCanExecuteChanged(); }; } _workedTimeViewModel.SetTime(_defaultSetting.Time); _workedTimeViewModel.SelectedTimeTickInMinutes = _defaultSetting.TimeTickInMinutes; ImportDataResultMessage = null; }
private DefaultListingPdfReportSetting CreateNewPdfSetting(DefaultListingPdfReportSetting oldSetting) { DefaultListingPdfReportSetting setting = new DefaultListingPdfReportSetting(oldSetting); setting.OnSettingPropertyChanged += (arg) => { CancelChangesCommand.RaiseCanExecuteChanged(); SaveSettingsCommand.RaiseCanExecuteChanged(); }; return(setting); }
private void SaveSettings() { _defaultSetting.Time = new TimeSetting( new Time(_workedTimeViewModel.StartTime), new Time(_workedTimeViewModel.EndTime), new Time(_workedTimeViewModel.LunchStart), new Time(_workedTimeViewModel.LunchEnd), new Time(_workedTimeViewModel.OtherHours) ); _defaultSetting.TimeTickInMinutes = _workedTimeViewModel.SelectedTimeTickInMinutes; _defaultSetting.Pdfsetting.UpdateBy(_pdfSetting); _settingFacade.SaveDefaultSetting(_defaultSetting); CancelChangesCommand.RaiseCanExecuteChanged(); SaveSettingsCommand.RaiseCanExecuteChanged(); }
private void SaveSettings() { _defaultSetting.Time = new TimeSetting( new Time(_workedTimeViewModel.StartTime), new Time(_workedTimeViewModel.EndTime), new Time(_workedTimeViewModel.LunchStart), new Time(_workedTimeViewModel.LunchEnd), new Time(_workedTimeViewModel.OtherHours) ); _defaultSetting.TimeTickInMinutes = _workedTimeViewModel.SelectedTimeTickInMinutes; _defaultSetting.Pdfsetting = new DefaultListingPdfReportSetting(PdfSetting); _settingFacade.UpdateDefaultSettings(_defaultSetting); CancelChangesCommand.RaiseCanExecuteChanged(); SaveSettingsCommand.RaiseCanExecuteChanged(); EventAggregator.PublishOnUIThread(new SettingsSuccessfullySavedMessage()); }