MenuVM CreatePlaylistElementMenu() { var insertVideoCommand = new Command <PlaylistPosition> (InsertVideo, HasChildsItemsSelected); insertVideoCommand.Text = Catalog.GetString("External Video"); var insertImageCommand = new AsyncCommand <PlaylistPosition> (InsertImage, HasChildsItemsSelected); insertImageCommand.Text = Catalog.GetString("External Image"); var editPlaylistElementCommand = new Command(EditPlaylistElement, CheckJustOneElementSelectedAndIsNotVideo); editPlaylistElementCommand.Text = Catalog.GetString("Edit Properties"); var menu = new MenuVM(); var menuInsertBefore = new MenuVM(); var menuInsertAfter = new MenuVM(); menuInsertBefore.ViewModels.AddRange(new List <MenuNodeVM> { new MenuNodeVM(insertVideoCommand, PlaylistPosition.Before), new MenuNodeVM(insertImageCommand, PlaylistPosition.Before) }); menuInsertAfter.ViewModels.AddRange(new List <MenuNodeVM> { new MenuNodeVM(insertVideoCommand, PlaylistPosition.After), new MenuNodeVM(insertImageCommand, PlaylistPosition.After) }); menu.ViewModels.AddRange(new List <MenuNodeVM> { new MenuNodeVM(editPlaylistElementCommand), new MenuNodeVM(menuInsertBefore, Catalog.GetString("Insert before")), new MenuNodeVM(menuInsertAfter, Catalog.GetString("Insert after")), new MenuNodeVM(DeleteCommand, name: Catalog.GetString("Delete")) }); return(menu); }
protected override MenuVM CreateMenu(IViewModel viewModel) { MenuVM menu = new MenuVM(); menu.ViewModels.AddRange(new List <MenuNodeVM> { new MenuNodeVM(DeleteCommand, viewModel, Catalog.GetString("Delete")) { ActiveColor = App.Current.Style.ColorAccentError } }); return(menu); }
public ManagerBaseVM() { SearchCommand = new Command <string> (textFilter => App.Current.EventsBroker.Publish( new SearchEvent { TextFilter = textFilter })); ShowMenu = new Command <Tuple <IView, IViewModel> > ((t) => { MenuVM vm = CreateMenu(t.Item2); t.Item1.SetViewModel(vm); }); FilterText = string.Empty; }
MenuVM CreatePlaylistMenu() { var editCommand = new Command(Edit, () => { return(Selection.Count == 1); }); editCommand.Text = Catalog.GetString("Edit Name"); var renderCommand = new Command(Render, () => { return(Selection.Count == 1); }); renderCommand.Text = Catalog.GetString("Render"); var menu = new MenuVM(); menu.ViewModels.AddRange(new List <MenuNodeVM> { new MenuNodeVM(editCommand), new MenuNodeVM(renderCommand), new MenuNodeVM(DeleteCommand, name: Catalog.GetString("Delete")) }); return(menu); }
/// <summary> /// Initializes a new instance of the <see cref="T:VAS.Core.ViewModel.MenuNodeVM"/> as a SubMenu /// </summary> /// <param name="menu">The Submenu.</param> public MenuNodeVM(MenuVM menu, string name) : this() { Submenu = menu; Name = name; }