Beispiel #1
0
 public void ShowArtwork(string artworkId, Action <IRenderer> onResponse)
 {
     CheckLogin(_login, onResponse, (account) =>
     {
         HubApi.GetArtwork(artworkId, (result) =>
         {
             _model.Active        = true;
             _model.ArtworkDetail = result;
             onResponse(new ArtworkDetailRenderer(_model));
         }, (error) =>
         {
             _model.ApiError = error;
             onResponse(new ApiErrorRenderer(_model));
         });
     });
 }
Beispiel #2
0
 public void ShowArtworks(Action <IRenderer> onResponse)
 {
     CheckLogin(_login, onResponse, (account) =>
     {
         _model.CurrentUser = account;
         _model.Active      = true;
         var user           = account.user_detail.user;
         HubApi.GetUsersArtworks(user, 10, (artworks, link) =>
         {
             _model.SetArtworks(artworks);
             _model.Next = link;
             onResponse(new ArtworksRenderer(_model));
         }, (error) =>
         {
             _model.ApiError = error;
             onResponse(new ApiErrorRenderer(_model));
         });
     });
 }
Beispiel #3
0
        private void GetAccountInfo(Action <IRenderer> onResponse, Action <Account> onLoggedIn)
        {
            if (_model.CurrentUser != null)
            {
                onLoggedIn(_model.CurrentUser.Value);
                return;
            }

            HubApi.GetAccount((account) =>
            {
                _model.CurrentUser = account;
                _model.Active      = false;
                onLoggedIn(account);
            }, (error) =>
            {
                _model.ApiError = error;
                onResponse(new ApiErrorRenderer(_model));
            });
        }
        private void TabRequest(CharacterModelsModel.Tab tab, Action <IRenderer> onResponse)
        {
            switch (tab)
            {
            case CharacterModelsModel.Tab.YOURS:
                HubApi.GetAccountCharacterModels(10, GetCharacterModelsCallback(onResponse), GetOnErrorCallback(onResponse));
                break;

            case CharacterModelsModel.Tab.LIKE:
                HubApi.GetHearts(10, GetCharacterModelsCallback(onResponse), GetOnErrorCallback(onResponse));
                break;

            case CharacterModelsModel.Tab.PICKUP:
                HubApi.GetStaffPicks(10, (staffPicksCharacterModel, link) =>
                {
                    var characterModels = staffPicksCharacterModel.Select((x) => x.character_model);
                    GetCharacterModelsCallback(onResponse)(characterModels.ToList(), link);
                }, GetOnErrorCallback(onResponse));
                break;

            default:
                break;
            }
        }