Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();
            TaskTimeTrackerConfigurationSerializer serializer = new TaskTimeTrackerConfigurationSerializer();
            string configPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            configPath += "/TaskTimeTracker";
            if (!Directory.Exists(configPath))
            {
                Directory.CreateDirectory(configPath);
            }
            configPath += @"\TaskTimeTracker.conf";
            TaskTimeTrackerConfigurationController controller = new TaskTimeTrackerConfigurationController(serializer, configPath);

            controller.Load();
            this._viewModel  = new MainWindowViewModel(controller);
            this.DataContext = this._viewModel;
        }