Example #1
0
        public LoginViewModel(INewsPersistence model)
        {
            _model   = model ?? throw new ArgumentNullException(nameof(model));
            UserName = String.Empty;

            ExitCommand = new DelegateCommand(param => OnExitApplication());

            LoginCommand = new DelegateCommand(param => LoginAsync(param as PasswordBox));
        }
Example #2
0
        private void App_Startup(object sender, StartupEventArgs e)
        {
            persistence = new NewsServicePersistence("http://localhost:51749/");
            //persistence = new MockupPersistence();
            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();
        }
Example #3
0
        public MainViewModel(INewsPersistence model, AuthorDTO author)
        {
            _model    = model ?? throw new ArgumentNullException("model");
            _isLoaded = false;
            _author   = author;

            DeleteArticleCommand = new DelegateCommand(param => DeleteArticle((int)param));

            EditArticleCommand = new DelegateCommand(param => EditArticleAction((int)param));

            ExitCommand = new DelegateCommand(_ => ExitApplication?.Invoke(this, EventArgs.Empty));

            CreateArticleCommand = new DelegateCommand(_ => CreateArticleAction());

            Refresh();
        }
Example #4
0
 public NewsModel(INewsPersistence newsPersistence)
 {
     this.newsPersistence = newsPersistence;
 }