Beispiel #1
0
        public AppViewModel()
        {
            var dataService   = new JsonContactDataService();
            var dialogService = new WindowDialogService();

            BookVM      = new BookViewModel(dataService, dialogService);
            CurrentView = BookVM;
        }
        public AppViewModel()
        {
            var dataService = new JsonContactDataService();

            _dataService = dataService;

            NewContactVM = new NewContactViewModel(dataService);
            ContactsVM   = new ContactsViewModel(dataService);
            ListVM       = new ListViewModel(dataService, ContactsVM);
        }
        private int lastViewHolder = 1; /// 0 means = you're on "Favourites" section, 1 means you're on "Contacts" section

        public BookViewModel()
        {
            dataService    = new JsonContactDataService();
            ContactVM      = new ContactViewModel(this);
            AllContactData = dataService.GetData().ToObservableCollection();

            FavContactData     = AllContactData.Where(x => x.IsFavourite == true).ToObservableCollection();
            ContactData        = AllContactData.Where(x => x.IsFavourite == false).ToObservableCollection();
            CurrentContactData = ContactData;
            ContactsCommand    = new RelayCommand(LoadContacts);
            FavouritesCommand  = new RelayCommand(LoadFavourites);
            DeleteApprove      = new RelayCommand(ApprovingDelete);
            DeleteCancel       = new RelayCommand(QuitDeleting);
            AddCommand         = new RelayCommand(AddNewContact);
        }