Пример #1
0
        public PluginInfo Initialise(IntPtr apiInterfacePtr)
        {
            mbApiInterface = new MusicBeeApiInterface();
            mbApiInterface.Initialise(apiInterfacePtr);
            about.PluginInfoVersion = PluginInfoVersion;
            about.Name                     = "Philips Hue";
            about.Description              = "Match your Philips Hue lights to the current song album art\n More Help: github.com/TroyFernandes/MusicBee-Philips-Hue";
            about.Author                   = "Troy Fernandes (github.com/TroyFernandes)";
            about.TargetApplication        = ""; // current only applies to artwork, lyrics or instant messenger name that appears in the provider drop down selector or target Instant Messenger
            about.Type                     = PluginType.General;
            about.VersionMajor             = 1;  // your plugin version
            about.VersionMinor             = 1;
            about.Revision                 = 1;
            about.MinInterfaceVersion      = MinInterfaceVersion;
            about.MinApiRevision           = MinApiRevision;
            about.ReceiveNotifications     = (ReceiveNotificationFlags.PlayerEvents | ReceiveNotificationFlags.TagEvents);
            about.ConfigurationPanelHeight = 0;   // height in pixels that musicbee should reserve in a panel for config settings. When set, a handle to an empty panel will be passed to the Configure function
            ToolStripMenuItem mainMenuItem = (ToolStripMenuItem)mbApiInterface.MB_AddMenuItem("mnuTools/Hue Artwork", null, null);

            mainMenuItem.DropDown.Items.Add("Settings", null, OnOpen);
            mainMenuItem.DropDown.Items.Add("Stop", null, stopPlugin);
            mainMenuItem.DropDown.Items.Add("Resume", null, resumePlugin);
            Settings.Instance.storagePath = mbApiInterface.Setting_GetPersistentStoragePath();
            Settings.Instance.Initialize();
            Settings.Instance.loadSettings(mbApiInterface.Setting_GetPersistentStoragePath());
            Configuration.Initialize(Settings.Instance.APIKey);
            settingsSelector.startup();
            lights = new LightCollection();
            try
            {
                foreach (string lightNames in Settings.Instance.HueLights)
                {
                    new LightStateBuilder().For(lights[lightNames]).TurnOn().Apply();
                }
            }
            catch (NullReferenceException e)
            {
                Console.WriteLine(e.ToString());
            }

            return(about);
        }
Пример #2
0
 private void OnOpen(object sender, EventArgs args)
 {
     settingsSelector = new SettingsSelector();
     settingsSelector.startup();
     settingsSelector.Show();
 }