private void AddImage(double photoRadius, double left, double top, byte[] imageData, double centerX, double centerY) { var accommPhoto = new AccommPhoto { ImageData = imageData }; accommPhoto.Width = accommPhoto.Height = photoRadius; Canvas.SetTop(accommPhoto, top); Canvas.SetLeft(accommPhoto, left); FrameworkManager.RegisterElement((IMTouchControl)accommPhoto, false, new[] { TouchAction.Tap, TouchAction.Move, TouchAction.SelectToFront, TouchAction.Slide }); accommPhoto.Tapped += AccomodationPhotoTappedHandler; var line = AddLine(GetPhotoCenter(accommPhoto).X, GetPhotoCenter(accommPhoto).Y, centerX, centerY); accommPhoto.Tag = line; _connectors.Add(line); accommPhoto.Dragged += AccommPhotoDragged; MainCanvas.Children.Add(accommPhoto); Panel.SetZIndex(accommPhoto, Panel.GetZIndex(line) + 1); _accomPhotos.Add(accommPhoto); }
private static Point GetPhotoCenter(AccommPhoto accommPhoto) { return new Point(Canvas.GetLeft(accommPhoto) + accommPhoto.Width / 2.0, Canvas.GetTop(accommPhoto) + accommPhoto.Height / 2.0); }