Ejemplo n.º 1
0
        private async void ButtonSubmit_Click(object sender, EventArgs e)
        {
            var res = await LastFm.Login(TextBoxKey.Text, TextBoxSecret.Text, TextBoxUsername.Text, TextBoxPassword.Text);

            string msg = null;

            switch (res.Type)
            {
            case LastFm.ResponseType.Net:
                msg = "Network error!";
                break;

            case LastFm.ResponseType.Auth:
                msg = "Login failed!";
                break;

            case LastFm.ResponseType.Values:
                msg = "Missing values!";
                break;

            case LastFm.ResponseType.Key:
                msg = "Invalid key!";
                break;

            case LastFm.ResponseType.Secret:
                msg = "Invalid secret!";
                break;
            }

            if (msg != null)
            {
                MessageBox.Show(msg, "ScrobbleBee", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Settings.Session = res.Data;
            Settings.Key     = TextBoxKey.Text;
            Settings.Secret  = TextBoxSecret.Text;
            Settings.Save();
            Close();
        }
Ejemplo n.º 2
0
        public PluginInfo Initialise(IntPtr apiPtr)
        {
            Api = new MusicBeeApiInterface();
            Api.Initialise(apiPtr);
            Api.Player_SetScrobbleEnabled(false);

            Settings.Load();
            LastFm.Login(Settings.Key, Settings.Secret, Settings.Session);

            return(new PluginInfo {
                Type = PluginType.General,
                Name = "ScrobbleBee",
                Description = "Customizable scrobbling for MusicBee.",
                Author = "Karl Köörna",
                VersionMajor = 1,
                VersionMinor = 0,
                Revision = 1,
                PluginInfoVersion = PluginInfoVersion,
                MinInterfaceVersion = MinInterfaceVersion,
                MinApiRevision = MinApiRevision,
                ReceiveNotifications = ReceiveNotificationFlags.PlayerEvents | ReceiveNotificationFlags.TagEvents,
                ConfigurationPanelHeight = 0
            });
        }