예제 #1
0
        private void LoadData()
        {
            this.ProgressBarVisibility = true;

            if (m_network.isNetworkAvailable == true)
            {
                foreach (VotingFull vote in MySession.Votes)
                {
                    this.ProgressBarVisibility = true;
                    m_picaflorService.GetVoteFullByUri(
                        vote.ResourceUri,
                        (votingFull) =>
                    {
                        this.Votes.Add(votingFull);

                        this.VotesShowed = new ObservableCollection <VotingFull>(m_votes);
                        RaisePropertyChanged(() => this.VotesShowed);

                        this.ProgressBarVisibility = false;
                    },
                        (error) =>
                    {
                        this.MessageText = AppResources.ConectError;
                    });
                }
            }
        }
        private void LastVotation()
        {
            this.ProgressBarVisibility = true;

            if (m_network.isNetworkAvailable == true)
            {
                m_picaFlorService.GetSessions(0, 1, true,
                                              (sessions) =>
                {
                    var lastSession = sessions.FirstOrDefault();

                    if (lastSession != null)
                    {
                        foreach (VotingFull vote in lastSession.Votes)
                        {
                            m_picaFlorService.GetVoteFullByUri(vote.ResourceUri,
                                                               (votingFull) =>
                            {
                                var voteObj      = votingFull.Votes.Where(x => x.MemberId == m_thisParlamentary.Id).FirstOrDefault();
                                string voteValue = string.Empty;

                                if (voteObj != null)
                                {
                                    voteValue = voteObj.VoteValue;
                                }

                                this.Votes.Add(new ParlamentaryVote()
                                {
                                    Title       = votingFull.Title,
                                    Vote        = voteValue,
                                    Description = votingFull.RecordText
                                });

                                this.VotesShowed           = new ObservableCollection <ParlamentaryVote>(m_votes);
                                this.ProgressBarVisibility = false;
                            },
                                                               GenericError);
                        }
                    }
                },
                                              GenericError);
            }
            else
            {
                this.MessageText = AppResources.NoNetworkData;
            }
        }