示例#1
0
 private NotifyIconViewModel()
 {
     viewModel = new TimeTrackViewModel();
     viewModel.PropertyChanged += TimeTrackViewModel_PropertyChanged;
     BuildShortcutMenusAsync();
     SyncThemeSettings();
     IsTimerActive = false;
     timer         = GetUITimer(TimeSpan.FromSeconds(1), OnTimerTick);
 }
 public CurrentEntryViewModel(TimeTrackViewModel parent)
 {
     this.parent     = parent;
     CurrentWorkItem = this.parent.CurrentWorkItem;
     if (this.parent.CurrentEntry != null)
     {
         CurrentEntry = this.parent.CurrentEntry;
     }
     else
     {
         CurrentEntry = new TimeEntry {
             StartDate = DateTime.Now, Status = Status.Analysis
         }
     };
 }
示例#3
0
 public void CleanUp()
 {
     // do clean up here
     try
     {
         if (viewModel != null)
         {
             viewModel.PropertyChanged -= TimeTrackViewModel_PropertyChanged;
         }
     }
     catch { /* gulp */ }
     finally
     {
         viewModel = null;
     }
     try
     {
         if (timer.IsEnabled)
         {
             timer.Stop();
             timer.Tick -= OnTimerTick;
         }
     }
     finally
     {
         timer = null;
     }
     try
     {
         if (shortcutWatcher != null)
         {
             shortcutWatcher.Changed -= OnShortcutWatcher_Changed;
             shortcutWatcher.Created -= OnShortcutWatcher_Changed;
             shortcutWatcher.Deleted -= OnShortcutWatcher_Changed;
             shortcutWatcher.Renamed -= OnShortcutWatcher_Renamed;
         }
         shortcutWatcher.Dispose();
     }
     finally
     {
         shortcutWatcher = null;
     }
     try
     {
         current = null;
     }
     catch { }
 }