public void LoadView(MainWindowViewType typeView, Advert ad, MainWindowViewType typeViewPrev) { switch (typeView) { case MainWindowViewType.Advert: AdvertPage viewAdvert = new AdvertPage(); AdvertPageViewModel vmAdvert = new AdvertPageViewModel(this, ad, typeViewPrev); viewAdvert.DataContext = vmAdvert; OutputView = viewAdvert; break; } }
public void LoadView(MainWindowViewType typeView, Advert ad) { switch (typeView) { case MainWindowViewType.EditAd: EditAdPage viewEditAd = new EditAdPage(); EditAdViewModel vmEditAd = new EditAdViewModel(this, ad); viewEditAd.DataContext = vmEditAd; OutputView = viewEditAd; break; } }
public void LoadView(MainWindowViewType typeView, Advert ad) { switch (typeView) { case MainWindowViewType.EditAd: EditAdPage viewEditAd = new EditAdPage(); EditAdViewModel vmEditAd = new EditAdViewModel(this, ad); viewEditAd.DataContext = vmEditAd; this.OutputView.Content = viewEditAd; break; case MainWindowViewType.Advert: AdvertPage viewAdvert = new AdvertPage(); AdvertPageViewModel vmAdvert = new AdvertPageViewModel(this, ad); viewAdvert.DataContext = vmAdvert; this.OutputView.Content = viewAdvert; break; } }
public void LoadView(MainWindowViewType typeView) { switch (typeView) { case MainWindowViewType.Main: //загружаем вьюшку, ее вьюмодель HomePage view = new HomePage(); HomePageViewModel vm = new HomePageViewModel(this); //связываем их м/собой view.DataContext = vm; //отображаем OutputView = view; break; case MainWindowViewType.BrowseAdverts: //загружаем вьюшку, ее вьюмодель BrowseAdvertsPage viewBrowseAdverts = new BrowseAdvertsPage(); BrowseAdvertsViewModel vmBrowseAdverts = new BrowseAdvertsViewModel(this); //связываем их м/собой viewBrowseAdverts.DataContext = vmBrowseAdverts; //отображаем OutputView = viewBrowseAdverts; break; case MainWindowViewType.CreateAd: CreateAdPage viewCreateAd = new CreateAdPage(); CreateAdViewModel vmCreateAd = new CreateAdViewModel(this); viewCreateAd.DataContext = vmCreateAd; OutputView = viewCreateAd; break; case MainWindowViewType.Favorite: FavoritePage viewFavorite = new FavoritePage(); FavoritePageViewModel vmFavorite = new FavoritePageViewModel(this); viewFavorite.DataContext = vmFavorite; OutputView = viewFavorite; break; } }
public void LoadView(MainWindowViewType typeView) { switch (typeView) { case MainWindowViewType.Main: //загружаем вьюшку, ее вьюмодель HomePage view = new HomePage(); HomePageViewModel vm = new HomePageViewModel(this); //связываем их м/собой view.DataContext = vm; //отображаем this.OutputView.Content = view; break; case MainWindowViewType.CreateAd: CreateAdPage viewCreateAd = new CreateAdPage(); CreateAdViewModel vmCreateAd = new CreateAdViewModel(this); viewCreateAd.DataContext = vmCreateAd; this.OutputView.Content = viewCreateAd; break; } }
public AdvertPageViewModel(MainWindowViewModel mainForm, Advert ad, MainWindowViewType typeViewPrev) { this.mainForm = mainForm; prevView = typeViewPrev; User = mainForm.User; Ad = ad; ID = ad.Advert_ID; Name = ad.Advert_Name; KindOfAnimal = ad.Advert_KindOfAnimal; Description = ad.Advert_Description; AnimalWeight = ad.Advert_AnimalWeight; AnimalAge = ad.Advert_AnimalAge; Image = ad.Advert_Picture; ImageSource = ImageConverter.ImageSourceFromBitmap(ad.Advert_Picture.Source); if (!User.User_IsAdmin) { EditAdvertButtonVisibility = Visibility.Collapsed; DeleteAdvertButtonVisibility = Visibility.Collapsed; } else { AddFavoriteButtonVisibility = Visibility.Collapsed; } }