Ejemplo n.º 1
0
        public async Task CandidatureGroupPikerSelect()
        {
            try
            {
                await Navigation.PushPopupAsync(new LoadPopup());

                string postData = "CandidatureId=" + CandidatureId;
                var    result   = await CommonLib.CandidatureGroupChart(CommonLib.ws_MainUrlMain + "CandidatureApi/CandidatureVoteGroup?" + postData);

                if (result != null && result.Status != 0)
                {
                    if (result.chartData.Time == null)
                    {
                        CandidatureGroupLabel.IsVisible = true;
                        CandidatureGroupGraph.IsVisible = false;
                    }
                    else
                    {
                        CandidatureGroupLabel.IsVisible = false;
                        CandidatureGroupGraph.IsVisible = true;
                    }

                    CandidatureGroupTime = result.chartData.Time;
                    _voteGroupModel.Clear();


                    foreach (var item in result.chartData.voteGroup)
                    {
                        _voteGroupModel.Add(new GroupChart {
                            backgroundColor = item.color, label = item.sex, data = item.per
                        });
                    }

                    var GroupchartConfigScript1 = GetGroupChartScript();
                    var htmlGroup = GetHtmlWithGroupChartConfig(GroupchartConfigScript1);
                    CandidatureGroup.Html = htmlGroup;

                    LoadPopup.CloseAllPopup1();
                }


                else
                {
                    VoteAlertPopup.textmsg = result.msg;
                    await App.Current.MainPage.Navigation.PushPopupAsync(new VoteAlertPopup());

                    LoadPopup.CloseAllPopup1();
                }
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("", ex.Message, "OK");

                LoadPopup.CloseAllPopup1();
            }
        }