private void AppInitilisation(MainWindowViewModel mvm, IConfigurationWindowViewModel cvm) { if (!cvm.SetStampOnStartupIsChecked) { return; } mvm.Tasks.Add(new Task(DateTime.Now, cvm.StartupStampText)); }
public override void CreateFromViewModel(IConfigurationWindowViewModel viewModel) { this.Configuration = new TaskTimeTrackerConfiguration(); this.Configuration.KeyOne = viewModel.KeyOne; this.Configuration.AltIsChecked = viewModel.AltIsChecked; this.Configuration.ControlIsChecked = viewModel.ControlIsChecked; this.Configuration.WindowsIsChecked = viewModel.WindowsIsChecked; this.Configuration.StartupStampText = viewModel.StartupStampText; this.Configuration.SetStampOnStartupIsChecked = viewModel.SetStampOnStartupIsChecked; }
private IConfigurationWindowViewModel AddConfigurationViewModel() { TaskTimeTrackerConfigurationSerializer serializer = new TaskTimeTrackerConfigurationSerializer(); TaskTimeTrackerConfigurationController controller = new TaskTimeTrackerConfigurationController(serializer); controller.Load(); ConfigurationViewModelController configurationViewModelController = new ConfigurationViewModelController(controller); IConfigurationWindowViewModel configViewModel = configurationViewModelController.FromConfiguration(controller.Configuration); this._viewModelCollection.AddViewModel(typeof(ConfigurationWindowViewModel), configViewModel); return(configViewModel); }
private void ConfigExecute(object obj) { ConfigurationWindow.ConfigurationWindow configWindow = new ConfigurationWindow.ConfigurationWindow(Application.Current.MainWindow); configWindow.ConfigurationController = this._configurationController; ConfigurationViewModelController configurationViewModelController = new ConfigurationViewModelController(configWindow); this._configViewModel = configurationViewModelController.FromConfiguration(this.Configuration); configWindow.ViewModel = this._configViewModel; configWindow.ShowDialog(); if (this.Configuration.CompareTo((ITaskTimeTrackerConfiguration)this._configurationController.Configuration) == 0) { return; } this._configurationController.Save(); this.Configuration = (ITaskTimeTrackerConfiguration)this._configurationController.Configuration; }
public override void CreateFromViewModel(IConfigurationWindowViewModel viewModel) { ITaskTimeTrackerConfiguration config = new TaskTimeTrackerConfiguration(); config.KeyOne = viewModel.KeyOne; config.AltIsChecked = viewModel.AltIsChecked; config.ControlIsChecked = viewModel.ControlIsChecked; config.WindowsIsChecked = viewModel.WindowsIsChecked; config.StartupStampText = viewModel.StartupStampText; config.SetStampOnStartupIsChecked = viewModel.SetStampOnStartupIsChecked; config.SetStampOnLockIsChecked = viewModel.SetStampOnLockIsChecked; config.ScreenLockedText = viewModel.ScreenLockedText; config.ScreenUnlockedText = viewModel.ScreenUnlockedText; this.Configuration = config; }
public void OnUnLoaded() { // If the Abort flag is set -> Reset fields to the copyed values from OnLoaded() if (IsAborted) { this.ViewModel.AltIsChecked = this._onLoadedState.AltIsChecked; this.ViewModel.KeyOne = this._onLoadedState.KeyOne; this.ViewModel.ControlIsChecked = this._onLoadedState.ControlIsChecked; this.ViewModel.KeyOneString = this._onLoadedState.KeyOneString; this.ViewModel.SetStampOnStartupIsChecked = this._onLoadedState.SetStampOnStartupIsChecked; this.ViewModel.WindowsIsChecked = this._onLoadedState.WindowsIsChecked; this.ViewModel.StartupStampText = this._onLoadedState.StartupStampText; } // else save the changes to the Configuration else { this._configurationController.CreateFromViewModel(this.ViewModel); this._configurationController.Configuration.Version = new Version(1, 0, 0, 0); // Is this needed ? this._configurationController.Save(); } this._onLoadedState = null; }
/// <summary> /// Sets the given key /// </summary> /// <param name="key"></param> /// <param name="viewModel"></param> public void SetKey(Key key, IConfigurationWindowViewModel viewModel) { viewModel.KeyOne = key; viewModel.KeyOneString = key.ToString(); }
public void OnLoaded() { // Save a copy of the current ViewModel. this._onLoadedState = this.ViewModel.Clone(); }