示例#1
0
		public void ViewPoll(IPollSearchResult poll)
		{
			if (poll == null)
			{
				throw new ArgumentNullException("poll");
			}

			var criteria = new ViewPollPageNavigationCriteria
			{
				PollId = poll.Id
			};

			this.Navigation.NavigateToViewModel<ViewPollPageViewModel>(criteria);
		}
示例#2
0
 public PollSearchResultViewModel(IPollSearchResult searchResult
                                  , IObjectFactory <IPollSubmissionCommand> objectFactory)
 {
     this.pollSearchResult = searchResult;
     this.objectFactory    = objectFactory;
 }
		public PollSearchResultViewModel(IPollSearchResult searchResult
			, IObjectFactory<IPollSubmissionCommand> objectFactory)
		{
			this.pollSearchResult = searchResult;
			this.objectFactory = objectFactory;
		}
示例#4
0
        public async void ViewAnswer(IPollSearchResult poll)
        {
            if (poll == null)
            {
                throw new ArgumentNullException("poll");
            }

            ViewPollFragment votePollFragment = (ViewPollFragment)
				FragmentManager.FindFragmentById(Resource.Id.fragmentContainer);

            if (votePollFragment == null)
            {
                var results = await this.LoadPollAsync(poll);

                votePollFragment = new ViewPollFragment(){
                    NavigationCriteria = new ViewPollPageNavigationCriteria(){
                        PollId = poll.Id
                    },
                    Results = results
                };
               

                ((ViewPollFragment)votePollFragment).ClosePressed += (sender, e) => 
                {
                    var removeTransaction = FragmentManager.BeginTransaction();
                    removeTransaction.Remove((Fragment)sender);
                    removeTransaction.Commit();
                };

                ((ViewPollFragment)votePollFragment).DeletePressed += async (sender, e) => 
                {
                    var removeTransaction = FragmentManager.BeginTransaction();
                    removeTransaction.Remove((Fragment)sender);
                    removeTransaction.Commit();
                    await this.SearchPollsAsync();
                };


				FragmentTransaction ft = FragmentManager.BeginTransaction();
                ft.SetCustomAnimations(Resource.Animation.slide_in_right, Resource.Animation.slide_out_right);

				ft.Replace(Resource.Id.polls_layout, votePollFragment);
                ft.Commit();
            }
        }
示例#5
0
		public void ViewPoll(IPollSearchResult poll)
		{
			if (poll == null)
			{
				throw new ArgumentNullException("poll");
			}

			AnswerPollFragment votePollFragment = (AnswerPollFragment)
				FragmentManager.FindFragmentById(Resource.Id.fragmentContainer);

            if (votePollFragment == null)
            {
                votePollFragment = new AnswerPollFragment(){
                    NavigationCriteria = new ViewPollPageNavigationCriteria(){
                        PollId = poll.Id
                    }
                };

                ((AnswerPollFragment)votePollFragment).PollAlreadyVoted += (sender, e) => this.ViewAnswer(poll);
                ((AnswerPollFragment)votePollFragment).ClosePressed += (sender, e) => 
                {
                    var removeTransaction = FragmentManager.BeginTransaction();
                    removeTransaction.Remove((Fragment)sender);
                    removeTransaction.Commit();
                };


                FragmentTransaction ft = FragmentManager.BeginTransaction();
                ft.SetTransition(FragmentTransit.FragmentOpen);
                ft.SetCustomAnimations(Resource.Animation.slide_in_right, Resource.Animation.slide_out_right, Resource.Animation.slide_in_right, Resource.Animation.slide_out_right);

				ft.Add(Resource.Id.polls_layout, votePollFragment);
                ft.Commit();
            }
		}
示例#6
0
		public async Task<IPollDataResults> LoadPollAsync(IPollSearchResult poll)
        {
            setDialogMessage("Retrieving poll search results...");

            this.IsBusy = true;

			Task<IPollDataResults> pollResults = null;
            var hasError = false;
            try
            {
                 pollResults = this.ResultsFactory.FetchAsync(poll.Id);
            }
            catch (DataPortalException ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
                hasError = true;
            }
            this.IsBusy = false;

            if (hasError)
            {
                this.MessageBox.Show(this ,"There was an error loading the poll results. Please try again.", "Error");
            }
            return await pollResults;
        }