Esempio n. 1
0
        private async Task ExecuteShowDetailCommand(PostaladaElem message)
        {
            MessagesViewModel messagesViewModel = this;

            messagesViewModel._singleNavigation.DisableNavigation();
            int num = await messagesViewModel._navigationService.Navigate <MessageDetailViewModel, PostaladaElem>((M1)message, (IMvxBundle)null, new CancellationToken()) ? 1 : 0;
        }
 public void AddOrUpdate(Profile profile, PostaladaElem postaladaElem)
 {
     if (postaladaElem == null)
     {
         return;
     }
     postaladaElem.ProfileId = profile.Id;
     this._postaladaElemRepository.AddOrUpdate(postaladaElem);
 }
        public async Task ReadPostaladaElem(Profile profile, PostaladaElem postaladaElem)
        {
            TokenData tokenData = this._secureStore.GetTokenData(profile.Id);

            if (tokenData == null)
            {
                throw new UnauthorizedApiAccessException().SetErrorCode <UnauthorizedApiAccessException>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/Repository/DataServices/Uzenetek/PostaladaElemDataService.cs", 183);
            }
            int num = await this._eugyintezesApi.PostPostaladaElemElolvasvaAsync(profile, tokenData.AccessToken, postaladaElem.Uzenet.Azonosito) ? 1 : 0;
        }
        public PostaladaElem OverridePostaladaElem(
            Profile profile,
            PostaladaElem postaladaElem)
        {
            PostaladaElem postaladaElem1 = this._postaladaElemRepository.Find(postaladaElem.Azonosito.ToString());

            if (postaladaElem1 != null)
            {
                postaladaElem.Uzenet.Szoveg = postaladaElem1.Uzenet.Szoveg;
            }
            this.AddOrUpdate(profile, postaladaElem);
            return(postaladaElem);
        }
        private async Task NavigateToDetail(PushMessage pushMessage)
        {
            RootContentViewModel contentViewModel = this;

            contentViewModel.ChangeProfile(pushMessage);
            if (pushMessage.NotificationType != NotificationMessageType.Message)
            {
                return;
            }
            if (await contentViewModel._pushNotificationService.DownloadPostaladaElem(contentViewModel.ActiveProfile, pushMessage))
            {
                try
                {
                    if (pushMessage.ItemId == contentViewModel.lastMessageId)
                    {
                        return;
                    }
                    contentViewModel.lastMessageId = pushMessage.ItemId;
                    PostaladaElem postaladaElem = contentViewModel._uzenetDataService.GetPostaladaElem(pushMessage.ItemId);
                    contentViewModel._tryNavigateToDetailCounter = 0;
                    if (postaladaElem == null)
                    {
                        return;
                    }
                    int num = await contentViewModel._navigationService.Navigate <MessageDetailViewModel, PostaladaElem>((M1)postaladaElem, (IMvxBundle)null, new CancellationToken()) ? 1 : 0;
                }
                catch (Exception ex)
                {
                    Dialogs.ShowToast("RootContentPage_PushMessage_ItemNotFound");
                }
            }
            else
            {
                ++contentViewModel._tryNavigateToDetailCounter;
                if (contentViewModel._tryNavigateToDetailCounter <= 3)
                {
                    await Task.Delay(400);

                    await contentViewModel.NavigateToDetail(pushMessage);
                }
                else
                {
                    contentViewModel._tryNavigateToDetailCounter = 0;
                    await contentViewModel._modalDialog.DisplayAlertByResourceKeysAsync("PushNotification_CannotOpen_Text", "Common_Alert_Title");
                }
            }
        }
        public IEnumerable <PostaladaElem> OverridePostaladaElemek(
            Profile profile,
            IEnumerable <PostaladaElem> newPostaladaElemek)
        {
            IEnumerable <PostaladaElem> postaladaElemek = this._postaladaElemRepository.Query((ISpecification) new PostaladaElemekByProfileSpecification(profile.Id));

            newPostaladaElemek = newPostaladaElemek.Where <PostaladaElem>((Func <PostaladaElem, bool>)(x => x.Tipus.Azonosito == PostaladaElemTipus.BEERKEZETT.Azonosito)).Select <PostaladaElem, PostaladaElem>((Func <PostaladaElem, PostaladaElem>)(x =>
            {
                PostaladaElem postaladaElem = postaladaElemek.FirstOrDefault <PostaladaElem>((Func <PostaladaElem, bool>)(y => x.Azonosito == y.Azonosito));
                if (postaladaElem != null && postaladaElem.Uzenet != null)
                {
                    x.Uzenet.Szoveg = postaladaElem.Uzenet.Szoveg;
                }
                return(x);
            }));
            this.AddOrUpdate(profile, newPostaladaElemek);
            return(newPostaladaElemek);
        }
        public async Task <bool> DownloadPostaladaElem(Profile profile, Ekreta.Mobile.Core.Models.PushNotification.PushMessage pushMessage)
        {
            try
            {
                PostaladaElem uzenet = await this._uzenetDataService.FetchPostaladaElem(profile, (long)pushMessage.ItemId);

                if (uzenet != null)
                {
                    this._uzenetDataService.OverridePostaladaElem(profile, uzenet);
                    return(true);
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.Current.HandleError(ex);
            }
            return(false);
        }