public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { ToolStripMenuItem menuitem = null; if (t == PluginMenuType.Entry) { menuitem = new ToolStripMenuItem { Text = "Have I been pwned?" }; menuitem.Image = SmallIcon; menuitem.Click += OnCheckSingleEntriesClicked; menuitem.Paint += OnCheckSingleEntriesVisibility; } else if (t == PluginMenuType.Group) { menuitem = new ToolStripMenuItem { Text = "Have I been pwned? (Check group)" }; menuitem.Image = SmallIcon; menuitem.Click += OnCheckGroupClicked; } return(menuitem); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType menuType) { if (menuType != PluginMenuType.Main) { return(null); } var mainLevel = new ToolStripMenuItem { Text = "CrossPlatformLockEvents Settings" }; var screensaverLock = new ToolStripMenuItem { Text = "Lock on Screensaver", CheckOnClick = true, Checked = _lockEventTypeEnabled[LockEventType.Screensaver] }; screensaverLock.CheckedChanged += ScreensaverLockOnCheckedChanged; var suspendLock = new ToolStripMenuItem { Text = "Lock on Suspend", CheckOnClick = true, Checked = _lockEventTypeEnabled[LockEventType.Suspend] }; suspendLock.CheckedChanged += SuspendLockOnCheckedChanged; mainLevel.DropDownItems.Add(screensaverLock); mainLevel.DropDownItems.Add(suspendLock); return(mainLevel); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { if (t != PluginMenuType.Entry) { return(null); } ToolStripMenuItem tsmi = new ToolStripMenuItem("Simple Selection Export"); ToolStripMenuItem tsmiExportToText = new ToolStripMenuItem(); tsmiExportToText.Text = "Export selection to TXT"; tsmiExportToText.Click += this.ExportToText; tsmi.DropDownItems.Add(tsmiExportToText); ToolStripMenuItem tsmiExportToCsv = new ToolStripMenuItem(); tsmiExportToCsv.Text = "Export selection to CSV"; tsmiExportToCsv.Click += this.ExportToCsv; tsmi.DropDownItems.Add(tsmiExportToCsv); // TODO: would prefer to disable the main group in the context menu instead of the subgroup items tsmi.DropDownOpening += delegate(object sender, EventArgs e) { bool hasSelection = m_host.MainWindow.GetSelectedEntriesCount() > 0; tsmiExportToText.Enabled = tsmiExportToCsv.Enabled = hasSelection; }; return(tsmi); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { if (t != PluginMenuType.Main && t != PluginMenuType.Entry) { return(null); } ToolStripMenuItem strip = new ToolStripMenuItem { Text = Resources.AppIdLinkerExt_GetMenuItem_AppIdLinker_Plugin, Image = Resources.MenuIcon }; ToolStripMenuItem stripAdd = new ToolStripMenuItem { Text = Resources.AppIdLinkerExt_GetMenuItem_Add_IDs }; stripAdd.Click += OnAddIdsClicked; ToolStripMenuItem stripRemove = new ToolStripMenuItem { Text = Resources.AppIdLinkerExt_GetMenuItem_Remove_IDs }; stripRemove.Click += OnRemoveIdsClicked; strip.DropDownItems.Add(stripAdd); strip.DropDownItems.Add(stripRemove); return(strip); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { if (t == PluginMenuType.Main) { var mi = new ToolStripMenuItem() { Text = "Setup EasyBrowserAddon" }; mi.Click += OpenAddonSetupWindow; #if __DEBUG var main = new ToolStripMenuItem() { Text = "EasyBroswerAddon" }; main.DropDownItems.Add(mi); var dl = new ToolStripMenuItem() { Text = "Launch Debugger" }; dl.Click += (s, e) => Debugger.Launch(); main.DropDownItems.Add(dl); return(main); #else return(mi); #endif } return(null); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { // Provide a menu item for the main location(s) if (t == PluginMenuType.Main) { ToolStripMenuItem tsmi = new ToolStripMenuItem(); tsmi.Text = "KPSimpleBackup"; ToolStripMenuItem backupNowItem = new ToolStripMenuItem(); backupNowItem.Text = "Backup Database now!"; backupNowItem.Click += this.OnMenuBackupNow; ToolStripMenuItem openSettings = new ToolStripMenuItem(); openSettings.Text = "Settings"; openSettings.Click += this.OnMenuSettings; ToolStripMenuItem openLog = new ToolStripMenuItem(); openLog.Text = "Open Session Log"; openLog.Click += this.OnMenuShowLog; tsmi.DropDownItems.Add(backupNowItem); tsmi.DropDownItems.Add(openSettings); tsmi.DropDownItems.Add(openLog); return(tsmi); } return(null); // No menu items in other locations }
public override ToolStripMenuItem GetMenuItem(PluginMenuType type) { if (_menuItemProvider != null) { return(_menuItemProvider.GetMenuItem(type)); } return(null); }
/// <inheritdoc/> public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { if (t == PluginMenuType.Main) { return(new ToolStripMenuItem("KeePassCPEO Options...", Properties.Resources.B16x16_Misc, ConfigMenuItem_Click)); } return(null); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { if (t == PluginMenuType.Main) { ToolStripMenuItem tsMenuItem = new ToolStripMenuItem("HIBP Offline Check..."); tsMenuItem.Click += ToolsMenuItemClick; return(tsMenuItem); } return(null); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { // Provide a menu item for the main location(s) if (t == PluginMenuType.Main) { ToolStripMenuItem tsmi = new ToolStripMenuItem(); tsmi.Text = "Abcd Options"; tsmi.Click += this.OnOptionsClicked; return(tsmi); } return(null); // No menu items in other locations }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { if (t != PluginMenuType.Main) { return(null); } var menuItem = new ToolStripMenuItem("KeePassFIDO2"); menuItem.Click += OnMenuItemClick; return(menuItem); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { if (t == PluginMenuType.Main) { // Add the menu option for configuration under Tools var tsShowSettings = new ToolStripMenuItem("KeeAnywhere Settings...", PluginResources.KeeAnywhere_16x16); tsShowSettings.Click += OnShowSetting; return(tsShowSettings); } return(null); // No menu items in other locations }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { if (t != PluginMenuType.Main) { return(null); } ToolStripMenuItem strip = new ToolStripMenuItem { Text = Resources.DemoPluginExt_GetMenuItem_DemoPlugin }; return(strip); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { // Provide a menu item for the main location(s) if (t == PluginMenuType.Main) { tsmiOptions.Text = "OpenId Plugin Options"; tsmiOptions.Image = new Bitmap(aKeePassOpenIdExtAssembly.GetManifestResourceStream("KeePassOpenId.Resources.Options.png")); tsmiOptions.Click += OnOptionsClicked; tsmiOptions.Enabled = dbPwDatabase != null; return(tsmiOptions); } return(null); // No menu items in other locations }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { if (t == PluginMenuType.Main) { _menuItem = new ToolStripMenuItem(_theme.Name); _menuItem.CheckOnClick = true; _menuItem.Checked = _theme.Enabled; _menuItem.ShortcutKeys = Keys.Control | Keys.T; _menuItem.Click += HandleToggleKeeThemeMenuItemClick; return(_menuItem); } return(base.GetMenuItem(t)); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { if (t != PluginMenuType.Main) { return(null); } ToolStripMenuItem tsmi = new ToolStripMenuItem("MultiCipher Encryption Settings..."); tsmi.Click += OnShowSetting; m_MultiCipherMenuItem = tsmi; return(tsmi); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { if (t == PluginMenuType.Main) { _menuItem = new ToolStripMenuItem(_theme.Name); _menuItem.CheckOnClick = true; _menuItem.Checked = _options.Enabled; _menuItem.ShortcutKeys = _options.HotKey; _menuItem.Click += HandleToggleKeeThemeMenuItemClick; _options.HotKeyChanged += keys => _menuItem.ShortcutKeys = keys; return(_menuItem); } return(base.GetMenuItem(t)); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { if (t == PluginMenuType.Entry) { return(CreateToolStripItem(() => { var entries = Program.MainForm.GetSelectedEntries(); if (entries != null) { ShowModifyEntriesDialog(entries); } })); } return(null); }
// Keepass > Tools > KeePassAutoUnlock Options public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { if (t != PluginMenuType.Main) { return(null); } ToolStripMenuItem tsmi = new ToolStripMenuItem(); tsmi.Text = "KeePassAutoUnlock Options"; tsmi.Click += (object sender, EventArgs e) => { OpenOptions(); }; return(tsmi); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { if (t != PluginMenuType.Main) { return(null); } ToolStripMenuItem tsmi = new ToolStripMenuItem("Limbo"); ToolStripMenuItem anal = new ToolStripMenuItem("Analyze"); anal.Click += OnAnalClick; tsmi.DropDownItems.Add(anal); return(tsmi); }
internal ToolStripMenuItem GetMenuItem(PluginMenuType type) { switch (type) { // Provide a menu item for the main location(s) case PluginMenuType.Main: return(MainMenuItemProvider.ProvideMenuItem()); case PluginMenuType.Entry: return(EntryMenuItemProvider.ProvideMenuItem()); case PluginMenuType.Tray: return(TrayMenuItemProvider.ProvideMenuItem()); default: return(null); // No menu items in other locations } }
public override ToolStripMenuItem GetMenuItem(PluginMenuType type) { // Our menu item below is intended for the main location(s), // not for other locations like the group or entry menus if (type != PluginMenuType.Main) { return(null); } // To make the item list sync with system language setting. reloadKeyboardLayouts(); setupInputKeyboardLayout(); string menuTitle = isAppChinese() ? PluginMenuTitle_Chinese : PluginMenuTitle_English; ToolStripMenuItem stripMenuItem = new ToolStripMenuItem(menuTitle); foreach (KeyboardLayout layout in keyboardLayouts) { ToolStripMenuItem menuItem = new ToolStripMenuItem(); menuItem.Text = layout.LanguageName; menuItem.Tag = layout.Id; menuItem.Click += this.OnMenuItemClicked; stripMenuItem.DropDownItems.Add(menuItem); } stripMenuItem.DropDownOpening += delegate(object sender, EventArgs e) { foreach (ToolStripMenuItem menuItem in stripMenuItem.DropDownItems) { UInt32 layoutIdFromItem = (UInt32)menuItem.Tag; if (layoutIdFromItem == inputKeyboardLayout.Id) { UIUtil.SetChecked(menuItem, true); } else { UIUtil.SetChecked(menuItem, false); } } }; return(stripMenuItem); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { if (t == PluginMenuType.Main && menuItemCopyKey == null) { var tokenEngineMenu = new ToolStripMenuItem("Token Engine Plugin", Resource.token_engine_icon.ToBitmap()); menuItemCopyKey = new ToolStripMenuItem("Copy Key"); menuItemCopyKey.Click += MenuItemCopyKey_Click; menuItemDeleteKey = new ToolStripMenuItem("Clean up all tokens"); menuItemDeleteKey.Click += MenuItemDeleteKey_Click; tokenEngineMenu.DropDownItems.Add(menuItemCopyKey); tokenEngineMenu.DropDownItems.Add(menuItemDeleteKey); return(tokenEngineMenu); } return(base.GetMenuItem(t)); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType pmType) { if (pmType != PluginMenuType.Entry) { return(null); } var tsCreate = new ToolStripMenuItem(Properties.Strings.Plugin_Menu_Create); tsCreate.Click += TsCreateEdit_Click; var tsEdit = new ToolStripMenuItem(Properties.Strings.Plugin_Menu_Edit); tsEdit.Click += TsCreateEdit_Click; var tsCopy = new ToolStripMenuItem(Properties.Strings.Plugin_Menu_Copy); tsCopy.Click += TsCopy_Click; var tsView = new ToolStripMenuItem(Properties.Strings.Plugin_Menu_View); tsView.Click += TsView_Click; var tsGroup = new ToolStripMenuItem("OTP for Yandex 2FA", null, new[] { tsCreate, tsCopy, tsView, tsEdit }); tsGroup.OwnerChanged += (o, e) => { if (tsGroup.Owner is ToolStripDropDown tsdd) { tsdd.Opening += (oo, ee) => tsGroup.Enabled = _host.MainWindow.GetSelectedEntriesCount() == 1; } }; tsGroup.DropDownOpening += (o, e) => { var otpDataExists = (TryGetSingleSelectedEntry(out var entry) && entry.Strings.Exists(OtpDataUtils.Key)); tsCopy.Visible = tsView.Visible = tsEdit.Visible = otpDataExists; tsCreate.Visible = !otpDataExists; }; return(tsGroup); }
public static unsafe PluginMenuItem *createMenuItem(PluginMenuType type, int id, string text, string icon) { PluginMenuItem *menuItem = (PluginMenuItem *)Marshal.AllocHGlobal(sizeof(PluginMenuItem)); menuItem->type = type; menuItem->id = id; IntPtr i_ptr = Marshal.StringToHGlobalAnsi(icon); void * i_strPtr = i_ptr.ToPointer(); char * i_cptr = (char *)i_strPtr; *menuItem->icon = *my_strcpy(menuItem->icon, 128, i_cptr); IntPtr t_ptr = Marshal.StringToHGlobalAnsi(text); void * t_strPtr = t_ptr.ToPointer(); char * t_cptr = (char *)t_strPtr; my_strcpy(menuItem->text, 128, t_cptr); return(menuItem); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { // Our menu item below is intended for the main location(s), // not for other locations like the group or entry menus if (t != PluginMenuType.Entry) { return(null); } ToolStripMenuItem teamViewerAndAmmyyMenu = new ToolStripMenuItem("TeamViewer and Ammyy"); // Add menu item 'Connect with TeamViewer' ToolStripMenuItem openWithTeamViewer = new ToolStripMenuItem(); openWithTeamViewer.Text = "Connect with TeamViewer"; openWithTeamViewer.Click += this.OnMenuTeamViewer; teamViewerAndAmmyyMenu.DropDownItems.Add(openWithTeamViewer); // Add menu item 'Connect with Ammyy' ToolStripMenuItem openWithAmmyyMenu = new ToolStripMenuItem(); openWithAmmyyMenu.Text = "Connect with Ammyy"; openWithAmmyyMenu.Click += this.OnMenuAmmyy; teamViewerAndAmmyyMenu.DropDownItems.Add(openWithAmmyyMenu); teamViewerAndAmmyyMenu.Enabled = appPaths.TeamViewerExists || appPaths.AmmyyExists; // By using an anonymous method as event handler, we do not // need to remember menu item references manually, and // multiple calls of the GetMenuItem method (to show the // menu item in multiple places) are no problem teamViewerAndAmmyyMenu.DropDownOpening += delegate(object sender, EventArgs e) { PwDatabase pd = m_host.Database; bool bOpen = ((pd != null) && pd.IsOpen); openWithTeamViewer.Enabled = bOpen && appPaths.TeamViewerExists; openWithAmmyyMenu.Enabled = bOpen && appPaths.AmmyyExists; }; return(teamViewerAndAmmyyMenu); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { if (t == PluginMenuType.Entry) { var item = new ToolStripMenuItem { Image = Properties.Resources.icon, Text = CONTEXT_MENU_ITEM_LABEL }; item.DropDownOpening += OnDropDownOpening; item.DropDownItems.Add("dummy"); // Subitems get filled in OnDropDownOpening. The dummy item is necessary to show the "there is more" arrow. var dynamicMenu = new DynamicMenu(item.DropDownItems); dynamicMenu.MenuClick += OnShowQRCode; item.Tag = dynamicMenu; return(item); } return(null); }
public override ToolStripMenuItem GetMenuItem(PluginMenuType type) { // Provide a menu item for the main location(s) if (type == PluginMenuType.Main) { var toMenuTrayTOTP = new ToolStripMenuItem(TrayTOTP_Plugin_Localization.strTrayTOTPPlugin); toMenuTrayTOTP.Image = Properties.Resources.TOTP; var toSubMenuSettings = new ToolStripMenuItem(TrayTOTP_Plugin_Localization.strSettings); toSubMenuSettings.Image = Properties.Resources.TOTP_Settings; toSubMenuSettings.Click += OnMenuSettingsClick; toMenuTrayTOTP.DropDownItems.Add(toSubMenuSettings); var toSubMenuSeparator1 = new ToolStripSeparator(); toMenuTrayTOTP.DropDownItems.Add(toSubMenuSeparator1); var toSubMenuHelp = new ToolStripMenuItem(TrayTOTP_Plugin_Localization.strHelp); toSubMenuHelp.Image = Properties.Resources.TOTP_Help; toSubMenuHelp.Click += OnMenuHelpClick; toMenuTrayTOTP.DropDownItems.Add(toSubMenuHelp); var toSubMenuAbout = new ToolStripMenuItem(TrayTOTP_Plugin_Localization.strAbout + "..."); toSubMenuAbout.Image = Properties.Resources.TOTP_Info; toSubMenuAbout.Click += OnMenuAboutClick; toMenuTrayTOTP.DropDownItems.Add(toSubMenuAbout); return(toMenuTrayTOTP); } else if (type == PluginMenuType.Entry) { var enMenuTrayTOTP = new ToolStripMenuItem(TrayTOTP_Plugin_Localization.strTrayTOTPPlugin); enMenuTrayTOTP.Image = Properties.Resources.TOTP; var enMenuCopyTOTP = new ToolStripMenuItem(TrayTOTP_Plugin_Localization.strCopyTOTP); enMenuCopyTOTP.Image = Properties.Resources.TOTP; enMenuCopyTOTP.ShortcutKeys = (Keys)Shortcut.CtrlT; enMenuCopyTOTP.Click += OnEntryMenuTOTPClick; var enMenuSetupTOTP = new ToolStripMenuItem(TrayTOTP_Plugin_Localization.strSetupTOTP); enMenuSetupTOTP.Image = Properties.Resources.TOTP_Setup; enMenuSetupTOTP.ShortcutKeys = (Keys)Shortcut.CtrlShiftI; enMenuSetupTOTP.Click += OnEntryMenuSetupClick; var enMenuShowQR = new ToolStripMenuItem(TrayTOTP_Plugin_Localization.strShowQR); enMenuShowQR.Image = Properties.Resources.TOTP_Setup; enMenuShowQR.ShortcutKeys = (Keys)Shortcut.CtrlShiftJ; enMenuShowQR.Click += OnEntryMenuShowQRClick; enMenuTrayTOTP.DropDownItems.Add(enMenuCopyTOTP); enMenuTrayTOTP.DropDownItems.Add(enMenuSetupTOTP); enMenuTrayTOTP.DropDownItems.Add(enMenuShowQR); enMenuTrayTOTP.DropDownOpening += delegate(object sender, EventArgs e) { enMenuCopyTOTP.Enabled = false; enMenuSetupTOTP.Enabled = false; bool boolCopy = m_host.CustomConfig.GetBool(setname_bool_EntryContextCopy_Visible, true); enMenuCopyTOTP.Visible = boolCopy; if (m_host.MainWindow.GetSelectedEntriesCount() == 1) { var CurrentEntry = m_host.MainWindow.GetSelectedEntry(true); if (SettingsCheck(CurrentEntry) && SeedCheck(CurrentEntry)) { if (SettingsValidate(CurrentEntry)) { enMenuCopyTOTP.Enabled = true; enMenuCopyTOTP.Tag = CurrentEntry; } } enMenuSetupTOTP.Enabled = true; } bool boolSetup = m_host.CustomConfig.GetBool(setname_bool_EntryContextSetup_Visible, true); enMenuSetupTOTP.Visible = boolSetup; }; enMenuTrayTOTP.DropDownClosed += delegate(object sender, EventArgs e) { enMenuCopyTOTP.Enabled = true; }; return(enMenuTrayTOTP); } return(null); // No menu items in other locations }
public static unsafe PluginMenuItem* createMenuItem(PluginMenuType type, int id, string text, string icon) { PluginMenuItem* menuItem = (PluginMenuItem*)Marshal.AllocHGlobal(sizeof(PluginMenuItem)).ToPointer(); menuItem->type = type; menuItem->id = id; //char* i_ptr = (char *) System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(icon).ToPointer(); my_strcpy(menuItem->icon, NativeConstants.PLUGIN_MENU_BUFSZ, (char*)Marshal.StringToHGlobalAnsi(icon).ToPointer()); //IntPtr t_ptr = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(text); //char* t_cptr = (char*)t_ptr.ToPointer(); my_strcpy(menuItem->text, NativeConstants.PLUGIN_MENU_BUFSZ, (char*)Marshal.StringToHGlobalAnsi(text).ToPointer()); return menuItem; }
/// <summary> /// Get a menu item of the plugin. See /// https://keepass.info/help/v2_dev/plg_index.html#co_menuitem /// </summary> /// <param name="t">Type of the menu that the plugin should /// return an item for.</param> public virtual ToolStripMenuItem GetMenuItem(PluginMenuType t) { return(null); }
public static unsafe void ts3plugin_onMenuItemEvent(ulong serverConnectionHandlerID, PluginMenuType type, int menuItemID, ulong selectedItemID) { }
public override ToolStripMenuItem GetMenuItem(PluginMenuType t) { // init a "null" menu item ToolStripMenuItem tsmi = null; if (t == PluginMenuType.Entry) { // create entry menu item tsmi = new ToolStripMenuItem("KeePassRDP"); // add the OpenRDP menu entry var tsmiOpenRDP = new ToolStripMenuItem { ShortcutKeys = KprMenu.GetShortcut(KprMenu.MenuItem.OpenRdpConnection, _config), ShowShortcutKeys = true, Text = KprMenu.GetText(KprMenu.MenuItem.OpenRdpConnection) }; tsmiOpenRDP.Click += OnOpenRDP_Click; tsmi.DropDownItems.Add(tsmiOpenRDP); // add the OpenRDPAdmin menu entry var tsmiOpenRDPAdmin = new ToolStripMenuItem { ShortcutKeys = KprMenu.GetShortcut(KprMenu.MenuItem.OpenRdpConnectionAdmin, _config), ShowShortcutKeys = true, Text = KprMenu.GetText(KprMenu.MenuItem.OpenRdpConnectionAdmin) }; tsmiOpenRDPAdmin.Click += OnOpenRDPAdmin_Click; tsmi.DropDownItems.Add(tsmiOpenRDPAdmin); // add the OpenRDPNoCred menu entry var tsmiOpenRDPNoCred = new ToolStripMenuItem { ShortcutKeys = KprMenu.GetShortcut(KprMenu.MenuItem.OpenRdpConnectionNoCred, _config), ShowShortcutKeys = true, Text = KprMenu.GetText(KprMenu.MenuItem.OpenRdpConnectionNoCred) }; tsmiOpenRDPNoCred.Click += OnOpenRDPNoCred_Click; tsmi.DropDownItems.Add(tsmiOpenRDPNoCred); // add the OpenRDPNoCredAdmin menu entry var tsmiOpenRDPNoCredAdmin = new ToolStripMenuItem { ShortcutKeys = KprMenu.GetShortcut(KprMenu.MenuItem.OpenRdpConnectionNoCredAdmin, _config), ShowShortcutKeys = true, Text = KprMenu.GetText(KprMenu.MenuItem.OpenRdpConnectionNoCredAdmin) }; tsmiOpenRDPNoCredAdmin.Click += OnOpenRDPNoCredAdmin_Click; tsmi.DropDownItems.Add(tsmiOpenRDPNoCredAdmin); // add the IgnoreCredEntry menu entry var tsmiIgnoreCredEntry = new ToolStripMenuItem { ShortcutKeys = KprMenu.GetShortcut(KprMenu.MenuItem.IgnoreCredentials, _config), ShowShortcutKeys = true, Text = KprMenu.GetText(KprMenu.MenuItem.IgnoreCredentials) }; tsmiIgnoreCredEntry.Click += OnIgnoreCredEntry_Click; tsmi.DropDownItems.Add(tsmiIgnoreCredEntry); // disable the entry menu when no database is opened tsmi.DropDownOpening += delegate(object sender, EventArgs e) { if (IsValid(m_host, false)) { tsmiIgnoreCredEntry.Checked = Util.IsEntryIgnored(m_host.MainWindow.GetSelectedEntry(true, true)); } }; } else if (t == PluginMenuType.Main) { // create the main menu options item tsmi = new ToolStripMenuItem(KprMenu.GetText(KprMenu.MenuItem.Options)); tsmi.Click += OnKPROptions_Click; } return(tsmi); }
public static unsafe void ts3plugin_onMenuItemEvent(ulong serverConnectionHandlerID, PluginMenuType type, int menuItemID, ulong selectedItemID) { var funcs = TSPlugin.Instance.Functions; IntPtr v = IntPtr.Zero; switch (type) { case PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL: switch (menuItemID) { case 1: // How to get all the channel's names // First, get a pointer to an array if (funcs.getChannelList(serverConnectionHandlerID, ref v) != Errors.ERROR_ok) { funcs.logMessage("Failed", LogLevel.LogLevel_ERROR, "Plugin", serverConnectionHandlerID); break; } // Convert it to a ulong* ulong* ptr = (ulong*) v.ToPointer(); // Iterate through the array for (ulong t = 0; ptr[t] != 0; t++) { // The String result string result; // The pointer result IntPtr res = IntPtr.Zero; /* Channel Variable Arguments: 1: The server connection ID 2: The iterated channel id 3: An IntPtr at 0, which signifies CHANNEL_NAME 4: A reference to stores results */ if ( funcs.getChannelVariableAsString(serverConnectionHandlerID, ptr[t], new IntPtr(0), ref res) != Errors.ERROR_ok) { // Error message funcs.logMessage("Error", LogLevel.LogLevel_WARNING, "Plugin", serverConnectionHandlerID); break; } // Convert the pointer to a string if ((result = Marshal.PtrToStringAnsi(res)) == null) break; // Print it funcs.printMessageToCurrentTab(result); } break; case 2: break; default: break; } break; } }