/// <summary> /// Eine UserControl hat sich bewegt -> Priorität anpassen (Entfernung von der Bildschirmmitte) /// Außerhalb des größtmöglichen, darstellbaren Kreises ist die Priorität 1! /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void control_Moved(object sender, Events.MovedEventArgs e) { if (IsActive && e.ByUser) { bool width_smaller = Surface.ActualWidth < Surface.ActualHeight; double smallest_side = (width_smaller ? Surface.ActualWidth : Surface.ActualHeight) / 2; double mid_x = Surface.ActualWidth / 2; double mid_y = Surface.ActualHeight / 2; Vector mid = new Vector(mid_x, mid_y); Vector loc = new Vector(e.X, e.Y); double distance = Math.Abs(mid.GetDistance(loc)); double prio = distance / smallest_side; prio = prio > 1 ? 1 : prio; prio = Math.Round(prio * 100) / 100; ((UserStoryControl)sender).UserStory.Priority = prio; } }
protected virtual void ControlB_Moved(object sender, Events.MovedEventArgs e) { //Aktualisierung der Positionen UpdateLine(this.ControlA.CenterX, e.X, this.ControlA.CenterY, e.Y); }