private void Application_Launching(object sender, LaunchingEventArgs e) { if (database == null) database = new DatabaseManager(); database.Open(); if (!UserData.Get<bool>(UserData.AlreadyLaunchedKey)) { UserData.Add<int>(UserData.WeightKey, 65); UserData.Add<int>(UserData.SportKey, 7); UserData.Add<bool>(UserData.LocationToggleKey, true); UserData.Add<bool>(UserData.ShowWizardKey, true); UserData.Add<bool>(UserData.AlreadyLaunchedKey, true); } if (UserData.Get<bool>(UserData.LocationToggleKey)) ViewModelController.StartLocationService(); UserData.Add<int>(UserData.SessionSelectedIndexKey, -1); }
private void Application_Deactivated(object sender, DeactivatedEventArgs e) { ViewModelController.StopLocationService(); if (database != null) { database.Close(); database = null; } }
private void Application_Activated(object sender, ActivatedEventArgs e) { if (UserData.Get<bool>(UserData.LocationToggleKey)) ViewModelController.StartLocationService(); if (database == null) database = new DatabaseManager(); database.Open(); }