예제 #1
0
        public void StartApp(object sender, StartupEventArgs args)
        {
            var config     = Config.Load();
            var repository = new WorkHoursRepository(config);
            var viewModel  = new MainViewModel(repository, config);
            var window     = new MainWindow(viewModel);

            DispatcherUnhandledException += OnUnhandledException;
            window.Show();
        }
예제 #2
0
 public MainViewModel(WorkHoursRepository repository, Config config)
 {
     this.repository        = repository;
     this.config            = config;
     Days                   = new ObservableCollection <Day>(repository.Days);
     command                = new Command();
     command.CanExecuteFunc = x => true;
     command.ExecuteFunc    = x => Com((string)x);
     Task.Run(() =>
     {
         while (true)
         {
             App.Current.Dispatcher.Invoke(() =>
             {
                 Refresh();
             });
             Thread.Sleep(1000);
         }
     });
 }