public LoginViewModel(IPortalPersistence model) { _model = model ?? throw new ArgumentNullException(nameof(model)); UserName = String.Empty; ExitCommand = new DelegateCommand(param => OnExitApplication()); LoginCommand = new DelegateCommand(param => LoginAsync(param as PasswordBox)); }
private void App_Startup(object sender, StartupEventArgs e) { persistence = new PortalServicePersistence("http://localhost:5000/"); loginViewModel = new LoginViewModel(persistence); loginViewModel.ExitApplication += ExitApplication; loginViewModel.LoginFailed += LoginViewModel_LoginFailed; loginViewModel.MessageApplication += ViewModel_MessageApplication; loginViewModel.LoginSuccess += LoginSuccess; loginWindow = new LoginWindow(); loginWindow.DataContext = loginViewModel; loginWindow.Show(); }
public MainViewModel(IPortalPersistence model, PublisherDTO author) { _model = model ?? throw new ArgumentNullException("model"); _isLoaded = false; _publisher = author; EditArticleCommand = new DelegateCommand(param => EditArticleAction((int)param)); ExitCommand = new DelegateCommand(_ => ExitApplication?.Invoke(this, EventArgs.Empty)); CreateArticleCommand = new DelegateCommand(_ => CreateArticleAction()); Refresh(); }