예제 #1
0
        void gridTooltipController_BeforeShow(object sender, ToolTipControllerShowEventArgs e)
        {
            ListVoteResults lr = e.SelectedObject as ListVoteResults;

            if (lr == null)
            {
                return;
            }
            SuperToolTip superTip = new SuperToolTip()
            {
                MaxWidth = 350, AllowHtmlText = DefaultBoolean.True
            };

            e.AutoHide    = false;
            e.ToolTipType = ToolTipType.SuperTip;
            e.Show        = false;
            if (IsCountyMode && !string.IsNullOrEmpty(lr.CountyFIPS))
            {
                e.Show = GenerateCountyToolTip(CountyInfo.GetCounty(lr.CountyFIPS), superTip);
            }

            if (!IsCountyMode)
            {
                e.Show = GenerateStateToolTip(StateInfo.GetState(lr.State), superTip);
            }

            e.SuperTip = superTip;
        }
예제 #2
0
 CountyVote GetCountyVoteInfo(CountyInfo county)
 {
     if (county == null || electionData == null)
     {
         return(null);
     }
     return(electionData.Votes.Where(n => n.HasCountyVotes).SelectMany(q => q.CountyVotes).FirstOrDefault(x => x.FIPS == county.FIPS));
 }
        public CountyInfo CountyFromMapAttribute(MapItemAttributeCollection attributes)
        {
            if (attributes == null)
            {
                return(null);
            }
            var countyAttr = attributes["GEOID"];

            if (countyAttr != null)
            {
                return(CountyInfo.GetCounty((countyAttr.Value ?? "").ToString()));
            }
            return(null);
        }
예제 #4
0
        bool GenerateCountyToolTip(CountyInfo county, SuperToolTip superTip)
        {
            var voteInfo = GetCountyVoteInfo(county);

            if (county == null)
            {
                return(false);
            }
            if (voteInfo == null)
            {
                voteInfo = new CountyVote()
                {
                    Votes = new List <CandidateVote>()
                };                                                                 //generating empty tooltip
            }
            return(GenerateVoteToolTipCore(superTip, county.CountyName, voteInfo.Votes, voteInfo.TotalVotesCount, false));
        }