private void layer_entryResized(TimelineEntryControl sender, double startTime, double endTime) { //Bubble the event up if (entryResized != null) { entryResized(sender, startTime, endTime); } }
private void EntryControl_UserResized(TimelineEntryControl sender, double startTime, double endTime) { //Bubble up the event to the parent if (entryResized != null) { entryResized(sender, startTime, endTime); } }
private void timelineView_entryResized(TimelineEntryControl sender, double startTime, double endTime) { //Reject the resize if the start time is after the end time if (startTime > endTime) { return; } //Resize the entry sender.timelineEntry.startTime = startTime; sender.timelineEntry.endTime = endTime; sender.UpdateInterface(); }
/// <summary> /// Adds an entry to the timeline /// </summary> /// <param name="timelineEntry"></param> public void AddEntry(TimelineEntry timelineEntry) { timelineEntries.Add(timelineEntry); //Create a control for this entry TimelineEntryControl entryControl = new TimelineEntryControl(timelineEntry, this); entryControls.Add(timelineEntry, entryControl); entriesCanvas.Children.Add(entryControl); //Position the control entryControl.UpdateInterface(); //Subscribe to the control's events entryControl.UserResized += EntryControl_UserResized; }
/// <summary> /// Removes an entry from the timeline /// </summary> /// <param name="timelineEntry"></param> public void RemoveEntry(TimelineEntry timelineEntry) { //Don't go on if that entry doesn't exist if (!timelineEntries.Contains(timelineEntry)) { return; } //Remove timeline entry timelineEntries.Remove(timelineEntry); //Remove its control TimelineEntryControl entryControl = entryControls[timelineEntry]; entryControls.Remove(timelineEntry); entriesCanvas.Children.Remove(entryControl); //Unsubscribe from events entryControl.UserResized -= EntryControl_UserResized; }