Exemplo n.º 1
0
        private void UpdateHighlightState(FilledFragment fragment, bool highlighted)
        {
            var res  = App.Current.Res;
            var flow = Chunk.Flow;

            var selLayer  = fragment.View.SelectionLayer;
            var highlight = selLayer.HighlightFragment;

            if (highlighted)
            {
                selLayer.CurrentlyHighlightedFragment = fragment;
                highlight.Polgyons = fragment.Polgyons;

                if (flow == TrafficFlow.Inbound)
                {
                    highlight.Brush = res.InboundSelectedFlowBrush;
                    highlight.Pen   = res.InboundFlowPen;
                }
                if (flow == TrafficFlow.Outbound)
                {
                    highlight.Brush = res.OutboundSelectedFlowBrush;
                    highlight.Pen   = res.OutboundFlowPen;
                }
            }
            else
            {
                if (selLayer.CurrentlyHighlightedFragment == fragment)
                {
                    selLayer.CurrentlyHighlightedFragment = null;
                    highlight.Polgyons = null;
                }
            }

            selLayer.ArrangeViewport();
        }
Exemplo n.º 2
0
        private void CreateBackgroundFragment(Point start, Point end, double snappedWidth)
        {
            if (Chunk.Flow != TrafficFlow.Undefined)
            {
                var fragment = new FilledFragment(start, end, ViewContent.LineHeight, snappedWidth)
                {
                    Source = this
                };

                fragment.MouseEnter = () => UpdateHighlightState(fragment, true);
                fragment.MouseLeave = () => UpdateHighlightState(fragment, false);

                if (Chunk.Flow == TrafficFlow.Inbound)
                {
                    fragment.Brush = App.Current.Res.InboundFlowBrush;
                }
                if (Chunk.Flow == TrafficFlow.Outbound)
                {
                    fragment.Brush = App.Current.Res.OutboundFlowBrush;
                }

                ViewContent.BackgroundLayer.Add(fragment);
            }
        }