public void Execute(object parameter) { menuViewModel menuViewModel = (menuViewModel)App.Current.Resources["SharedMenu"]; loginRegister loginRegister = new loginRegister(); loginRegister.registerAccount(menuViewModel.UnregisteredAccount.Username, menuViewModel.UnregisteredAccount.Password); }
public void Execute(object parameter) { gameViewModel gameViewModel = (gameViewModel)App.Current.Resources["SharedGame"]; menuViewModel menuViewModel = (menuViewModel)App.Current.Resources["SharedMenu"]; loginRegister loginRegister = new loginRegister(); if (loginRegister.login(menuViewModel.UnregisteredAccount.Username, menuViewModel.UnregisteredAccount.Password)) { var context = new SideScrollerDBContext(); var account = context.Players .Where(s => s.Username == menuViewModel.UnregisteredAccount.Username); gameViewModel.Player = account.First(); gameViewModel.IsLoggedIn = true; menuViewModel.Player.Username = account.First().Username; } }