/// <summary> /// Creates the add menu options. /// </summary> /// <returns>The entry point in the menu option.</returns> protected MenuOptionViewModel CreateAddMenuOptions() { var options = this.GetCurrentAddOptions(); var addOption = new MenuOptionViewModel(Resources.ProductElementViewModel_AddMenuText, options) { GroupIndex = 1 }; this.MenuOptions.Add(addOption); return(addOption); }
public AutomationCommand(MenuOptionViewModel parent, IAutomationExtension automation) { this.parent = parent; this.automation = automation; this.menu = (IMenuCommand)automation; this.status = automation as ICommandStatus ?? new NullQueryStatus(); parent.IsVisible = this.menu.Visible; parent.IsEnabled = this.menu.Enabled; var propertyChanged = automation as INotifyPropertyChanged; if (propertyChanged != null) { propertyChanged.PropertyChanged += this.OnMenuPropertyChanged; } }
public ProductViewModel(IProduct product, ISolutionBuilderContext context) : base(product, context) { this.InitializeCommands(); if (product.Info != null) { this.IconPath = IconEnabledPath; this.HasSingleView = product.Views.Count() == 1; this.CreateViewMenuOptions(); this.addOption = this.CreateAddMenuOptions(); } else { this.IconPath = IconUninstalledPath; this.HasSingleView = true; } }
private void CreateViewMenuOptions() { if (!this.HasSingleView) { var views = this.Data.Views .Where(x => x.Info != null) .OrderBy(v => v.Info.DisplayName) .Select(v => new MenuOptionViewModel(v.Info.DisplayName, this.ChangeViewCommand) { Data = v, IsSelected = (v == this.Data.CurrentView), IconType = IconType.SingleSelect, IsVisible = v.Info.IsVisible, }); this.viewsOption = new MenuOptionViewModel(Resources.ProductViewModel_ViewsMenuText, views) { GroupIndex = 1, }; this.MenuOptions.Add(viewsOption); } }