private void App_Startup(object sender, StartupEventArgs e) { _model = new EBankModel(new EBankPersistence("http://localhost:14571/")); // megadjuk a szolgáltatás címét _loginViewModel = new LoginViewModel(_model); _loginViewModel.ExitApplication += new EventHandler(ViewModel_ExitApplication); _loginViewModel.LoginSuccess += new EventHandler(ViewModel_LoginSuccess); _loginViewModel.LoginFailed += new EventHandler(ViewModel_LoginFailed); _loginView = new LoginWindow(); _loginView.DataContext = _loginViewModel; _loginView.Show(); }
public LoginViewModel(IEBankModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } _model = model; UserName = String.Empty; ExitCommand = new DelegateCommand(param => OnExitApplication()); LoginCommand = new DelegateCommand(param => LoginAsync(param as PasswordBox)); }
public MainViewModel(IEBankModel model) { if (model == null) { throw new ArgumentNullException("model"); } _model = model; _model.BankAccountsChanged += Model_BankAccountChanged; _isLoaded = false; AddInCommand = new DelegateCommand(param => { EditedTransaction = new TransactionDTO(); EditedTransaction.AccountID = (param as BankAccountsDTO).ID; OnAddInStarted((param as BankAccountsDTO).ID); }); OtherCommand = new DelegateCommand(param => { EditedTransaction = new TransactionDTO(); EditedTransaction.AccountID = (param as BankAccountsDTO).ID; OnOtherStarted((param as BankAccountsDTO).ID); }); TakeOutCommand = new DelegateCommand(param => { EditedTransaction = new TransactionDTO(); EditedTransaction.AccountID = (param as BankAccountsDTO).ID; OnTakeOutStarted((param as BankAccountsDTO).ID); }); TranCommand = new DelegateCommand(param => { EditedTransaction = new TransactionDTO(); EditedTransaction.AccountID = (param as BankAccountsDTO).ID; OnTranStarted((param as BankAccountsDTO).ID); }); LockCommand = new DelegateCommand(param => LockBankAccount(param as BankAccountsDTO)); SaveAddInCommand = new DelegateCommand(param => SaveAddIn()); SaveTakeOutCommand = new DelegateCommand(param => SaveTakeOut()); CancelAddInCommand = new DelegateCommand(param => CancelAddIn()); CancelTakeOutCommand = new DelegateCommand(param => CancelTakeOut()); SaveTranCommand = new DelegateCommand(param => SaveTran()); CancelTranCommand = new DelegateCommand(param => CancelTran()); LoadCommand = new DelegateCommand(param => LoadAsync()); SaveCommand = new DelegateCommand(param => SaveAsync()); ExitCommand = new DelegateCommand(param => OnExitApplication()); }