示例#1
0
 private void HandleDecksTypeMessage(DecksType decksType)
 {
     IsDeckSelected = false;
     IsMyDeck       = false;
     IsNoDecks      = false;
     _decksType     = decksType;
     DecksCollection.Clear();
     SearchMessageVisibility = false;
     InitializeDecksCollection();
     _statisticsService.InitializeFiles();
 }
示例#2
0
 private void HandleReloadMessage(bool reload)
 {
     if (reload)
     {
         IsDeckSelected = false;
         DecksCollection.Clear();
         SearchMessageVisibility = false;
         IsNoDecks = false;
         InitializeDecksCollection();
     }
 }
示例#3
0
        private async void HandleSearchMessage(string searchingContent)
        {
            IsNoDecks      = false;
            IsDeckSelected = false;
            if (await CheckInternetConnection())
            {
                List <Deck> searchList;
                DecksCollection.Clear();
                _favouriteDecks.Clear();

                SearchMessageVisibility = false;
                IsDataLoading           = true;
                try
                {
                    if (_accountService.IsUserLoggedIn())
                    {
                        searchList = await _restService.GetAllDecks(true, false, true, searchingContent);

                        IsUser = true;
                    }
                    else
                    {
                        searchList = await _restService.GetAllDecks(false, false, true, searchingContent);

                        IsUser = false;
                    }
                    if (searchList != null && searchList.Count > 0)
                    {
                        searchList.Sort((x, y) => DateTime.Compare(y.CreationDate, x.CreationDate));
                        searchList.ForEach(x => DecksCollection.Add(x));
                        if (IsUser)
                        {
                            _favouriteDecks = _favouriteService.GetFavouriteDecks();
                            CheckIfDeckIsFavourite();
                        }

                        IsDataLoading = false;
                    }
                }
                catch (Exception ex)
                {
                    Messenger.Default.Send <MessageToMessageBoxControl>(new MessageToMessageBoxControl(true, false, true, false, ex.Message));
                }
                finally
                {
                    IsDataLoading = false;
                    if (DecksCollection != null && DecksCollection.Count == 0)
                    {
                        SearchMessageVisibility = true;
                    }
                }
            }
        }