protected virtual void CreateMenu() { render = new MenuItem(""); Add(render); render.Activated += (sender, e) => MenuHelpers.EmitRenderPlaylist(plays); drawings = new MenuItem(Catalog.GetString("Drawings")); Add(drawings); ShowAll(); }
protected virtual void PrepareMenu(Project project, IEnumerable <TimelineEventVM> plays, EventType eventType, Time time, IList <EventType> eventTypes, bool editableName) { this.plays = plays.ToList(); if (plays == null) { plays = new List <TimelineEventVM> (); } MenuHelpers.FillExportToVideoFileMenu(render, null, plays, Catalog.GetString("Render")); drawings.Visible = this.plays.Count == 1 && this.plays.FirstOrDefault().Drawings.Count > 0; if (drawings.Visible) { Menu drawingsMenu = new Menu(); for (int i = 0; i < plays.FirstOrDefault().Drawings.Count; i++) { int index = i; MenuItem drawingItem = new MenuItem(Catalog.GetString("Drawing ") + (i + 1)); MenuItem editItem = new MenuItem(Catalog.GetString("Edit")); MenuItem deleteItem = new MenuItem(Catalog.GetString("Delete")); Menu drawingMenu = new Menu(); drawingsMenu.Append(drawingItem); drawingMenu.Append(editItem); drawingMenu.Append(deleteItem); editItem.Activated += (sender, e) => { var play = plays.FirstOrDefault(); App.Current.EventsBroker.Publish( new DrawFrameEvent { Play = play, DrawingIndex = index, CamConfig = play.Drawings [index].CameraConfig, } ); }; deleteItem.Activated += (sender, e) => { plays.FirstOrDefault().Drawings.RemoveAt(index); plays.FirstOrDefault().Model.UpdateMiniature(); }; drawingItem.Submenu = drawingMenu; drawingMenu.ShowAll(); } drawingsMenu.ShowAll(); drawings.Submenu = drawingsMenu; } }