Beispiel #1
0
        /// <summary>
        /// Nézetmodell példányosítása.
        /// </summary>
        /// <param name="model">A modell.</param>
        public MainViewModel(IWebShopModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            _model = model;
            _model.ProductChanged += Model_ProductChanged;
            _model.RentChanged    += Model_RentChanged;
            _isLoaded              = false;

            FinalizeRentCommand = new DelegateCommand(param =>
            {
                FinalizeRent(param as RentDTO);
            });
            CreateProductCommand = new DelegateCommand(param =>
            {
                EditedProduct = new ProductDTO();  // a szerkesztett termék új lesz
                OnProductEditingStarted();
            });
            UpdateProductCommand = new DelegateCommand(param => UpdateProduct(param as ProductDTO));
            DeleteProductCommand = new DelegateCommand(param => DeleteProduct(param as ProductDTO));
            SaveChangesCommand   = new DelegateCommand(param => SaveChanges());
            CancelChangesCommand = new DelegateCommand(param => CancelChanges());
            LoadCommand          = new DelegateCommand(param => LoadAsync());
            SaveCommand          = new DelegateCommand(param => SaveAsync());
            ExitCommand          = new DelegateCommand(param => OnExitApplication());
        }
Beispiel #2
0
        private void App_Startup(object sender, StartupEventArgs e)
        {
            _model = new WebShopModel(new WebShopPersistence("http://localhost:63644/")); // 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();
        }
Beispiel #3
0
        /// <summary>
        /// Nézetmodell példányosítása.
        /// </summary>
        /// <param name="model">A modell.</param>
        public LoginViewModel(IWebShopModel 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));
        }