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

            _model = model;
            _model.BuildingChanged += Model_BuildingChanged;
            _isLoaded = false;

            CreateBuildingCommand = new DelegateCommand(param =>
            {
                EditedBuilding = new BuildingDTO();  // a szerkesztett épület új lesz
                OnBuildingEditingStarted();
            });
            CreateImageCommand    = new DelegateCommand(param => OnImageEditingStarted((param as BuildingDTO).Id));
            UpdateBuildingCommand = new DelegateCommand(param => UpdateBuilding(param as BuildingDTO));
            DeleteBuildingCommand = new DelegateCommand(param => DeleteBuilding(param as BuildingDTO));
            DeleteImageCommand    = new DelegateCommand(param => DeleteImage(param as ImageDTO));
            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());
        }
Example #2
0
        private void App_Startup(object sender, StartupEventArgs e)
        {
            _model = new TravelAgencyModel(new TravelAgencyServicePersistence("http://localhost:62954/")); // 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();
        }
Example #3
0
        /// <summary>
        /// Nézetmodell példányosítása.
        /// </summary>
        /// <param name="model">A modell.</param>
        public LoginViewModel(ITravelAgencyModel 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));
        }