public void AddtoDockFromSaved(double savedOldWidth, double savedOldHeight, double savedWKEWidth, DockedItemInfo oldinfo)
        {
            oldHeight = savedOldHeight;
            oldWidth = savedOldWidth;
            info = oldinfo;
            barImageHeight = bar.ActualHeight * .8;
            barImageWidth = bar.ActualHeight * savedOldWidth / savedOldHeight;
            this.MinHeight = 80;
            this.MinWidth = 80 * savedOldWidth / savedOldHeight;

            dockImage = new Image();
            dockImage.Source = this.image.Source;
            dockImage.SetCurrentValue(HeightProperty, barImageHeight);
            dockImage.SetCurrentValue(WidthProperty, barImageWidth);
            wke = new WorkspaceElement();
            wke.Visibility = Visibility.Visible;
            wke.SetCurrentValue(BackgroundProperty, bar.GetValue(BackgroundProperty));
            wke = new WorkspaceElement();
            wke.Content = dockImage;
            wke.Opacity = 0;
            wke.Background = Brushes.LightGray;
            wke.bar = bar;
            wke.item = this;
            wke.artmodewin = win;
            win.DockedItems.Add(wke);
            win.DockedDockableItems.Add(this);
            bar.Items.Add(wke);
            Point startPoint = wke.TransformToAncestor(win.getMain()).Transform(new Point(0, 0));
            Point relPoint = wke.TransformToAncestor(bar).Transform(new Point(0, 0));
            rootPoint = new Point(startPoint.X + relPoint.X, startPoint.Y + relPoint.Y);
            this.Opacity = .5;
            wke.Opacity = 1.0;
            this.SetCurrentValue(CenterProperty, new Point(rootPoint.X + win.BarOffset + barImageWidth / 2.0, rootPoint.Y + barImageHeight / 2.0));
            this.CanMove = false;
            double imgRatio = oldHeight / oldWidth;
            this.SetCurrentValue(HeightProperty, barImageHeight * .9);
            this.SetCurrentValue(WidthProperty, barImageWidth * .9);
            this.CanRotate = false;
            this.Orientation = 0;

            actualWKEWidth = savedWKEWidth;
            win.BarOffset += savedWKEWidth;
            this.Visibility = Visibility.Hidden;

            this.isDocked = true;
            this.isAnimating = false;
            this.IsHitTestVisible = true;
        }
        public void AddtoDock(object sender, EventArgs e)
        {
            touchDown = false;

            DockableItem item = sender as DockableItem;
            Helpers helpers = new Helpers();

            if (this.Center.Y > (win.ActualHeight * .8) && !isDocked && this.Center.X > win.ActualWidth * .2 && !this.isAnimating)
            {
                // Explore mode asset management.
                win.tourExploreManageDock(item);

                this.isAnimating = true;
                this.IsHitTestVisible = false;
                this.SizeChanged -= DockableItem_SizeChanged;
                if (helpers.IsVideoFile(imageURIPath))
                {
                    vidBub.pauseVideo();
                }
                this.isAnimating = true;
                barImageHeight = bar.ActualHeight * .8;
                barImageWidth = bar.ActualHeight * this.Width / this.Height;

                dockImage = new Image();
                dockImage.Source = this.image.Source;
                dockImage.SetCurrentValue(HeightProperty, barImageHeight);
                dockImage.SetCurrentValue(WidthProperty, barImageWidth);
                wke = new WorkspaceElement();
                wke.Visibility = Visibility.Visible;
                wke.SetCurrentValue(BackgroundProperty, bar.GetValue(BackgroundProperty));
                wke = new WorkspaceElement();
                wke.Content = dockImage;
                wke.Opacity = 0;
                wke.Background = Brushes.LightGray;
                wke.bar = bar;
                wke.item = this;
                wke.artmodewin = win;
                win.DockedItems.Add(wke);
                win.DockedDockableItems.Add(this);
                bar.Items.Add(wke);

                Point startPoint = wke.TransformToAncestor(win.getMain()).Transform(new Point(0, 0));
                Point relPoint = wke.TransformToAncestor(bar).Transform(new Point(0, 0));
                rootPoint = new Point(startPoint.X + relPoint.X, startPoint.Y + relPoint.Y);

                PointAnimation anim1 = new PointAnimation();
                anim1.Completed += anim1Completed;
                anim1.From = new Point(this.Center.X, this.Center.Y);
                anim1.To = new Point(rootPoint.X + win.BarOffset + barImageWidth / 2.0, rootPoint.Y + barImageHeight / 2.0);
                anim1.Duration = new Duration(TimeSpan.FromSeconds(.4));
                anim1.FillBehavior = FillBehavior.Stop;

                isDocked = true;
                oldHeight = this.Height;
                oldWidth = this.Width;
                DoubleAnimation heightAnim = new DoubleAnimation();
                heightAnim.From = this.Height;
                heightAnim.To = barImageHeight;
                heightAnim.Duration = new Duration(TimeSpan.FromSeconds(.4));
                heightAnim.FillBehavior = FillBehavior.Stop;
                DoubleAnimation orientAnim = new DoubleAnimation();
                orientAnim.From = this.ActualOrientation;
                orientAnim.To = 0;
                orientAnim.Duration = new Duration(TimeSpan.FromSeconds(.4));
                orientAnim.FillBehavior = FillBehavior.Stop;
                DoubleAnimation widthAnim = new DoubleAnimation();
                widthAnim.From = this.Width;
                widthAnim.To = barImageWidth;// barVersion.Width;
                widthAnim.Duration = new Duration(TimeSpan.FromSeconds(.4));
                widthAnim.FillBehavior = FillBehavior.Stop;
                this.BeginAnimation(CenterProperty, anim1);
                this.BeginAnimation(MaxHeightProperty, heightAnim);
                this.BeginAnimation(MaxWidthProperty, widthAnim);
                this.BeginAnimation(OrientationProperty, orientAnim);
            }
            else if (handled == false && _description != "")
            {
                showDescription();
            }
            handled = false;
        }