Beispiel #1
0
        public void Drop(Point dropLocation, out bool dropHandled)
        {
            dropHandled = false;
            this.UpdateMouseLocation(dropLocation);
            ILayoutRoot root = (this._floatingWindow.Model as LayoutFloatingWindow).Root;

            if (this._currentHost != null)
            {
                this._currentHost.HideOverlayWindow();
            }
            if (this._currentDropTarget != null)
            {
                this._currentWindow.DragDrop(this._currentDropTarget);
                root.CollectGarbage();
                dropHandled = true;
            }
            this._currentWindowAreas.ForEach((IDropArea a) => this._currentWindow.DragLeave(a));
            if (this._currentDropTarget != null)
            {
                this._currentWindow.DragLeave(this._currentDropTarget);
            }
            if (this._currentWindow != null)
            {
                this._currentWindow.DragLeave(this._floatingWindow);
            }
            this._currentWindow = null;
            this._currentHost   = null;
        }
Beispiel #2
0
        public void Drop(Point dropLocation, out bool dropHandled)
        {
            dropHandled = false;

            UpdateMouseLocation(dropLocation);

            var floatingWindowModel = _floatingWindow.Model as LayoutFloatingWindow;

            if (floatingWindowModel != null)
            {
                var root = floatingWindowModel.Root;

                _currentHost?.HideOverlayWindow();

                if (_currentDropTarget != null)
                {
                    _currentWindow.DragDrop(_currentDropTarget);
                    root.CollectGarbage();
                    dropHandled = true;
                }
            }


            _currentWindowAreas.ForEach(a => _currentWindow.DragLeave(a));

            if (_currentDropTarget != null)
            {
                _currentWindow.DragLeave(_currentDropTarget);
            }
            _currentWindow?.DragLeave(_floatingWindow);
            _currentWindow = null;

            _currentHost = null;
        }
Beispiel #3
0
        /// <summary>
        /// Method can be invoked to cancel the current drag and drop process and leave the
        /// <see cref="LayoutFloatingWindowControl"/> at its current position without performing
        /// a drop/dock operation.
        /// </summary>
        internal void Abort()
        {
            var floatingWindowModel = _floatingWindow.Model as LayoutFloatingWindow;

            _currentWindowAreas.ForEach(a => _currentWindow.DragLeave(a));

            if (_currentDropTarget != null)
            {
                _currentWindow.DragLeave(_currentDropTarget);
            }

            if (_currentWindow != null)
            {
                _currentWindow.DragLeave(_floatingWindow);
            }

            _currentWindow = null;

            if (_currentHost != null)
            {
                _currentHost.HideOverlayWindow();
            }

            _currentHost = null;
        }
Beispiel #4
0
        internal OverlayWindow(IOverlayWindowHost host)
        {
            ChangeTheme(null, null);
            var themeManager = IoC.Get <IThemeManager>();

            themeManager.OnThemeChanged += ThemeManager_OnThemeChanged;
        }
        public void Drop(Point dropLocation, out bool dropHandled)
        {
            dropHandled = false;

            UpdateMouseLocation(dropLocation);

            var floatingWindowModel = _floatingWindow.Model as LayoutFloatingWindow;
            var root = floatingWindowModel.Root;

            if (_currentHost != null)
                _currentHost.HideOverlayWindow();

            if (_currentDropTarget != null) {
                _currentWindow.DragDrop(_currentDropTarget);
                root.CollectGarbage();
                dropHandled = true;
            }

            _currentWindowAreas.ForEach(a => _currentWindow.DragLeave(a));

            if (_currentDropTarget != null)
                _currentWindow.DragLeave(_currentDropTarget);
            if (_currentWindow != null)
                _currentWindow.DragLeave(_floatingWindow);
            _currentWindow = null;

            _currentHost = null;
        }
Beispiel #6
0
        internal void Abort()
        {
            _currentWindowAreas.ForEach(a => _currentWindow.DragLeave(a));

            if (_currentDropTarget != null)
            {
                _currentWindow.DragLeave(_currentDropTarget);
            }
            _currentWindow?.DragLeave(_floatingWindow);
            _currentWindow = null;
            _currentHost?.HideOverlayWindow();
            _currentHost = null;
        }
Beispiel #7
0
        public void Drop(Point dropLocation, out bool dropHandled)
        {
            dropHandled = false;
            bool itemDropped = true;

            UpdateMouseLocation(dropLocation);

            var floatingWindowModel = _floatingWindow.Model as LayoutFloatingWindow;
            var root = floatingWindowModel.Root;

            if (_currentHost != null)
            {
                _currentHost.HideOverlayWindow();
            }

            if (_currentDropTarget != null)
            {
                //BodyArchitect START
                itemDropped = _manager.OnFloatingPaneDropping((DropTargetBase)_currentDropTarget, floatingWindowModel);

                if (itemDropped)
                {
                    _currentWindow.DragDrop(_currentDropTarget);
                    root.CollectGarbage();
                    dropHandled = true;
                }
            }

            _currentWindowAreas.ForEach(a => _currentWindow.DragLeave(a));
            if (_currentDropTarget != null)
            {
                _currentWindow.DragLeave(_currentDropTarget);
            }
            if (_currentWindow != null)
            {
                _currentWindow.DragLeave(_floatingWindow);
            }

            ////BodyArchitect END
            _currentWindow = null;

            _currentHost = null;
        }
Beispiel #8
0
        internal void Abort()
        {
            ILayoutElement model = this._floatingWindow.Model;

            this._currentWindowAreas.ForEach((IDropArea a) => this._currentWindow.DragLeave(a));
            if (this._currentDropTarget != null)
            {
                this._currentWindow.DragLeave(this._currentDropTarget);
            }
            if (this._currentWindow != null)
            {
                this._currentWindow.DragLeave(this._floatingWindow);
            }
            this._currentWindow = null;
            if (this._currentHost != null)
            {
                this._currentHost.HideOverlayWindow();
            }
            this._currentHost = null;
        }
Beispiel #9
0
        /// <summary>
        /// Method is invoked by the <see cref="LayoutFloatingWindowControl"/> to indicate that the
        /// <see cref="LayoutFloatingWindowControl"/> (and its content) should be dropped/docked at
        /// the current mouse position.
        ///
        /// The drop/dock behavior depends on whether the current mouse position is an actual drop target
        /// the item being dragged, and the item being docked (if any) etc.
        /// </summary>
        /// <param name="dropLocation">The screen coordinates of the drop/dock position.</param>
        /// <param name="dropHandled">Indicates whether the drop was handled such that the
        /// dropped <see cref="LayoutFloatingWindowControl"/> can be removed now (since it content
        /// is docked into a new visual tree position).</param>
        internal void Drop(Point dropLocation, out bool dropHandled)
        {
            // TODO - pass in without DPI adjustment, screen co-ords, adjust inside the target window
            dropHandled = false;

            UpdateMouseLocation(dropLocation);

            var floatingWindowModel = _floatingWindow.Model as LayoutFloatingWindow;
            var root = floatingWindowModel.Root;

            if (_currentHost != null)
            {
                _currentHost.HideOverlayWindow();
            }

            if (_currentDropTarget != null)
            {
                _currentWindow.DragDrop(_currentDropTarget);
                root.CollectGarbage();
                dropHandled = true;
            }

            _currentWindowAreas.ForEach(a => _currentWindow.DragLeave(a));

            if (_currentDropTarget != null)
            {
                _currentWindow.DragLeave(_currentDropTarget);
            }

            if (_currentWindow != null)
            {
                _currentWindow.DragLeave(_floatingWindow);
            }

            _currentWindow = null;
            _currentHost   = null;
        }
 internal OverlayWindow(IOverlayWindowHost host)
 {
     _host = host;
     UpdateThemeResources();
 }
Beispiel #11
0
        public void UpdateMouseLocation(Point dragPosition)
        {
            var floatingWindowModel = _floatingWindow.Model as LayoutFloatingWindow;

            var newHost = _overlayWindowHosts.FirstOrDefault(oh => oh.HitTest(dragPosition));

            if (_currentHost != null || _currentHost != newHost)
            {
                //is mouse still inside current overlay window host?
                if ((_currentHost != null && !_currentHost.HitTest(dragPosition)) ||
                    _currentHost != newHost)
                {
                    //esit drop target
                    if (_currentDropTarget != null)
                    {
                        _currentWindow.DragLeave(_currentDropTarget);
                    }
                    _currentDropTarget = null;

                    //exit area
                    _currentWindowAreas.ForEach(a =>
                                                _currentWindow.DragLeave(a));
                    _currentWindowAreas.Clear();

                    //hide current overlay window
                    if (_currentWindow != null)
                    {
                        _currentWindow.DragLeave(_floatingWindow);
                    }
                    if (_currentHost != null)
                    {
                        _currentHost.HideOverlayWindow();
                    }
                    _currentHost = null;
                }

                if (_currentHost != newHost)
                {
                    _currentHost   = newHost;
                    _currentWindow = _currentHost.ShowOverlayWindow(_floatingWindow);
                    _currentWindow.DragEnter(_floatingWindow);
                }
            }

            if (_currentHost == null)
            {
                return;
            }

            if (_currentDropTarget != null &&
                !_currentDropTarget.HitTest(dragPosition))
            {
                _currentWindow.DragLeave(_currentDropTarget);
                _currentDropTarget = null;
            }

            List <IDropArea> areasToRemove = new List <IDropArea>();

            _currentWindowAreas.ForEach(a =>
            {
                //is mouse still inside this area?
                if (!a.DetectionRect.Contains(dragPosition))
                {
                    _currentWindow.DragLeave(a);
                    areasToRemove.Add(a);
                }
            });

            areasToRemove.ForEach(a =>
                                  _currentWindowAreas.Remove(a));


            var areasToAdd =
                _currentHost.GetDropAreas(_floatingWindow).Where(cw => !_currentWindowAreas.Contains(cw) && cw.DetectionRect.Contains(dragPosition)).ToList();

            _currentWindowAreas.AddRange(areasToAdd);

            areasToAdd.ForEach(a =>
                               _currentWindow.DragEnter(a));

            if (_currentDropTarget == null)
            {
                _currentWindowAreas.ForEach(wa =>
                {
                    if (_currentDropTarget != null)
                    {
                        return;
                    }

                    _currentDropTarget = _currentWindow.GetTargets().FirstOrDefault(dt => dt.HitTest(dragPosition));
                    if (_currentDropTarget != null)
                    {
                        _currentWindow.DragEnter(_currentDropTarget);
                        return;
                    }
                });
            }
        }
Beispiel #12
0
		public void UpdateMouseLocation(Point dragPosition)
		{
			var floatingWindowModel = _floatingWindow.Model as LayoutFloatingWindow;

			var newHost = _overlayWindowHosts.FirstOrDefault(oh => oh.HitTest(dragPosition));

			if (_currentHost != null || _currentHost != newHost)
			{
				//is mouse still inside current overlay window host?
				if ((_currentHost != null && !_currentHost.HitTest(dragPosition)) ||
					_currentHost != newHost)
				{
					//esit drop target
					if (_currentDropTarget != null)
						_currentWindow.DragLeave(_currentDropTarget);
					_currentDropTarget = null;

					//exit area
					_currentWindowAreas.ForEach(a =>
						_currentWindow.DragLeave(a));
					_currentWindowAreas.Clear();

					//hide current overlay window
					if (_currentWindow != null)
						_currentWindow.DragLeave(_floatingWindow);
					if (_currentHost != null)
						_currentHost.HideOverlayWindow();
					_currentHost = null;
				}

				if (_currentHost != newHost)
				{
					_currentHost = newHost;
					_currentWindow = _currentHost.ShowOverlayWindow(_floatingWindow);
					_currentWindow.DragEnter(_floatingWindow);
				}
			}

			if (_currentHost == null)
				return;

			if (_currentDropTarget != null &&
				!_currentDropTarget.HitTest(dragPosition))
			{
				_currentWindow.DragLeave(_currentDropTarget);
				_currentDropTarget = null;
			}

			List<IDropArea> areasToRemove = new List<IDropArea>();
			_currentWindowAreas.ForEach(a =>
			{
				//is mouse still inside this area?
				if (!a.DetectionRect.Contains(dragPosition))
				{
					_currentWindow.DragLeave(a);
					areasToRemove.Add(a);
				}
			});

			areasToRemove.ForEach(a =>
				_currentWindowAreas.Remove(a));


			var areasToAdd =
				_currentHost.GetDropAreas(_floatingWindow).Where(cw => !_currentWindowAreas.Contains(cw) && cw.DetectionRect.Contains(dragPosition)).ToList();

			_currentWindowAreas.AddRange(areasToAdd);

			areasToAdd.ForEach(a =>
				_currentWindow.DragEnter(a));

			if (_currentDropTarget == null)
			{
				_currentWindowAreas.ForEach(wa =>
					{
						if (_currentDropTarget != null)
							return;

						_currentDropTarget = _currentWindow.GetTargets().FirstOrDefault(dt => dt.HitTest(dragPosition));
						if (_currentDropTarget != null)
						{
							_currentWindow.DragEnter(_currentDropTarget);
							return;
						}
					});
			}

		}
Beispiel #13
0
		internal void Abort()
		{
			var floatingWindowModel = _floatingWindow.Model as LayoutFloatingWindow;

			_currentWindowAreas.ForEach(a => _currentWindow.DragLeave(a));

			if (_currentDropTarget != null)
				_currentWindow.DragLeave(_currentDropTarget);
			if (_currentWindow != null)
				_currentWindow.DragLeave(_floatingWindow);
			_currentWindow = null;
			if (_currentHost != null)
				_currentHost.HideOverlayWindow();
			_currentHost = null;
		}
        internal void Abort()
        {
            _currentWindowAreas.ForEach(a => _currentWindow.DragLeave(a));

            if (_currentDropTarget != null)
                _currentWindow.DragLeave(_currentDropTarget);
            _currentWindow?.DragLeave(_floatingWindow);
            _currentWindow = null;
            _currentHost?.HideOverlayWindow();
            _currentHost = null;
        }
Beispiel #15
0
 internal OverlayWindow(IOverlayWindowHost host)
 {
     _host = host;
     UpdateThemeResources();
 }
 internal OverlayWindow(IOverlayWindowHost host)
 {
     OnThemeChanged(null, null);
 }
Beispiel #17
0
 internal OverlayWindow(IOverlayWindowHost host)
 {
     this._host = host;
     this.UpdateThemeResources(null);
 }
Beispiel #18
0
 internal OverlayWindow(IOverlayWindowHost host)
 {
     OnThemeChanged(null, null);
 }
Beispiel #19
0
        public void UpdateMouseLocation(Point dragPosition)
        {
            Func <IDropTarget, bool> func2             = null;
            ILayoutElement           model             = this._floatingWindow.Model;
            IOverlayWindowHost       overlayWindowHost = this._overlayWindowHosts.FirstOrDefault <IOverlayWindowHost>((IOverlayWindowHost oh) => oh.HitTest(dragPosition));

            if (this._currentHost != null || this._currentHost != overlayWindowHost)
            {
                if (this._currentHost != null && !this._currentHost.HitTest(dragPosition) || this._currentHost != overlayWindowHost)
                {
                    if (this._currentDropTarget != null)
                    {
                        this._currentWindow.DragLeave(this._currentDropTarget);
                    }
                    this._currentDropTarget = null;
                    this._currentWindowAreas.ForEach((IDropArea a) => this._currentWindow.DragLeave(a));
                    this._currentWindowAreas.Clear();
                    if (this._currentWindow != null)
                    {
                        this._currentWindow.DragLeave(this._floatingWindow);
                    }
                    if (this._currentHost != null)
                    {
                        this._currentHost.HideOverlayWindow();
                    }
                    this._currentHost = null;
                }
                if (this._currentHost != overlayWindowHost)
                {
                    this._currentHost   = overlayWindowHost;
                    this._currentWindow = this._currentHost.ShowOverlayWindow(this._floatingWindow);
                    this._currentWindow.DragEnter(this._floatingWindow);
                }
            }
            if (this._currentHost == null)
            {
                return;
            }
            if (this._currentDropTarget != null && !this._currentDropTarget.HitTest(dragPosition))
            {
                this._currentWindow.DragLeave(this._currentDropTarget);
                this._currentDropTarget = null;
            }
            List <IDropArea> dropAreas = new List <IDropArea>();

            this._currentWindowAreas.ForEach((IDropArea a) => {
                if (!a.DetectionRect.Contains(dragPosition))
                {
                    this._currentWindow.DragLeave(a);
                    dropAreas.Add(a);
                }
            });
            dropAreas.ForEach((IDropArea a) => this._currentWindowAreas.Remove(a));
            List <IDropArea> list = this._currentHost.GetDropAreas(this._floatingWindow).Where <IDropArea>((IDropArea cw) => {
                if (this._currentWindowAreas.Contains(cw))
                {
                    return(false);
                }
                return(cw.DetectionRect.Contains(dragPosition));
            }).ToList <IDropArea>();

            this._currentWindowAreas.AddRange(list);
            list.ForEach((IDropArea a) => this._currentWindow.DragEnter(a));
            if (this._currentDropTarget == null)
            {
                this._currentWindowAreas.ForEach((IDropArea wa) => {
                    if (this._currentDropTarget != null)
                    {
                        return;
                    }
                    DragService u003cu003e4_this           = this;
                    IEnumerable <IDropTarget> targets      = this._currentWindow.GetTargets();
                    Func <IDropTarget, bool> u003cu003e9_7 = func2;
                    if (u003cu003e9_7 == null)
                    {
                        Func <IDropTarget, bool> func  = (IDropTarget dt) => dt.HitTest(dragPosition);
                        Func <IDropTarget, bool> func1 = func;
                        func2         = func;
                        u003cu003e9_7 = func1;
                    }
                    u003cu003e4_this._currentDropTarget = targets.FirstOrDefault <IDropTarget>(u003cu003e9_7);
                    if (this._currentDropTarget == null)
                    {
                        return;
                    }
                    this._currentWindow.DragEnter(this._currentDropTarget);
                });
            }
        }
 internal OverlayWindow(IOverlayWindowHost host)
 {
     _host = host;
 }