Ejemplo n.º 1
0
        private async Task GetRequiredRecord()
        {
            IsRefreshing = true;
            var agentContext = await _agentProvider.GetContextAsync();

            //ISearchQuery credentialsQuery = ListOffersAsync
            var listCredentials = await _credentialService.ListOffersAsync(agentContext);

            var listProofRequests = await _proofService.ListRequestedAsync(agentContext);

            IList <NotificationItem> notificationItemList = new List <NotificationItem>();

            //old version of notification
            //IList<CredOfferViewModel> credOfferViewModels = new List<CredOfferViewModel>();
            foreach (var item in listCredentials)
            {
                CredOfferViewModel credOfferViewModel = _scope.Resolve <CredOfferViewModel>(new NamedParameter("credentialOffer", item));
                NotificationItem   notificationItem   = new NotificationItem()
                {
                    NotificationType    = "Credential Offer",
                    NotificationTitle   = credOfferViewModel.CredentialName,
                    NotificationContent = "You've received a credentital offer.",
                    ItemViewModel       = credOfferViewModel,
                    IssuedDate          = credOfferViewModel.IssuedDate
                };

                var connection = await _connectionService.GetAsync(agentContext, item.ConnectionId);

                notificationItem.OrganizeAlias = connection.Alias;

                //old version of notification
                //credOfferViewModels.Add(credOfferViewModel);
                notificationItemList.Add(notificationItem);
            }

            //old version of notification
            //IList<ProofRequestViewModel> proofRequestViewModels = new List<ProofRequestViewModel>();
            foreach (var item in listProofRequests)
            {
                ProofRequestViewModel proofRequestVm   = _scope.Resolve <ProofRequestViewModel>(new NamedParameter("proofRequestRecord", item));
                NotificationItem      notificationItem = new NotificationItem()
                {
                    NotificationType    = "Proof Request",
                    NotificationTitle   = proofRequestVm.ProofRequestObject.Name,
                    NotificationContent = "You've received a request for proof of credential.",
                    ItemViewModel       = proofRequestVm,
                    IssuedDate          = proofRequestVm.IssuedDate
                };

                var connection = await _connectionService.GetAsync(agentContext, item.ConnectionId);

                notificationItem.OrganizeAlias = connection.Alias;

                //old version of notification
                //proofRequestViewModels.Add(proofRequestVm);
                notificationItemList.Add(notificationItem);
            }
            //old version of notification
            //_proofRequestVms.Clear();
            //_proofRequestVms.InsertRange(proofRequestViewModels);

            //_credentialOfferVms.Clear();
            //_credentialOfferVms.InsertRange(credOfferViewModels);
            //--end old version of notification
            var orderList = notificationItemList.OrderBy(item => item.IssuedDate);

            NotificationItems.Clear();
            NotificationItems.InsertRange(orderList);
            IsRefreshing = false;
        }
Ejemplo n.º 2
0
 public async Task NavigateToProofRequestPage(ProofRequestViewModel proofRequestViewModel)
 {
     await NavigationService.NavigateToAsync <ProofRequestViewModel>(proofRequestViewModel);
 }