protected override async void OnStartup(StartupEventArgs e) { try { if (mutex.WaitOne(0)) { mutexAccessed = true; } } catch (AbandonedMutexException) { mutexAccessed = true; } if (mutexAccessed) { base.OnStartup(e); } else { MessageBox.Show("FamilyOrganizer is running"); Shutdown(); return; } var ss = new SplashScreen(); ss.Show(); Context = new FamilyOrganizerContext(); await Context.Photos.LoadAsync(); await Context.AppUsers.LoadAsync(); await Context.Transactions.LoadAsync(); await Context.Balances.LoadAsync(); await Context.Comments.LoadAsync(); await Context.ShoppingPlans.LoadAsync(); await Context.TodayPlans.LoadAsync(); //Seed.SeedTransactions(Context); //Seed.SeedBalances(Context); //Seed.SeedPhotos(Context); if (Context.AppUsers.Count() == 0) { var r = new Register(Context, true); r.Show(); } else { var l = new Login(Context); l.Show(); } ss.Close(); }
private void LogoutBtn_Click(object sender, RoutedEventArgs e) { Register r = new Register(_context); r.Show(); }