public void Redo(int level) { for (int i = 1; i <= level; i++) { if (_RedoActionsCollection.Count == 0) { return; } ChangeRepresentationObject Undostruct = _RedoActionsCollection.Pop(); if (Undostruct.Action == ActionType.Delete) { ((AnnoTier)Container).deleteSegment((AnnoTierLabel)Undostruct.UiElement); ChangeRepresentationObject ChangeRepresentationObjectForDelete = this.MakeChangeRepresentationObjectForDelete(Undostruct.UiElement); _UndoActionsCollection.Push(ChangeRepresentationObjectForDelete); } else if (Undostruct.Action == ActionType.Insert) { AnnoListItem ali = ((AnnoTierLabel)Undostruct.UiElement).Item; ((AnnoTier)Container).AnnoList.AddSorted(ali); AnnoTierLabel at = ((AnnoTier)Container).addSegment(ali); ChangeRepresentationObject ChangeRepresentationObjectForInsert = this.MakeChangeRepresentationObjectForInsert(at); _UndoActionsCollection.Push(ChangeRepresentationObjectForInsert); } else if (Undostruct.Action == ActionType.Resize) { Canvas.SetLeft(Undostruct.UiElement, Undostruct.Margin.X); Undostruct.UiElement.Width = Undostruct.Width; Undostruct.Start = ((AnnoTierLabel)Undostruct.UiElement).Item.Start; Undostruct.Stop = ((AnnoTierLabel)Undostruct.UiElement).Item.Stop; Undostruct.Duration = ((AnnoTierLabel)Undostruct.UiElement).Item.Duration; ChangeRepresentationObject ChangeRepresentationObjectForResize = this.MakeChangeRepresentationObjectForResize(Undostruct.Margin.X, Undostruct.UiElement); _UndoActionsCollection.Push(ChangeRepresentationObjectForResize); } else if (Undostruct.Action == ActionType.Move) { Canvas.SetLeft(Undostruct.UiElement, Undostruct.Margin.X); Undostruct.UiElement.Width = Undostruct.Width; Undostruct.Start = ((AnnoTierLabel)Undostruct.UiElement).Item.Start; Undostruct.Stop = ((AnnoTierLabel)Undostruct.UiElement).Item.Stop; Undostruct.Duration = ((AnnoTierLabel)Undostruct.UiElement).Item.Duration; ChangeRepresentationObject ChangeRepresentationObjectForMove = this.MakeChangeRepresentationObjectForMove(Undostruct.Margin.X, Undostruct.UiElement); _UndoActionsCollection.Push(ChangeRepresentationObjectForMove); } } if (EnableDisableUndoRedoFeature != null) { EnableDisableUndoRedoFeature(null, null); } }
private void changeAnnoTierSegmentHandler(AnnoTierLabel segment, EventArgs e) { if (IsPlaying()) { Stop(); Play(); } foreach (AnnoListItem item in control.annoListControl.annoDataGrid.Items) { if (segment.Item.Start == item.Start) { control.annoListControl.annoDataGrid.SelectedItem = item; control.annoListControl.annoDataGrid.ScrollIntoView(control.annoListControl.annoDataGrid.SelectedItem); break; } } }
private void MenuItemDeleteClick(object sender, RoutedEventArgs e) { if (AnnoTierStatic.Selected.isDiscreteOrFree) { if (annoDataGrid.SelectedItems.Count > 0) { AnnoListItem[] selected = new AnnoListItem[annoDataGrid.SelectedItems.Count]; annoDataGrid.SelectedItems.CopyTo(selected, 0); annoDataGrid.SelectedIndex = -1; AnnoTier track = AnnoTierStatic.Selected; foreach (AnnoListItem s in selected) { AnnoTierLabel segment = track.getSegment(s); if (segment != null) { track.remSegment(segment); } } } } }
public void Play() { Stop(); double pos = 0; AnnoListItem item = null; bool loop = false; AnnoTierLabel selected = AnnoTierStatic.Label; if (selected != null) { item = selected.Item; signalCursor.X = Time.PixelFromTime(item.Start); loop = true; } else { pos = signalCursor.X; double from = MainHandler.Time.TimeFromPixel(pos); double to = MainHandler.timeline.TotalDuration; item = new AnnoListItem(from, to, ""); signalCursor.X = pos; } try { mediaList.play(item, loop); control.navigator.playButton.Content = "II"; } catch (Exception e) { System.Console.WriteLine(e.ToString()); } // }