Beispiel #1
0
        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 void Reset(DayItem dayItem)
        {
            string date = CultureInfo.CurrentCulture.TextInfo.ToTitleCase((new DateTime(dayItem.Year, dayItem.Month, dayItem.Day)).ToLongDateString().ToLower());

            WindowTitle.Text = String.Format("{0} - {1}", date, dayItem.Listing.Name);
            _defaultSettings = _settingFacade.GetDefaultSettings();
            Locality         = null;

            if (dayItem.ListingItem != null)
            {
                ListingItem l = dayItem.ListingItem;
                Locality = l.Locality;

                WorkedTimeViewModel = new WorkedTimeSettingViewModel(_defaultSettings.Time, l.TimeSetting, _defaultSettings.TimeTickInMinutes);
            }
            else
            {
                WorkedTimeViewModel = new WorkedTimeSettingViewModel(_defaultSettings.Time, _defaultSettings.Time, _defaultSettings.TimeTickInMinutes);
            }

            Localities = new ObservableCollection <string>(dayItem.Localities);
        }