public override void CreateContextMenuContent(ICommandPresentationContext context, PlatformVisual sourceVisual) { var projectItem = sourceVisual.DataContext as ProjectItemViewModel; if (projectItem != null && projectItem.Envoy != null) { try { var loadedEnvoy = projectItem.Envoy.Project.GetLinkedEnvoys(projectItem.Envoy).Where(e => e.ReferenceDefinition != null).FirstOrDefault(); if (loadedEnvoy != null) { var viDocument = loadedEnvoy.ReferenceDefinition as VirtualInstrument; if (loadedEnvoy.ReferenceDefinition != null) { context.Add(OpenInNotepadCommand); } } } catch (Exception) { } } var terminal = sourceVisual.DataContext as NodeTerminalViewModel; if (terminal != null) { context.Add(new ShellCommandInstance(TerminalCommand, terminal)); } base.CreateContextMenuContent(context, sourceVisual); }
/// <inheritdoc /> public override void CreateCommandContent(ICommandPresentationContext context) { base.CreateCommandContent(context); using (context.AddConfigurationPaneContent()) { using (context.AddGroup(TypeModeGroupCommand)) { context.Add(StructModeCommand); context.Add(VariantModeCommand); } } }
/// <inheritdoc /> public override void CreateCommandContent(ICommandPresentationContext context) { base.CreateCommandContent(context); using (context.AddConfigurationPaneContent()) { using (context.AddGroup(ConfigurationPaneCommands.BehaviorGroupCommand)) { context.Add(LoopTunnelViewModelHelpers.LoopAddBorrowTunnelCommand.SetWeight(0.6)); context.Add(LoopTunnelViewModelHelpers.LoopAddIterateTunnelCommand.SetWeight(0.6)); } } }
/// <inheritdoc /> public override void CreateCommandContent(ICommandPresentationContext context) { base.CreateCommandContent(context); using (context.AddConfigurationPaneContent()) { using (context.AddGroup(BorrowModeGroupCommand)) { context.Add(BorrowImmutableCommand); context.Add(BorrowMutableCommand); } } }
/// <inheritdoc /> protected override void CreateCommandContentForDocument(ICommandPresentationContext context) { base.CreateCommandContentForDocument(context); using (context.AddStudioWindowToolBarContent()) { using (context.AddGroup(ShellToolBar.LeftGroupCommand)) { context.Add(DocumentCommands.Copy); context.Add(DocumentCommands.Paste); } } }
/// <summary> /// Overriden to add our menu items to the application menu /// </summary> /// <param name="context">The active command presentation context</param> public override void CreateApplicationContent(ICommandPresentationContext context) { base.CreateApplicationContent(context); context.Add(CommandHelpers.CreateAdjacentSeparator(ScriptingMenuRoot)); context.Add(ScriptingMenuRoot); context.Add(AddNewVICommand); context.Add(AddNewMemberVICommand); context.Add(AddNewTypeCommand); context.Add(AddNewDerivedTypeCommand); context.Add(CreateMergeScriptFromSelectionCommand); context.Add(MergeFromLastMergeScriptCommand); context.Add(TagSelectionCommand); context.Add(FindTaggedElementsCommand); }
/// <summary> /// Called to create the command content for this document. This content will be displayed in the "Home" /// tab when this document is active /// </summary> /// <param name="context">The current presentation context</param> protected override void CreateCommandContentForDocument(ICommandPresentationContext context) { base.CreateCommandContentForDocument(context); // Add a group with cut, copy, and paste commands using (context.AddConfigurationPaneContent()) { using (context.AddGroup(EditingGroupCommand)) { context.Add(PasteCommand); context.Add(CutCommand); context.Add(CopyCommand); } } }
/// <summary> /// Creates configuration pane content for this control. See comments on /// <see cref="IProvideCommandContent"/> for more information about correct usage of this function. /// </summary> /// <param name="context">The current display context</param> public override void CreateCommandContent(ICommandPresentationContext context) { base.CreateCommandContent(context); // specify that we are adding things to the configuration pane using (context.AddConfigurationPaneContent()) { // First add the group command which lets us know what top level configuration pane group to put the child commands in using (context.AddGroup(ConfigurationPaneCommands.BehaviorGroupCommand)) { // add child commands whose visuals will show up in the specified parent group. context.Add(FrequencyChannelBrowseCommand); context.Add(DutyCycleChannelBrowseCommand); } } }
/// <inheritdoc /> public override void CreateCommandContent(ICommandPresentationContext context) { base.CreateCommandContent(context); using (context.AddConfigurationPaneContent()) { using (context.AddGroup(ConfigurationPaneCommands.BehaviorGroupCommand)) { context.Add(FlatSequenceTunnelViewModelHelpers.StructureAddBorrowTunnelCommand.SetWeight(0.6)); if (RebarFeatureToggles.IsCellDataTypeEnabled) { context.Add(FlatSequenceTunnelViewModelHelpers.StructureAddLockTunnelCommand.SetWeight(0.6)); } context.Add(FlatSequenceTunnelViewModelHelpers.StructureAddUnwrapOptionTunnelCommand.SetWeight(0.6)); } } }
/// <summary> /// Creates the content to put into the command bar when the node is selected /// </summary> /// <param name="context">The current presentation context</param> public override void CreateCommandContent(ICommandPresentationContext context) { base.CreateCommandContent(context); using (context.AddConfigurationPaneContent()) { using (context.AddGroup(ConfigureGroup)) { context.Add(MultiplierCommand); } } // Create a new ribbon group and add a text block which allows the user to set // the multiplier //RibbonGroup group = new RibbonGroup() { Command = ConfigureGroup }; //RibbonTextBox box = new RibbonTextBox(); //box.Label = "Multiplier"; //var binding = new Binding("Multiplier"); //box.SetBinding(RibbonTextBox.TextProperty, binding); //box.DataContext = this; //group.AddItem(box); //// Add the ribbon group to the presentation context //context.Add(group); }
/// <inheritdoc /> public override void CreateCommandContentForDocument(ICommandPresentationContext context, Document document) { base.CreateCommandContentForDocument(context, document); using (context.AddDocumentToolBarContent()) { using (context.AddGroup(ShellToolBar.LeftGroupCommand)) { context.Add(RouteCommandsThroughTarget.RouteThroughDesigner(DebuggingCommands.Run, this), ShellToolBarButtonVisualFactory.NoMask); } } }
/// <summary> /// This method will create the custom ribbon content to represent the FanSpeed editor /// </summary> public override void CreateCommandContent(ICommandPresentationContext context) { base.CreateCommandContent(context); using (context.AddConfigurationPaneContent()) { using (context.AddGroup(MocCommonCommands.ControlDesignCommand)) { context.Add(FanCommands.SetFanSpeedCommand); } } }
/// <inheritdoc /> public override void CreateCommandContent(ICommandPresentationContext context) { base.CreateCommandContent(context); using (context.AddConfigurationPaneContent()) { using (context.AddGroup(WireGroupCommand)) { context.Add(WireBeginsMutableVariableCommand); } } }
/// <inheritdoc /> public override void CreateCommandContentForSelection(ICommandPresentationContext context) { base.CreateCommandContentForElement(context); using (context.AddConfigurationPaneContent()) { using (context.AddGroup(ConfigurationPaneCommands.VisualStyleGroupCommand)) { context.Add(SelectionCommand); } } }
/// <summary> /// Creates the content to put into the command bar when the node is selected /// </summary> /// <param name="context">The current presentation context</param> public override void CreateCommandContent(ICommandPresentationContext context) { base.CreateCommandContent(context); using (context.AddConfigurationPaneContent()) { using (context.AddGroup(ConfigureGroup)) { context.Add(MultiplierCommand); } } }
public override void CreateContextMenuContent(ICommandPresentationContext context, PlatformVisual sourceVisual) { var projectItem = sourceVisual.DataContext as ProjectItemViewModel; if (projectItem != null && projectItem.Envoy != null) { try { var path = projectItem.Envoy?.QueryService <IReferencedFileService>().FirstOrDefault()?.StoragePath ?? string.Empty; if (!string.IsNullOrEmpty(path)) { context.Add(new ShellCommandInstance(LoadBetterCommmandCommand, path)); context.Add(new ShellCommandInstance(SaveBetterCommmandCommand, path)); } } catch (Exception) { } } base.CreateContextMenuContent(context, sourceVisual); }
/// <summary> /// Creates the content to put into the command bar when the node is selected /// </summary> /// <param name="context">The current presentation context</param> public override void CreateCommandContent(ICommandPresentationContext context) { base.CreateCommandContent(context); // This will add an IsActive checkbox to the right rail using (context.AddConfigurationPaneContent()) { using (context.AddGroup(ConfigurationItemsGroup)) { context.Add(IsActiveCommand, CheckBoxFactory.ForConfigurationPane); } } }
/// <inheritdoc /> public override void CreateCommandContentForElement(ICommandPresentationContext context) { base.CreateCommandContentForElement(context); // This entrypoint can be used to add commands for any selectable item in the UI. // In this case, we own the ViewModel, so could do it in that class, but are showing // here as an example and to keep these commands separate. if (context.IsSingleSelect <PulseWidthModulationControlViewModel>()) { using (context.AddConfigurationPaneContent()) { // These are for the individual expandable sections...can make your own or use ours. using (context.AddGroup(ConfigurationPaneCommands.BehaviorGroupCommand)) { // Use a command with a UIType, or use/customize the factory yourself context.Add(CheckBoxCommand); ////context.Add(CheckBoxCommand, CheckBoxFactory.ForConfigurationPane); ////context.Add(CheckBoxCommand, ToggleButtonFactory.ForConfigurationPane); context.Add(TextBoxCommand); var filters = new FileDialogFilterCollection(); filters.Add(new FileDialogFilter() { Extensions = new[] { "jpg", "png" }, Label = "Image Files" }); context.Add(PathCommand, new PathSelectorFactory() { Filters = filters }); ////context.Add(TextBoxCommand, TextBoxFactory.ForConfigurationPane); ////context.Add(TextBoxCommand, StaticTextFactory.ForConfigurationPane); context.Add(NumericCommand, new NumericTextBoxFactory(NITypes.Double)); context.Add(ColorCommand, new ColorBoxFactory { ColorOnly = false, ShowMoreColors = true }); context.AddContentFontEditor(null, true); } } } }
/// <inheritdoc /> public override void CreateApplicationContent(ICommandPresentationContext context) { base.CreateApplicationContent(context); // Add to the tool launcher using (context.AddToolLauncherContent()) { // Add a group using (context.AddGroup(CustomToolsWindowGroupCommand)) { // Add the custom buttons tool window to the group ICommandContentManager commandContentManager = ((CommandContentBuilder)context).Site.CommandContentManager; context.Add(commandContentManager.GetCommandForWindow(CustomButtonsToolWindowType.WindowGuid)); } } }
/// <summary> /// This is called to add content for an element when it is singularly selected. /// </summary> /// <param name="context">The current presentation context</param> public override void CreateCommandContentForElement(ICommandPresentationContext context) { if (context.Selection != null && context.Selection.Any() && context.Selection.First().Model != null) { if (((Element)context.Selection.First().Model).SpecificKind == "NI.LabVIEW.VI:RandomNumber") { using (context.AddConfigurationPaneContent()) { using (context.AddGroup(ExampleItemsGroup)) { context.Add(MultiplyBy10Command, ButtonFactory.ForConfigurationPane); } } } } // Don't forget to call the base base.CreateCommandContentForElement(context); }
public override void CreateContextMenuContent(ICommandPresentationContext context, PlatformVisual sourceVisual) { var projectItem = sourceVisual.DataContext as ProjectItemViewModel; if (projectItem != null && projectItem.Envoy != null) { try { if (projectItem.Envoy.ReferenceDefinition != null) { var textDocument = projectItem.Envoy.ReferenceDefinition as TextDocumentDefinition; if (textDocument != null) { context.Add(OpenInNotepadCommand); } } } catch (Exception) { } } base.CreateContextMenuContent(context, sourceVisual); }
/// <summary> /// Creates the content to put into the command bar when the node is selected /// </summary> /// <param name="context">The current presentation context</param> public override void CreateCommandContent(ICommandPresentationContext context) { base.CreateCommandContent(context); // This will add an IsActive checkbox to the right rail using (context.AddConfigurationPaneContent()) { using (context.AddGroup(ConfigurationItemsGroup)) { context.Add(IsActiveCommand, CheckBoxFactory.ForConfigurationPane); using (context.AddGroup(SoundSelectionGroupCommand, ListBoxLayoutFactory.ForConfigurationPane)) { context.Add(WoofCommand); context.Add(MeowCommand); context.Add(TweetCommand); context.Add(SqueakCommand); context.Add(MooCommand); context.Add(CroakCommand); context.Add(TootCommand); context.Add(QuackCommand); context.Add(BlubCommand); context.Add(OwowowCommand); context.Add(FoxCommand); } } } }
/// <summary> /// This is called to add content to the application independent of the state of the editor /// </summary> /// <param name="context">The current presentation context</param> public override void CreateApplicationContent(ICommandPresentationContext context) { base.CreateApplicationContent(context); context.Add(OpenInNotepadMenuCommand); }
public override void CreateContextMenuContent(ICommandPresentationContext context, PlatformVisual sourceVisual) { var projectItem = sourceVisual.DataContext as ProjectItemViewModel; if (projectItem?.Envoy != null) { try { var envoy = projectItem.Envoy; if (envoy != null) { var svnManager = Host.GetSharedExportedValue <SvnManagerPlugin>(); var status = svnManager.Status(projectItem.FullPathForced); if (status.Exists && status.IsVersionable) { context.Add(new ShellCommandInstance(SvnCommands.SvnSubMenuCommand) { CommandParameter = projectItem.Envoy }); } if (status.IsVersionable && !status.IsVersioned) { context.Add(new ShellCommandInstance(AddCommand.ShellSelectionRelayCommand) { CommandParameter = projectItem.Envoy }); } if (status.IsVersioned && status.IsModified) { context.Add(new ShellCommandInstance(CommitCommand.ShellSelectionRelayCommand) { CommandParameter = projectItem.Envoy }); } if (status.IsVersioned && !status.IsAdded) { context.Add(new ShellCommandInstance(HistoryCommand.ShellSelectionRelayCommand) { CommandParameter = projectItem.Envoy }); } if (status.IsVersioned && !status.IsLocked && !status.IsAdded) { context.Add(new ShellCommandInstance(LockCommand.ShellSelectionRelayCommand) { CommandParameter = projectItem.Envoy }); } if (status.IsVersioned && status.IsLocked) { context.Add(new ShellCommandInstance(ReleaseLockCommand.ShellSelectionRelayCommand) { CommandParameter = projectItem.Envoy }); } if (status.IsVersioned && status.IsModified && !status.IsAdded) { context.Add(new ShellCommandInstance(RevertCommand.ShellSelectionRelayCommand) { CommandParameter = projectItem.Envoy }); } } } catch (Exception) { } } base.CreateContextMenuContent(context, sourceVisual); }
/// <inheritdoc /> public override void CreateContextMenuContent(ICommandPresentationContext context, PlatformVisual sourceVisual) { base.CreateContextMenuContent(context, sourceVisual); context.Add(ContextMenuCommand); }