Ejemplo n.º 1
0
        public HomeViewModel(Account person)
        {
            AddPersonCommand       = new RelayCommand(AddPersonExecute, AddPersonCanExecute);
            ModifyPersonCommand    = new RelayCommand(ModifyPersonExecute, ModifyPersonCanExecute);
            DeletePersonCommand    = new RelayCommand(DeletePersonExecute, DeletePersonCanExecute);
            PersonDetailsCommand   = new RelayCommand(PersonDetailsExecute, PersonDetailsCanExecute);
            DuplicatePersonCommand = new RelayCommand(DuplicatePersonExecute, DuplicatePersonCanExecute);
            UndoPersonCommand      = new RelayCommand(UndoPersonExecute, UndoPersonCanExecute);
            RedoPersonCommand      = new RelayCommand(RedoPersonExecute, RedoPersonCanExecute);
            ShowPeopleCommand      = new RelayCommand(ShowPeopleExecute, ShowPeopleCanExecute);
            SearchPersonCommand    = new RelayCommand(SearchPersonExecute, SearchPersonCanExecute);

            AddEventCommand     = new RelayCommand(AddEventExecute, AddEventCanExecute);
            ModifyEventCommand  = new RelayCommand(ModifyEventExecute, ModifyEventCanExecute);
            DeleteEventCommand  = new RelayCommand(DeleteEventExecute, DeleteEventCanExecute);
            EventDetailsCommand = new RelayCommand(EventDetailsExecute, EventDetailsCanExecute);
            ShowEventsCommand   = new RelayCommand(ShowEventsExecute, ShowEventsCanExecute);

            CreateAccountCommand         = new RelayCommand(CreateAccountExecute, CreateAccountCanExecute);
            ModifyAccountCommand         = new RelayCommand(ModifyAccountExecute, ModifyAccountCanExecute);
            ModifyPersonalAccountCommand = new RelayCommand(ModifyPersonalAccountExecute, ModifyPersonalAccountCanExecute);
            DeleteAccountCommand         = new RelayCommand(DeleteAccountExecute, DeleteAccountCanExecute);
            ShowAccountsCommand          = new RelayCommand(ShowAccountsExecute, ShowAccountsCanExecute);

            LogOutCommand = new RelayCommand(LogOutExecute, LogOutCanExecute);

            InstanceContext instanceContext = new InstanceContext(this);

            _personProxy  = PersonProxy.ConnectToPersonService(instanceContext);
            _accountProxy = AccountProxy.ConnectToAccountService(instanceContext);
            _eventProxy   = EventProxy.ConnectToAccountService(instanceContext);

            _personProxy.Subscribe();
            _accountProxy.Subscribe();
            _eventProxy.Subscribe();

            LoggedInAccount = person;
            LogText         = LoggerHelper.Instance.ClientLogBuilder;

            PeopleList   = new ObservableCollection <Person>(_personProxy.GetAllPeople());
            AccountsList = new ObservableCollection <Account>(_accountProxy.GetAllAccounts());
            EventsList   = new ObservableCollection <Event>(_eventProxy.GetAllEvents());

            ListOfCommands = new List <BaseCommand>();
            CurrentCommand = 0;

            logger.Info("HomeViewModel constructor success.");
            LoggerHelper.Instance.LogMessage($"HomeViewModel constructor success.", EEventPriority.INFO, EStringBuilder.CLIENT);
            LogText = LoggerHelper.Instance.ClientLogBuilder;
        }