示例#1
0
 //manga
 public AnimeItemViewModel(bool auth, string name, string img, int id, int myStatus, int myEps, int allEps,
                           int myScore, string startDate, string endDate,
                           AnimeItemAbstraction parent, bool setEpsAuth, int myVolumes, int allVolumes)
     : this(auth, name, img, id, myStatus, myEps, allEps, myScore, startDate, endDate, parent, setEpsAuth)
 {
     AllVolumes = allVolumes;
 }
        public async Task AddToMyListAsync()
        {
            if (_adding)
            {
                return;
            }
            _adding = true;

            var response = await new AnimeAddQuery(OtherEntry.Id.ToString()).GetRequestResponse();

            if (response != "Created")
            {
                return;
            }

            var vm = new AnimeItemAbstraction(true, new AnimeLibraryItemData(OtherEntry.ParentAbstraction.EntryData));

            var startDate = "0000-00-00";

            if (Settings.SetStartDateOnListAdd)
            {
                startDate = DateTimeOffset.Now.ToString("yyyy-MM-dd");
            }
            vm.MyStartDate = startDate;
            vm.MyStatus    = Settings.DefaultStatusAfterAdding;

            MyEntry = vm.ViewModel;
            ResourceLocator.AnimeLibraryDataStorage.AddAnimeEntry(vm);

            IsComparisonValid = true;
            RaisePropertyChanged(() => MyEntry);

            _adding = false;
        }
示例#3
0
 public AnimeItemViewModel(bool auth, string name, string img, int id, int myStatus, int myEps, int allEps,
                           int myScore, string startDate, string endDate,
                           AnimeItemAbstraction parent, bool setEpsAuth = false) : this(img, id, parent)
     //We are loading an item that IS on the list
 {
     //Assign fields
     Id           = id;
     _allEpisodes = allEps;
     Auth         = auth;
     //Assign properties
     MyScore            = myScore;
     MyStatus           = myStatus;
     Title              = name;
     MyEpisodes         = myEps;
     ShowMoreVisibility = Visibility.Collapsed;
     StartDate          = startDate;
     EndDate            = endDate;
     //We are not seasonal so it's already on list
     AddToListVisibility = Visibility.Collapsed;
     SetAuthStatus(auth, setEpsAuth);
     AdjustIncrementButtonsVisibility();
     //There may be additional data available
     GlobalScore = ParentAbstraction.GlobalScore;
     Airing      = ParentAbstraction.AirDay >= 0;
 }
示例#4
0
 public void AddAnimeEntry(AnimeItemAbstraction parentAbstraction)
 {
     if (parentAbstraction.RepresentsAnime)
     {
         AllLoadedAuthAnimeItems.Add(parentAbstraction);
     }
     else
     {
         AllLoadedAuthMangaItems.Add(parentAbstraction);
     }
 }
示例#5
0
 private AnimeItemViewModel(string img, int id, AnimeItemAbstraction parent)
 {
     ParentAbstraction = parent;
     ImgUrl            = img;
     Id = id;
     if (!ParentAbstraction.RepresentsAnime)
     {
         UpdateEpsUpperLabel = "Read chapters:";
         Status1Label        = "Reading";
         Status5Label        = "Plan to read";
     }
 }
示例#6
0
        public void RemoveAnimeEntry(AnimeItemAbstraction parentAbstraction)
        {
            if (parentAbstraction.RepresentsAnime)
            {
                AllLoadedAuthAnimeItems.Remove(parentAbstraction);
            }
            else
            {
                AllLoadedAuthMangaItems.Remove(parentAbstraction);
            }

            AnimeRemoved?.Invoke(parentAbstraction);
        }
示例#7
0
        public AnimeItemViewModel(SeasonalAnimeData data,
                                  AnimeItemAbstraction parent) : this(data.ImgUrl, data.Id, parent)
            //We are loading an item that is NOT on the list and is seasonal
        {
            _seasonalState = true;

            Title       = data.Title;
            MyScore     = 0;
            MyStatus    = (int)AnimeStatus.AllOrAiring;
            GlobalScore = data.Score;
            int.TryParse(data.Episodes, out _allEpisodes);
            Airing = ParentAbstraction.AirDay >= 0;
            SetAuthStatus(false, true);
            AdjustIncrementButtonsVisibility();
            ShowMoreVisibility = Visibility.Collapsed;
        }
示例#8
0
        public void RemoveAnimeEntry(AnimeItemAbstraction parentAbstraction)
        {
            try
            {
                AnimeItems.Remove(parentAbstraction.ViewModel);
            }
            catch (Exception)
            {
                //
            }


            if (_allLoadedAuthAnimeItems.Count > 0)
            {
                if (parentAbstraction.RepresentsAnime)
                    _allLoadedAuthAnimeItems.Remove(parentAbstraction);
                else
                    _allLoadedAuthMangaItems.Remove(parentAbstraction);
            }
        }
示例#9
0
 public void AddAnimeEntry(AnimeItemAbstraction parentAbstraction)
 {
     if (_allLoadedAuthAnimeItems.Count > 0)
     {
         if (parentAbstraction.RepresentsAnime)
             _allLoadedAuthAnimeItems.Add(parentAbstraction);
         else
             _allLoadedAuthMangaItems.Add(parentAbstraction);
     }
 }