private void UserControl_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { EventHandler<SchedBoxEventArgs> handler = ScheduleBoxEvent; SchedBoxEventArgs sbea = new SchedBoxEventArgs(); MouseClicked = false; sbea.EventType = SchedBoxEventType.MouseUp; Point temp = e.GetPosition(Application.Current.MainWindow); Canvas.SetLeft(this, temp.X - this.Width / 2.0); Canvas.SetTop(this, temp.Y - this.Height / 2.0); Cloned = false; if (handler != null) { handler(this, sbea); } }
private void Delete_Menu_Chosen(object sender, RoutedEventArgs e) { EventHandler<SchedBoxEventArgs> handler = ScheduleBoxEvent; SchedBoxEventArgs sbea = new SchedBoxEventArgs(); sbea.EventType = SchedBoxEventType.Deleted; if (handler != null) { handler(this, sbea); } }
private void SchedBoxModified() { EventHandler<SchedBoxEventArgs> handler = ScheduleBoxEvent; SchedBoxEventArgs sbea = new SchedBoxEventArgs(); MouseClicked = false; sbea.EventType = SchedBoxEventType.Changed; if (handler != null) { handler(this, sbea); } }
private void ScheduleBox_Event(object sender, SchedBoxEventArgs e) { if (sender is ScheduleBox) { ScheduleBox sbSender = ((ScheduleBox)sender); switch(e.EventType) { case SchedBoxEventType.MouseDown: PopFromGrid(sbSender); break; case SchedBoxEventType.MouseUp: SnapToGrid(sbSender); break; case SchedBoxEventType.Deleted: DeleteScheduleBox(sbSender); break; case SchedBoxEventType.Changed: ChangeScheduleBox(sbSender); break; } } }