private void InitExternalBrowsersCommandIds() { foreach (var browserTag in ExternalBrowserManager.AvailableBrowsers.Keys) { switch (browserTag) { case ExternalBrowserManager.BrowserChromeTag: _commandIdOpenChrome = CommandIds.RegisterUserCommand(ExternalBrowserManager.BrowserChromeTag); _externalBrowsersCommandIds.Add("Open in Chrome", _commandIdOpenChrome); break; case ExternalBrowserManager.BrowserFirefoxTag: _commandIdOpenFirefox = CommandIds.RegisterUserCommand(ExternalBrowserManager.BrowserFirefoxTag); _externalBrowsersCommandIds.Add("Open in Firefox", _commandIdOpenFirefox); break; case ExternalBrowserManager.BrowserIETag: _commandIdOpenIE = CommandIds.RegisterUserCommand(ExternalBrowserManager.BrowserIETag); _externalBrowsersCommandIds.Add("Open in Internet Explorer", _commandIdOpenIE); break; case ExternalBrowserManager.BrowserEdgeTag: _commandIdOpenEdge = CommandIds.RegisterUserCommand(ExternalBrowserManager.BrowserEdgeTag); _externalBrowsersCommandIds.Add("Open in Edge", _commandIdOpenEdge); break; } } }
/// <summary> /// Adds a menu command to the package menu. /// </summary> /// <param name="commandService">The menu command service.</param> /// <param name="id">The command ID.</param> /// <param name="executeHandler">The command handler.</param> /// <param name="canExecuteHandler">The command status handler.</param> private OleMenuCommand MenuCommand(CommandIds id, EventHandler executeHandler, EventHandler canExecuteHandler = null) { var menuItem = new OleMenuCommand(executeHandler, new CommandID(Guids.PackageCommandSet, (int)id)); if (canExecuteHandler != null) { menuItem.BeforeQueryStatus += canExecuteHandler; } return(menuItem); }
private CommandRequestStatus(CommandIds commandId, CommandRequestStatusCode statusCode, DateTime?requestedTimeStamp, DateTime?pendingOrRefusedTimeStamp, DateTime?cancellationRequestedTimeStamp, DateTime?completedFaultingOrCancelledTimeStamp, string finalStatusExplanation) { CommandId = commandId; StatusCode = statusCode; RequestedTimeStamp = requestedTimeStamp; PendingOrRefusedTimeStamp = pendingOrRefusedTimeStamp; CancellationRequestedTimeStamp = cancellationRequestedTimeStamp; CompletedFaultingOrCancelledTimeStamp = completedFaultingOrCancelledTimeStamp; _finalStatusExplanation = finalStatusExplanation ?? string.Empty; }
public override int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { var result = NextCommandTarget.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); if (result == VSConstants.S_OK && pguidCmdGroup == CommandGroup && CommandIds.Contains(nCmdID)) { var typedChar = (char)(ushort)Marshal.GetObjectForNativeVariant(pvaIn); _signatureHelpManager.HandleTextInput(typedChar.ToString()); } return(result); }
private static MyCommandDef makeCommand(CommandIds commandId, Record fromRecord) { CommandDef commandDef = new CommandDef(commandId, fromRecord.Database); var myCommandDef = new MyCommandDef(); myCommandDef.CommandId = (HP.HPTRIM.ServiceModel.CommandIds)commandId; myCommandDef.MenuEntryString = commandDef.GetMenuEntryString(fromRecord.TrimType); myCommandDef.Tooltip = commandDef.GetTooltip(fromRecord.TrimType); myCommandDef.StatusBarMessage = commandDef.GetStatusBarMessage(fromRecord.TrimType); myCommandDef.IsEnabled = commandDef.IsEnabled(fromRecord); return(myCommandDef); }
public CommandRequestStatus(CommandIds whichCommand) { CommandId = whichCommand.IsValueDefined() ? whichCommand : throw new ArgumentOutOfRangeException(nameof(whichCommand), whichCommand, $"The supplied value [{whichCommand}] is not a defined value of the [{typeof(CommandIds).Name}] enumeration."); StatusCode = CommandRequestStatusCode.Nil; RequestedTimeStamp = null; PendingOrRefusedTimeStamp = null; CompletedFaultingOrCancelledTimeStamp = null; CancellationRequestedTimeStamp = null; _finalStatusExplanation = string.Empty; }
private void InitBrowser() { _idCommandDownload = CommandIds.RegisterUserCommand("DownloadImage"); _idCommandEdit = CommandIds.RegisterUserCommand("EditImage"); _idCommandAddToFavorites = CommandIds.RegisterUserCommand("AddToFavorites"); _idCommandAddAllToFavorites = CommandIds.RegisterUserCommand("AddAllToFavorites"); _browser = new WebControl(); Controls.Add(_browser); _browser.WebView = new WebView(); _browser.Dock = DockStyle.Fill; _browser.WebView.LoadCompleted += WebView_LoadComplete; _browser.WebView.BeforeContextMenu += WebView_BeforeContextMenu; _browser.WebView.Command += WebView_Command; }
public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { if (pguidCmdGroup == CommandGroup && CommandIds.Contains(nCmdID)) { bool result = Execute((TCommandEnum)(object)(int)nCmdID, nCmdexecopt, pvaIn, pvaOut); if (result) { return(VSConstants.S_OK); } } return(nextCommandTarget.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut)); }
protected LaundryMachineTaskBasedStateBase(LaundryMachineStateCode code, CommandIds commandIds, [NotNull] IEventRaiser raiser, [NotNull] BasicVault <LaundryMachineStateCode> stateVault, [NotNull] LaundryVault vault, [NotNull] ILaundryMachineTaskExecutionContext <TaskResult> executionContext, ImmutableArray <LaundryMachineStateCode> nextStatesOnCompletion, TimeSpan addOneUnitDamp, TimeSpan removeOneUnitDirt, TimeSpan removeOneUnitDamp) : base( StateMachineStateType.WaitForTaskComplete, code, vault, stateVault, raiser, executionContext, addOneUnitDamp, removeOneUnitDirt, removeOneUnitDamp) { if (stateVault == null) { throw new ArgumentNullException(nameof(stateVault)); } if (nextStatesOnCompletion.IsDefault || nextStatesOnCompletion.IsEmpty || nextStatesOnCompletion.Contains(code)) { throw new ArgumentException( $@"Parameter must not be default, empty or contain the value passed by the {nameof(code)} parameter.", nameof(nextStatesOnCompletion)); } if (executionContext == null) { throw new ArgumentNullException(nameof(executionContext)); } if (!executionContext.IsActive || executionContext.IsDisposed) { throw new ArgumentException(@"The execution context is not in a useable state.", nameof(executionContext)); } if (code.GetStateTaskType() == TaskType.NullTask) { throw new ArgumentException("This state must be a task-based state."); } CommandId = commandIds; _taskEndedTransProcedure = new LocklessLazyWriteOnce <LTransProcedure>(InitTaskEndedTransProcedure); _taskEndedAdditionalTransProcedure = new LocklessLazyWriteOnce <LTransAdditionalProcedure>(InitTaskEndedAdditionalTransProc); _taskEndedTransition = new LocklessLazyWriteOnce <LaundryMachineStateTransition>(() => InitTaskEndedTransition(nextStatesOnCompletion)); _cancellationTransition = new LocklessLazyWriteOnce <LaundryMachineStateTransition>(() => InitCancellationTransition(code, commandIds)); }
private void AddButton_Click(object sender, EventArgs e) { CommandIdEditForm form = new CommandIdEditForm(); if (form.ShowDialog() == DialogResult.OK) { if (CommandIds.Contains(form.CommandId)) { if (valueControl.SelectedItem != null && valueControl.SelectedItem.ToString() != form.CommandId) { valueControl.SelectedItem = form.CommandId; } } else { CommandIds.Add(form.CommandId); valueControl.Items.Add(form.CommandId); valueControl.SelectedItem = form.CommandId; } } }
public override int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { // Check for commit character. var typedChar = char.MinValue; if (pguidCmdGroup == CommandGroup && CommandIds.Contains(nCmdID)) { if (nCmdID == (uint)VSConstants.VSStd2KCmdID.TYPECHAR) { typedChar = (char)(ushort)Marshal.GetObjectForNativeVariant(pvaIn); } var isCommit = nCmdID == (uint)VSConstants.VSStd2KCmdID.RETURN || nCmdID == (uint)VSConstants.VSStd2KCmdID.TAB; var isCompletion = isCommit || char.IsWhiteSpace(typedChar) || (char.IsPunctuation(typedChar) && typedChar != '_'); if (isCompletion && _completionModelManager.Commit()) { if (isCommit) { return(VSConstants.S_OK); // Don't add commit char to buffer. } } } // Pass command to next command target. var result = NextCommandTarget.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); if (result == VSConstants.S_OK && pguidCmdGroup == CommandGroup && CommandIds.Contains(nCmdID)) { var isTrigger = typedChar != char.MinValue && (char.IsLetterOrDigit(typedChar) || typedChar == '.'); _completionModelManager.HandleTextInput(isTrigger); } return(result); }
private static MyCommandDef makeCommand(CommandIds commandId, TrimMainObject fromRecord) { CommandDef commandDef = new CommandDef(commandId, fromRecord.Database); var myCommandDef = new MyCommandDef(); myCommandDef.CommandId = (HP.HPTRIM.ServiceModel.CommandIds)commandId; myCommandDef.MenuEntryString = commandDef.GetMenuEntryString(fromRecord.TrimType); myCommandDef.Tooltip = commandDef.GetTooltip(fromRecord.TrimType); myCommandDef.StatusBarMessage = commandDef.GetStatusBarMessage(fromRecord.TrimType); if (fromRecord is CheckinPlace) { myCommandDef.IsEnabled = commandDef.IsEnabled((fromRecord as CheckinPlace).CheckinAs); } else { myCommandDef.IsEnabled = commandDef.IsEnabled(fromRecord); } myCommandDef.IsListCommand = commandDef.IsListCommand; myCommandDef.NeedsAnObject = commandDef.NeedsAnObject; return(myCommandDef); }
public virtual int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) { if (pguidCmdGroup != CommandGroup) { return(nextCommandTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText)); } for (int i = 0; i < cCmds; i++) { if (CommandIds.Contains(prgCmds[i].cmdID)) { if (IsEnabled()) { prgCmds[i].cmdf = (uint)(OLECMDF.OLECMDF_ENABLED | OLECMDF.OLECMDF_SUPPORTED); return(VSConstants.S_OK); } prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_SUPPORTED; } } return(nextCommandTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText)); }
public bool ContainsId(string id) => CommandIds.Contains(id);
/// How a command is packaged and sent will be determined by the BTLE device manufacturer public Command(CommandIds c, byte length) { CommandId = c; CommandLength = length; }