Beispiel #1
0
        void chartRotator_PreviewDragEnter(object sender, DragEventArgs e)
        {
            IdentityMine.Avalon.Controls.ChartRotator cr = sender as IdentityMine.Avalon.Controls.ChartRotator;
            if (cr == null)
            {
                return;
            }

            // Since Enter\Leave event are fired when the mouse moves over embedded controls, we only want to create an overlay if the mouse was outside the element before the enter event is fired.
            if (_dragEnter == false)
            {
                XmlElement xe    = (XmlElement)e.Data.GetData("XmlElement");
                Brush      brush = chartsManager.GetChartBrush(xe.InnerText);

                _overlayElement = new RectangleBrushAdorner(cr, brush);
                AdornerLayer layer = AdornerLayer.GetAdornerLayer(cr);
                layer.Add(_overlayElement);

                Point _currentPosition = e.GetPosition(cr);
                _overlayElement.LeftOffset = _currentPosition.X;
                _overlayElement.TopOffset  = _currentPosition.Y;

                _dragEnter = true;
            }

            e.Handled = true;
        }
Beispiel #2
0
        private static void IsViewport3DInvalidated(DependencyObject target, DependencyPropertyChangedEventArgs e)
        {
            Viewport3D viewport3D = target as Viewport3D;

            if ((viewport3D != null) && ChartRotator.GetIsViewport3D(viewport3D))
            {
                ChartRotator parent = viewport3D.TemplatedParent as ChartRotator;
                if (parent != null)
                {
                    parent._viewport3D = viewport3D;
                }
            }
        }
Beispiel #3
0
        void chartRotator_PreviewDragOver(object sender, DragEventArgs e)
        {
            IdentityMine.Avalon.Controls.ChartRotator cr = sender as IdentityMine.Avalon.Controls.ChartRotator;
            if (cr == null)
            {
                return;
            }

            Point _currentPosition = e.GetPosition(cr);

            _overlayElement.LeftOffset = _currentPosition.X;
            _overlayElement.TopOffset  = _currentPosition.Y;

            e.Handled = true;
        }
Beispiel #4
0
        public void Load()
        {
            if (baseFrameworkElement == null)
            {
                return;
            }

            ControlTemplate ct;
            ContentControl  cc;

            ct = (ControlTemplate)baseFrameworkElement.FindResource("PatientDetailWorkspaceTemplate");
            cc = (ContentControl)baseFrameworkElement.FindName("PatientDetailWorkspaceContent");
            IdentityMine.Avalon.Controls.ChartRotator chartRotator = (IdentityMine.Avalon.Controls.ChartRotator)ct.FindName("ChartRotator3D", cc);

            chartRotator.Drop             += new DragEventHandler(chartRotator_Drop);
            chartRotator.PreviewDragEnter += new DragEventHandler(chartRotator_PreviewDragEnter);
            chartRotator.PreviewDragOver  += new DragEventHandler(chartRotator_PreviewDragOver);
            chartRotator.PreviewDragLeave += new DragEventHandler(chartRotator_PreviewDragLeave);
        }
Beispiel #5
0
        void chartRotator_Drop(object sender, DragEventArgs e)
        {
            IdentityMine.Avalon.Controls.ChartRotator cr = sender as IdentityMine.Avalon.Controls.ChartRotator;
            if (cr == null)
            {
                return;
            }

            _overlayElement.ClearAnimations();
            AdornerLayer.GetAdornerLayer(cr).Remove(_overlayElement);
            _overlayElement = null;
            _dragEnter      = false;

            XmlElement xe = (XmlElement)e.Data.GetData("XmlElement");

            if (xe == null)
            {
                return;
            }

            Brush vb = chartsManager.GetChartBrush(xe.InnerText);

            cr.AddVisual(vb as VisualBrush);
        }
Beispiel #6
0
        void chartRotator_PreviewDragLeave(object sender, DragEventArgs e)
        {
            IdentityMine.Avalon.Controls.ChartRotator cr = sender as IdentityMine.Avalon.Controls.ChartRotator;
            if (cr == null)
            {
                return;
            }

            // if we are still inside the Element, we have not left. This can occur when other controls are within the Element.
            // A leave and enter event is fired when the mouse moves over embedded controls, and we only want to remove the adorner when the mouse is outside the element.
            Point pt = e.GetPosition(cr);

            if ((pt.X > 0) && (pt.Y > 0) && (pt.X < cr.Width) && (pt.Y < cr.Height))
            {
                return;
            }

            _overlayElement.ClearAnimations();
            AdornerLayer.GetAdornerLayer(cr).Remove(_overlayElement);
            _overlayElement = null;
            _dragEnter      = false;

            e.Handled = true;
        }