public MarketViewModel(MonitorContext context) { Context = context; Context.Products.Load(); Context.Product.Load(); Context.Markets.Load(); if (Context.Markets.Count() == 0) { this.Fill(); } DispatcherTimer timer = new DispatcherTimer(); timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 20, 0); timer.Tick += new EventHandler(this.DBUpdate); User = new User { LastUpdate = Properties.Settings.Default.LastUpdate }; Notify = new Notification(); // Start the timer. timer.Start(); try { GoogleApi api = new GoogleApi(Properties.Settings.Default.Token); User.Email = api.GetEmailPlus(); } catch { } }