public bool Configure(IntPtr panelHandle) { // save any persistent settings in a sub-folder of this path string dataPath = mbApiInterface.Setting_GetPersistentStoragePath(); // panelHandle will only be set if you set about.ConfigurationPanelHeight to a non-zero value // keep in mind the panel width is scaled according to the font the user has selected // if about.ConfigurationPanelHeight is set to 0, you can display your own popup window if (panelHandle != IntPtr.Zero) { newConfig = (Configuration)config.Clone(); Panel configPanel = (Panel)Panel.FromHandle(panelHandle); CheckBox showYear = new CheckBox(); showYear.Name = "ShowYear"; showYear.Text = "Show year next to album"; showYear.Height = 16; showYear.ForeColor = Color.FromArgb(mbApiInterface.Setting_GetSkinElementColour(SkinElement.SkinInputPanelLabel, ElementState.ElementStateDefault, ElementComponent.ComponentForeground)); showYear.Checked = newConfig.showYear; showYear.CheckedChanged += ShowYearValueChanged; configPanel.Controls.AddRange(new Control[] { showYear }); } return(false); }
private void LoadConfig(string dataPath) { DataContractSerializer dataContractSerializer = new DataContractSerializer(typeof(Plugin.Configuration)); FileStream fileStream = new FileStream(Path.Combine(dataPath, "mb_DiscordRichPresence.xml"), FileMode.Open); config = (Plugin.Configuration)dataContractSerializer.ReadObject(fileStream); fileStream.Close(); }
// called by MusicBee when the user clicks Apply or Save in the MusicBee Preferences screen. // its up to you to figure out whether anything has changed and needs updating public void SaveSettings() { // save any persistent settings in a sub-folder of this path string dataPath = mbApiInterface.Setting_GetPersistentStoragePath(); config = newConfig; SaveConfig(dataPath); }