コード例 #1
0
ファイル: AnimeListItem.cs プロジェクト: tingzhou85/MALClient
        protected override void BindModelFull()
        {
            if ((string)AnimeListItemImage.Tag != ViewModel.ImgUrl)
            {
                AnimeListItemImage.AnimeInto(ViewModel.ImgUrl, AnimeListItemImgPlaceholder);
            }
            else
            {
                AnimeListItemImage.Visibility = ViewStates.Visible;
            }



            if (ViewModel.Auth)
            {
                AnimeListItemWatchedButton.Clickable = true;
                AnimeListItemWatchedButton.Focusable = true;
                AnimeListItemWatchedButton.SetCommand("Click", new RelayCommand(ShowWatchedDialog));
            }
            else
            {
                AnimeListItemWatchedButton.Clickable = false;
                AnimeListItemWatchedButton.Focusable = false;
            }


            ViewModel.AnimeItemDisplayContext = ViewModelLocator.AnimeList.AnimeItemsDisplayContext;

            ViewModel.PropertyChanged += ViewModelOnPropertyChanged;
        }
コード例 #2
0
        protected override void InitBindings()
        {
            if (Fling)
            {
                return;
            }

            Bindings.Add(AnimeListItemWatchedButton.Id, new List <Binding>());
            Bindings[AnimeListItemWatchedButton.Id].Add(new Binding <string, string>(
                                                            ViewModel,
                                                            () => ViewModel.MyEpisodesBind,
                                                            AnimeListItemWatchedButton,
                                                            () => AnimeListItemWatchedButton.Text));

            Bindings.Add(AnimeListItemScoreButton.Id, new List <Binding>());
            Bindings[AnimeListItemScoreButton.Id].Add(new Binding <string, string>(
                                                          ViewModel,
                                                          () => ViewModel.MyScoreBind,
                                                          AnimeListItemScoreButton,
                                                          () => AnimeListItemScoreButton.Text));

            Bindings.Add(AnimeListItemStatusButton.Id, new List <Binding>());
            Bindings[AnimeListItemStatusButton.Id].Add(new Binding <string, string>(
                                                           ViewModel,
                                                           () => ViewModel.MyStatusBind,
                                                           AnimeListItemStatusButton,
                                                           () => AnimeListItemStatusButton.Text));

            Bindings.Add(AnimeListItemIncButton.Id, new List <Binding>());
            Bindings[AnimeListItemIncButton.Id].Add(new Binding <bool, ViewStates>(
                                                        ViewModel,
                                                        () => ViewModel.IncrementEpsVisibility,
                                                        AnimeListItemIncButton,
                                                        () => AnimeListItemIncButton.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));

            Bindings.Add(AnimeListItemDecButton.Id, new List <Binding>());
            Bindings[AnimeListItemDecButton.Id].Add(new Binding <bool, ViewStates>(
                                                        ViewModel,
                                                        () => ViewModel.DecrementEpsVisibility,
                                                        AnimeListItemDecButton,
                                                        () => AnimeListItemDecButton.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));

            Bindings.Add(AnimeListItemStatusScoreSection.Id, new List <Binding>());
            Bindings[AnimeListItemStatusScoreSection.Id].Add(new Binding <bool, ViewStates>(
                                                                 ViewModel,
                                                                 () => ViewModel.Auth,
                                                                 AnimeListItemStatusScoreSection,
                                                                 () => AnimeListItemStatusScoreSection.Visibility).ConvertSourceToTarget(Converters.BoolToVisibility));



            AnimeListItemMoreButton.SetOnClickListener(new OnClickListener(view => AnimeListItemMoreButtonOnClick()));
            AnimeListItemWatchedButton.SetCommand("Click", new RelayCommand(ShowWatchedDialog));
            AnimeListItemStatusButton.SetCommand("Click", new RelayCommand(ShowStatusDialog));
            AnimeListItemScoreButton.SetCommand("Click", new RelayCommand(ShowRatingDialog));

            AnimeListItemIncButton.SetCommand("Click", ViewModel.IncrementWatchedCommand);
            AnimeListItemDecButton.SetCommand("Click", ViewModel.DecrementWatchedCommand);
        }