コード例 #1
0
        private void AppInitilisation(MainWindowViewModel mvm, IConfigurationWindowViewModel cvm)
        {
            if (!cvm.SetStampOnStartupIsChecked)
            {
                return;
            }

            mvm.Tasks.Add(new Task(DateTime.Now, cvm.StartupStampText));
        }
コード例 #2
0
 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;
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        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;
        }
コード例 #5
0
        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;
        }
コード例 #6
0
        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;
        }
コード例 #7
0
 /// <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();
 }
コード例 #8
0
 public void OnLoaded()
 {
     // Save a copy of the current ViewModel.
     this._onLoadedState = this.ViewModel.Clone();
 }