Exemplo n.º 1
0
        void gridView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            var lr = gridView.GetFocusedRow() as ListVoteResults;

            if (lr == null)
            {
                return;
            }
            if (IsCountyMode)
            {
                if (usCountyInfo.Layer == null)
                {
                    return;
                }
                var countyItem = usCountyInfo.VisibleItems.FirstOrDefault(q => (colorizer.CountyFromMapAttribute(q.Attributes) ?? new CountyInfo("")).FIPS == lr.CountyFIPS);
                usCountyInfo.Layer.SelectedItem = countyItem;
            }
            else
            {
                var stateItem = usStateInfo.VisibleItems.FirstOrDefault(q => (colorizer.StateFromMapAttribute(q.Attributes) ?? new StateInfo("")).State == lr.State);
                stateLayer.SelectedItem = stateItem;
            }
            if (MouseEventSourceInfo.IsTouchEvent())
            {
                gridTooltipController.ShowHint(new ToolTipControlInfo(lr, "text")
                {
                    ForcedShow       = DefaultBoolean.True,
                    ImmediateToolTip = true,
                    ToolTipLocation  = ToolTipLocation.TopCenter
                });
            }
        }
Exemplo n.º 2
0
        void mapControl_MapItemClick(object sender, MapItemClickEventArgs e)
        {
            //if(IsCountyMode) return;//as for now
            bool showHintOnClick = false;

            if (MouseEventSourceInfo.IsTouchEvent() && e.MouseArgs.Clicks == 1)
            {
                if (Environment.TickCount - lastClickTime > 200)
                {
                    lastClickTime   = Environment.TickCount;
                    showHintOnClick = true;
                    if (IsCountyMode && StateFromMapAttribute(e.Item.Attributes) != null)
                    {
                        showHintOnClick = false;
                    }
                }
            }
            if (showHintOnClick)
            {
                mapTooltipController.ShowHint(new ToolTipControlInfo(e.Item, "text")
                {
                    ImmediateToolTip = true,
                    ForcedShow       = DefaultBoolean.True,
                    ToolTipLocation  = ToolTipLocation.TopCenter,
                    ToolTipPosition  = Point.Subtract(mapControl.PointToScreen(e.MouseArgs.Location), new Size(0, 60))
                });
                e.Handled = true;
                return;
            }

            var state = StateFromMapAttribute(e.Item.Attributes);

            if (state != null)
            {
                if (IsElectionPlaygroundMode) // e.MouseArgs.Button == MouseButtons.Right) {
                {
                    SwitchStateVote(state);
                    return;
                }
                ShowCountyMap(state);
            }
        }