public void OnLoad() { DefaultDataUpdater.PerformUpdates(); Settings = PluginSettings.LoadSettings(PluginDataDir); MainMenuItem = new PluginMenuItem { Header = Name }; MainMenuItem.Click += (sender, args) => { if (MainWindow == null) { InitializeMainWindow(); Debug.Assert(MainWindow != null, "_mainWindow != null"); MainWindow.Show(); } else { MainWindow.Activate(); } }; Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckCreated.Add(HandleHearthstoneDeckUpdated); Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckUpdated.Add(HandleHearthstoneDeckUpdated); Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckDeleted.Add(HandleHearthstoneDeckDeleted); DispatcherTimer importTimer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 5) }; importTimer.Tick += ImportTimerOnTick; importTimer.IsEnabled = true; importTimer.Start(); }
private void DirectorySearch(PluginMenuItem menuItem, ToolStripMenuItem parentMenuItem, bool isLocal) { try { parentMenuItem.Name = menuItem.DirectoryFullPath; if (menuItem.DirectoryName == Folders.DirectoryName.Plugins) { menuItem.DirectoryName = parentMenuItem.Text; } parentMenuItem.Text = menuItem.DirectoryName; AddScriptsToMenu(menuItem.Scripts, parentMenuItem, isLocal); AddPluginsToMenu(menuItem.Plugins, parentMenuItem); foreach (var itemChild in menuItem.Children) { var dirToolStripMenuItem = new ToolStripMenuItem { Size = MenuSize }; DirectorySearch(itemChild, dirToolStripMenuItem, isLocal); parentMenuItem.DropDownItems.Add(dirToolStripMenuItem); } } catch (Exception e) { Console.WriteLine(e.Message); } }
protected override PluginMenuItem GetPluginsAndScripts(string baseDirectory) { var di = new DirectoryInfo(baseDirectory); var localFilesystem = Create.Filesystem.Local(); var menuItem = new PluginMenuItem { DirectoryName = di.Name, DirectoryFullPath = di.FullName, Scripts = localFilesystem.GetFiles(di.FullName, ".ps1"), Plugins = localFilesystem.GetFiles(di.FullName, ".dll") }; foreach (var chilDirectory in di.GetDirectories()) { if (chilDirectory.Name == ".git") { continue; } menuItem.Children.Add(GetPluginsAndScripts(chilDirectory.FullName)); } return(menuItem); }
public void PopulateToolStripMenuItemWithPluginsAndScripts(PluginMenuItem pluginMenuItem, bool isLocal) { pluginsToolStripMenuItem.DropDownItems.Clear(); DirectorySearch(pluginMenuItem, pluginsToolStripMenuItem, isLocal); MoveContainerPluginsIntoTheirOwnMenu(pluginsToolStripMenuItem); }
/// <summary> /// Constructor /// </summary> public StateLightSystemTray() { // Initialize Tray Icon trayIcon = new NotifyIcon() { Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location), ContextMenu = menu, Visible = true }; controller.TrayIcon = trayIcon; controller.SystemTray = this; trayIcon.MouseClick += (object sender, MouseEventArgs e) => { if (e.Button != MouseButtons.Left) { return; } controller.IconClicked(); }; GenerateContextMenu(); bool separatorAdded = false; foreach (PluginWrapper p in controller.Plugins.PluginList) { if (!separatorAdded) { menu.MenuItems.Add("-"); separatorAdded = true; } PluginMenuItem pm = new PluginMenuItem(controller, p); menu.MenuItems.Add(pm); pluginMenuItems.Add(pm); } menu.MenuItems.Add("-"); menu.MenuItems.Add("Version " + FILE_VERSION); menu.MenuItems.Add("-"); menu.MenuItems.Add(new MenuItem("Exit", (object sender, EventArgs e) => { controller.ShutdownApplication(); })); if (Properties.Settings.Default.AutostartPlugin) { foreach (PluginMenuItem it in pluginMenuItems) { // First Plugin enabled it.SetEnabled(true); return; } } }
private void AddMenuItem(Plugin source, PluginMenuItem item) { var menuItem = GetMenuItem(item.Path); menuItem.Tag = item; menuItem.Click -= CustomMenuItem_Click; // incase the key is not unique menuItem.Click += CustomMenuItem_Click; var root = GetRoot(menuItem); if (!menu.Items.Contains(root)) { menu.Items.Add(root); } }
public void OnLoad() { Settings = PluginSettings.LoadSettings(PluginDataDir); MainMenuItem = new PluginMenuItem { Header = Name }; MainMenuItem.Click += (sender, args) => { if (MainWindow == null) { InitializeMainWindow(); Debug.Assert(MainWindow != null, "_mainWindow != null"); MainWindow.Show(); } else { MainWindow.Activate(); } }; }
public static unsafe void ts3plugin_initMenus(PluginMenuItem*** menuItems, char** menuIcon) { int x = 2; int sz = x + 1; int n = 0; *menuItems = (PluginMenuItem**)Marshal.AllocHGlobal((sizeof(PluginMenuItem*) * sz)); string name = "Try"; string icon = "2.png"; (*menuItems)[n++] = UsefulFuncs.createMenuItem(PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL, 1, name, icon); (*menuItems)[n++] = UsefulFuncs.createMenuItem(PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL, 2, "Unload", icon); (*menuItems)[n++] = null; Debug.Assert(n == sz); *menuIcon = (char*)Marshal.AllocHGlobal(128 * sizeof(char)); IntPtr ptr = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi("t.png"); void* strPtr = ptr.ToPointer(); char* cptr = (char*)strPtr; UsefulFuncs.my_strcpy(*menuIcon, 128, cptr); }
public void OnLoad() { DefaultDataUpdater.PerformUpdates(); Settings = PluginSettings.LoadSettings(PluginDataDir); MainMenuItem = new PluginMenuItem(); MainMenuItem.Header = Name; MainMenuItem.Click += (sender, args) => { if (_mainWindow == null) { InitializeMainWindow(); _mainWindow.Show(); } else { _mainWindow.Activate(); } }; Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckCreated.Add(HandleHearthstoneDeckUpdated); Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckUpdated.Add(HandleHearthstoneDeckUpdated); }
private void Skype_PluginMenuItemClicked(PluginMenuItem pluginmenuitem, UserCollection usercollection, TPluginContext plugincontext, string contextid) { this.Logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name); }
public static unsafe void ts3plugin_initMenus(PluginMenuItem*** menuItems, char** menuIcon) { }
public static unsafe void InitMenusHelper(PluginMenuItem*** menuItems, char** MenuIcon, string iconname, List<NonNative.PluginMenuHelper> helpers) { // x represents the number of elements we want to create var x = helpers.Count; // size represents how many elements we should send back, because the last elements in menuItems should be null var size = x+1; // our 'indexer' int n = 0; // This is allocating for all our elements *menuItems = (PluginMenuItem**)Marshal.AllocHGlobal(sizeof(PluginMenuItem*) * size); // for each element in our array, put in our menu foreach (var e in helpers) { (*menuItems)[n++] = UsefulFuncs.createMenuItem(e.type, e.index, e.name, e.icon); } // Top it off with null (*menuItems)[n++] = null; Debug.Assert(n == size); *MenuIcon = (char*)Marshal.AllocHGlobal(NativeConstants.PLUGIN_MENU_BUFSZ * sizeof(char)); UsefulFuncs.my_strcpy(*MenuIcon, NativeConstants.PLUGIN_MENU_BUFSZ, (char*)Marshal.StringToHGlobalAnsi(iconname).ToPointer()); }
public void OurPluginMenuItemClicked(PluginMenuItem pluginmenuitem, UserCollection usercollection, TPluginContext plugincontext, string contextid) { // Always use try/catch with ANY Skype calls. try { // Write Plugin Menu Item Clicked to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + "Plugin Menu Item Clicked - Id: " + pluginmenuitem.Id + " - User Count: " + usercollection.Count + " - Context: " + plugincontext + " - Context Id: " + contextid + "\r\n"); } catch (Exception e) { // Possibly old Skype4COM version, log an error, drop into debug if wanted. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + "Plugin Menu Item Clicked Event Fired - Bad Text" + " - Exception Source: " + e.Source + " - Exception Message: " + e.Message + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); } }