Пример #1
0
        public BookViewModel(
                    BookModel bookModel, string pageTitle,
                    INavigationServiceFacade navigationServiceFacade,
                    bool synchronizedWithSelection)
        {
            this._book = bookModel;
            this._pageTitle = pageTitle;
            this._navigationServiceFacade = navigationServiceFacade;

            if (_categoryService != null)
                this._categories =
                    new ObservableCollection<CategoryModel>(this._categoryService.GetByCriteria(CategoryCriteria.Empty));

            if (_authorService != null)
                this._authors =
                    new ObservableCollection<AuthorModel>(this._authorService.GetByCriteria(AuthorCriteria.Empty));

            #region Initialisation supplémentaire pour problème dans le ListPicker

            IEnumerator enumcat = this._categories.GetEnumerator();
            enumcat.MoveNext();
            _selectedCategory = enumcat.Current as CategoryModel;

            IEnumerator enumaut = this._authors.GetEnumerator();
            enumaut.MoveNext();
            _selectedAuthor = enumaut.Current as AuthorModel;

            #endregion // Initialisation supplémentaire pour problème dans le ListPicker
        }
Пример #2
0
 // Constructeur de copie
 public BookViewModel(BookViewModel bvm)
 {
     this._authors = bvm._authors;
     this._authorService = bvm._authorService;
     this._book = bvm.Book;
     this._categories = bvm._categories;
     this._categoryService = bvm._categoryService;
     this._isNewPhoto = bvm._isNewPhoto;
     this._navigationServiceFacade = bvm._navigationServiceFacade;
     this._pageTitle = bvm._pageTitle;
     this._rates = bvm._rates;
     this._selectedAuthor = bvm._selectedAuthor;
     this._selectedCategory = bvm._selectedCategory;
     this._state = bvm._state;
     this._windowServices = bvm._windowServices;
 }