public void anim1Completed(object sender, EventArgs e) { 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 = wke.ActualWidth; win.BarOffset += wke.ActualWidth; this.Visibility = Visibility.Hidden; isDocked = true; this.isAnimating = false; this.IsHitTestVisible = true; if (info == null) info = new DockedItemInfo(); info.scatteruri = scatteruri; info.savedOldHeight = this.oldHeight; info.savedOldWidth = this.oldWidth; info.savedWKEWidth = actualWKEWidth; info.description = this._description; wke.info = info; if (!win.SavedDockedItems.Contains(info)) win.SavedDockedItems.Add(info); }
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; }