Exemplo n.º 1
0
        private void Service_PollingStepGetResultsCompleted(object sender, PollingStepGetResultsCompletedEventArgs e)
        {
            LOLMessageClient service = (LOLMessageClient)sender;
            service.PollingStepGetResultsCompleted -= Service_PollingStepGetResultsCompleted;

            if (e.Error == null)
            {
                LOLMessageSurveyResult pollResult;
                RunOnUiThread(() => doner.Visibility = ViewStates.Visible);

                doner.Click += delegate
                {
                    RunOnUiThread(() => restartTimerFromPoll());
                };

                if (MessagePollUtil.isPhoto)
                {
                    RunOnUiThread(() => voteTL.Visibility = voteTR.Visibility = voteBL.Visibility = voteBR.Visibility = ViewStates.Visible);
                    MessagePlaybackUtil.pollResults.TryGetValue(0, out pollResult);
                    RunOnUiThread(() => voteTL.Progress = (int)(pollResult.Answer1Percent * 100));
            #if DEBUG
                    System.Diagnostics.Debug.WriteLine("voteTL = {0}, raw = {1}, count = {2}, replied = {3}", voteTL.Progress, pollResult.Answer1Percent, pollResult.Answer1Count, pollResult.Responses);
            #endif
                    MessagePlaybackUtil.pollResults.TryGetValue(1, out pollResult);
                    RunOnUiThread(() => voteTR.Progress = (int)(pollResult.Answer2Percent * 100));
            #if DEBUG
                    System.Diagnostics.Debug.WriteLine("voteTR = {0}, raw = {1}", voteTR.Progress, pollResult.Answer2Percent);
            #endif
                    MessagePlaybackUtil.pollResults.TryGetValue(2, out pollResult);
                    RunOnUiThread(() => voteBL.Progress = (int)(pollResult.Answer3Percent * 100));
            #if DEBUG
                    System.Diagnostics.Debug.WriteLine("voteBL = {0}, raw = {1}", voteBL.Progress, pollResult.Answer3Percent);
            #endif
                    MessagePlaybackUtil.pollResults.TryGetValue(3, out pollResult);
                    RunOnUiThread(() => voteBR.Progress = (int)(pollResult.Answer4Percent * 100));
            #if DEBUG
                    System.Diagnostics.Debug.WriteLine("voteBR = {0}, raw = {1}", voteBR.Progress, pollResult.Answer4Percent);
            #endif
                } else
                {
                    RunOnUiThread(() => res1.Visibility = res2.Visibility = res3.Visibility = res4.Visibility = ViewStates.Visible);
                    MessagePlaybackUtil.pollResults.TryGetValue(0, out pollResult);
                    RunOnUiThread(() => res1.Progress = (int)(pollResult.Answer1Percent * 100));
                    MessagePlaybackUtil.pollResults.TryGetValue(1, out pollResult);
                    RunOnUiThread(() => res2.Progress = (int)(pollResult.Answer2Percent * 100));
                    MessagePlaybackUtil.pollResults.TryGetValue(2, out pollResult);
                    RunOnUiThread(() => res3.Progress = (int)(pollResult.Answer3Percent * 100));
                    MessagePlaybackUtil.pollResults.TryGetValue(3, out pollResult);
                    RunOnUiThread(() => res4.Progress = (int)(pollResult.Answer4Percent * 100));
                }
            }
        }
 private void Service_PollingStepGetResultsCompleted(object sender, PollingStepGetResultsCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         if (MessagePollUtil.isPhoto == true)
         {
             RunOnUiThread(delegate
             {
                 voteTL.Visibility = voteTR.Visibility = voteBL.Visibility = voteBR.Visibility = ViewStates.Visible;
                 voteTL.Progress = (int)(e.Result.Answer1Percent * 100);
                 voteTR.Progress = (int)(e.Result.Answer2Percent * 100);
                 voteBL.Progress = (int)(e.Result.Answer3Percent * 100);
                 voteBR.Progress = (int)(e.Result.Answer4Percent * 100);
             });
         } else
         {
             RunOnUiThread(delegate
             {
                 res1.Visibility = res2.Visibility = res3.Visibility = res4.Visibility = ViewStates.Visible;
                 res1.Progress = (int)(e.Result.Answer1Percent * 100);
                 res2.Progress = (int)(e.Result.Answer2Percent * 100);
                 res3.Progress = (int)(e.Result.Answer3Percent * 100);
                 res4.Progress = (int)(e.Result.Answer4Percent * 100);
             });
         }
     }
 }