Пример #1
0
 /// <summary>
 /// What to do with the application on startup
 /// Start the SQL connection and start the Tagger logic.
 /// open a new MainWindow (NOTE, THE XMAL FILE DOESNT HAVE STARTUP URI).
 /// set the notification icon.
 /// </summary>
 /// <param name="e"></param>
 protected override void OnStartup(StartupEventArgs e)
 {
     SqliteDataAccess.StartUp();
     MainBackgroundLogic.CheckFirstTime();
     Tagger.StartUp();
     base.OnStartup(e);
     SetUpView();
     SetUpViewModel();
     ShowMainWindow();
 }
Пример #2
0
 /// <summary>
 /// Sets up all the components of the application background such as : hooks manager,  activityline object saving the last activity.
 /// </summary>
 public MainViewModel(MainWindow mainWindow)
 {
     // ------ viewmodel code---------
     view                     = mainWindow;
     tagViewModel             = new TagViewModel(SqliteDataAccess.LoadTags());
     tagViewModel.Title       = "Current App: ";
     view.TagView.DataContext = tagViewModel;
     ruleViewModel            = new RuleViewModel(SqliteDataAccess.LoadRules(), tagViewModel);
     // ------ viewmodel code---------
     // ------ background logic code---------
     SetUpHook();
     backgroundLogic = new MainBackgroundLogic(this);
     currentTag      = backgroundLogic.previousActivity.Tag;
     // setting the timers
     timer          = new DispatcherTimer();
     timer.Interval = TimeSpan.FromSeconds(1);
     timer.Start();
     timer.Tick += backgroundLogic.Timer_Tick;
     // ------ background logic code---------
 }