private int dropDirection(DragEventArgs e, Slide target_slide) { SlideControl sc = target_slide.slideControl; Point p = e.GetPosition(sc); if (p.Y < (sc.ActualHeight / 2)) { return(ABOVE); } else { return(BELOW); } }
public Boolean addSlideControl(Slide slide, BitmapImage bmp = null, int insertPosition = -1) { SlideControl slideControl = new SlideControl(); if (bmp == null) { bmp = Util.BitmapFromUri(slide.uri, 200, true); } slideControl.image.Source = bmp; slideControl.caption.Text = System.IO.Path.GetFileName(slide.fileName); slideControl.MouseMove += delegate(object sender, MouseEventArgs e) { slideMouseMove(sender, e, slide); }; slideControl.MouseLeftButtonDown += delegate(object sender, MouseButtonEventArgs e) { slideMouseLeftButtonDown(sender, e, slide); }; slideControl.MouseRightButtonDown += delegate(object sender, MouseButtonEventArgs e) { slideMouseRightButtonDown(sender, e, slide); }; slideControl.MouseLeftButtonUp += delegate(object sender, MouseButtonEventArgs e) { slideMouseLeftButtonUp(sender, e, slide); }; slideControl.PreviewMouseDown += delegate(object sender, MouseButtonEventArgs e) { slidePreviewMouseDown(sender, e, slide); }; slideControl.Drop += delegate(object sender, DragEventArgs e) { slideDrop(sender, e, slide); }; slideControl.DragOver += delegate(object sender, DragEventArgs e) { slideDragOver(sender, e, slide); }; slideControl.GiveFeedback += delegate(object sender, GiveFeedbackEventArgs e) { slideGiveFeedback(sender, e, slide); }; slideControl.CMCut.Click += delegate(object sender, RoutedEventArgs e) { cutSlideClick(sender, e, slide); }; slideControl.CMCopy.Click += delegate(object sender, RoutedEventArgs e) { copySlideClick(sender, e, slide); }; slideControl.CMPasteAbove.Click += delegate(object sender, RoutedEventArgs e) { pasteSlideClick(sender, e, slide, ABOVE); }; slideControl.CMPasteBelow.Click += delegate(object sender, RoutedEventArgs e) { pasteSlideClick(sender, e, slide, BELOW); }; slideControl.CMInsertAbove.Click += delegate(object sender, RoutedEventArgs e) { insertSlideClick(sender, e, slide, ABOVE); }; slideControl.CMInsertBelow.Click += delegate(object sender, RoutedEventArgs e) { insertSlideClick(sender, e, slide, BELOW); }; slideControl.CMPlayFromHere.Click += delegate(object sender, RoutedEventArgs e) { playFromHereClick(sender, e, slide); }; slideControl.SlideContextMenu.Opened += delegate(object sender, RoutedEventArgs e) { slideContextMenuOpened(sender, e, slide); }; slide.slideControl = slideControl; if (insertPosition == -1) { slidePanel.Children.Add(slideControl); } else { slidePanel.Children.Insert(insertPosition, slideControl); } slideControl.DeSelect(); slides.Renumber(); return(true); }