public ProfileMediaViewModelFacade()
 {
     this._mediaHorizontalItemsViewModel = (IMediaHorizontalItemsViewModel) new ProfilePhotosViewModel();
     this._mediaVerticalItemsViewModel   = (IMediaVerticalItemsViewModel) new ProfileAudiosViewModel();
     this._mediaSectionsViewModel        = new ProfileMediaSectionsViewModel();
     EventAggregator.Current.Subscribe(this);
 }
Exemplo n.º 2
0
        private void MediaVerticalListItem_OnTap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            ProfileMediaViewModelFacade         viewModel = this.ViewModel;
            Action <MediaListItemViewModelBase> action1;

            if (viewModel == null)
            {
                action1 = null;
            }
            else
            {
                IMediaVerticalItemsViewModel verticalItemsViewModel = viewModel.MediaVerticalItemsViewModel;
                action1 = verticalItemsViewModel != null ? verticalItemsViewModel.ItemTapAction :  null;
            }
            Action <MediaListItemViewModelBase> action2 = action1;

            if (action2 == null)
            {
                return;
            }
            MediaListItemViewModelBase dataContext = ((FrameworkElement)sender).DataContext as MediaListItemViewModelBase;

            if (dataContext == null)
            {
                return;
            }
            action2(dataContext);
        }
Exemplo n.º 3
0
        public void Init(IProfileData profileData)
        {
            if (this._profileData == null || profileData.MainSectionType != this._profileData.MainSectionType)
            {
                this._canDisplayHorizontalItems = false;
                this._canDisplayVerticalItems   = false;
                if (profileData.MainSectionType == ProfileMainSectionType.None)
                {
                    this._canDisplayHorizontalItems = false;
                    this._canDisplayVerticalItems   = false;
                }
                else
                {
                    switch (profileData.MainSectionType)
                    {
                    case ProfileMainSectionType.Photos:
                        this._mediaHorizontalItemsViewModel = (IMediaHorizontalItemsViewModel) new ProfilePhotosViewModel();
                        this._canDisplayHorizontalItems     = true;
                        break;

                    case ProfileMainSectionType.Discussions:
                        this._mediaVerticalItemsViewModel = (IMediaVerticalItemsViewModel) new ProfileDiscussionsViewModel();
                        break;

                    case ProfileMainSectionType.Audios:
                        this._mediaVerticalItemsViewModel = (IMediaVerticalItemsViewModel) new ProfileAudiosViewModel();
                        break;

                    case ProfileMainSectionType.Videos:
                        this._mediaHorizontalItemsViewModel = (IMediaHorizontalItemsViewModel) new ProfileVideosViewModel();
                        this._canDisplayHorizontalItems     = true;
                        break;

                    case ProfileMainSectionType.Market:
                        this._mediaHorizontalItemsViewModel = (IMediaHorizontalItemsViewModel) new ProfileMarketViewModel();
                        this._canDisplayHorizontalItems     = true;
                        break;
                    }
                    this._canDisplayVerticalItems = !this._canDisplayHorizontalItems;
                }
            }
            this._profileData = profileData;
            if (this._canDisplayHorizontalItems)
            {
                this.NotifyPropertyChanged <IMediaHorizontalItemsViewModel>((System.Linq.Expressions.Expression <Func <IMediaHorizontalItemsViewModel> >)(() => this.MediaHorizontalItemsViewModel));
                this._mediaHorizontalItemsViewModel.Init(this._profileData);
            }
            else
            {
                this.NotifyPropertyChanged <IMediaVerticalItemsViewModel>((System.Linq.Expressions.Expression <Func <IMediaVerticalItemsViewModel> >)(() => this.MediaVerticalItemsViewModel));
                this._mediaVerticalItemsViewModel.Init(this._profileData);
            }
            this.NotifyPropertyChanged <Visibility>((System.Linq.Expressions.Expression <Func <Visibility> >)(() => this.MediaHorizontalItemsVisibility));
            this.NotifyPropertyChanged <Visibility>((System.Linq.Expressions.Expression <Func <Visibility> >)(() => this.MediaVerticalItemsVisibility));
            this._mediaSectionsViewModel.Init(this._profileData, this._profileData.MainSectionType);
            this.NotifyPropertyChanged <Visibility>((System.Linq.Expressions.Expression <Func <Visibility> >)(() => this.MediaSectionsVisibility));
            this.NotifyPropertyChanged <bool>((System.Linq.Expressions.Expression <Func <bool> >)(() => this.CanDisplay));
        }
Exemplo n.º 4
0
        private void MediaVerticalItemsHeader_OnTap(object sender, RoutedEventArgs routedEventArgs)
        {
            ProfileMediaViewModelFacade viewModel = this.ViewModel;

            if (viewModel == null)
            {
                return;
            }
            IMediaVerticalItemsViewModel verticalItemsViewModel = viewModel.MediaVerticalItemsViewModel;

            if (verticalItemsViewModel == null)
            {
                return;
            }
            Action headerTapAction = verticalItemsViewModel.HeaderTapAction;

            if (headerTapAction == null)
            {
                return;
            }
            headerTapAction();
        }
Exemplo n.º 5
0
 public ProfileMediaViewModelFacade()
 {
     this._mediaHorizontalItemsViewModel = (IMediaHorizontalItemsViewModel) new ProfilePhotosViewModel();
     this._mediaVerticalItemsViewModel   = (IMediaVerticalItemsViewModel) new ProfileAudiosViewModel();
     this._mediaSectionsViewModel        = new ProfileMediaSectionsViewModel();
 }