NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 21 22 23 24 25 … 93 Next »
Config.xml saving

 
  • 0 Vote(s) - 0 Average
Config.xml saving
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 53,163
Threads: 958
Joined: May 2006
#1
2010-01-07, 06:06 AM
When I hit OK to exit Config.exe I am noting that the changes I make in the Plugins /settings/PluginSettings/MusicLibrary section are being reverted. If I hit cancel the changes are kept. Does GBPVR overwrite this section?

Note the section name is MusicLibrary the plugin name is MusicLibrary3 if that makes a difference.

Martin
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#2
2010-01-07, 06:42 AM (This post was last modified: 2010-01-07, 06:57 AM by whurlston.)
That will happen if you are writing to the file manually. You should be updating the XMLDocument passed by the form constructor. Config will save that when it exits using "OK".

Code:
namespace MovieLibrary
{
    public partial class ConfigForm : Form
    {
        private System.Xml.XmlDocument settingsXML;
        public const string cfgSection = "MovieLibrary";

        public ConfigForm(System.Xml.XmlDocument settings)
        {
            // move settings to a global variable so we can access it from other functions
            settingsXML = settings;

            // Initialize the form;
            InitializeComponent();
          
        }
  
        // Example function
        // Fired when user clicks the plugin settings ok or cancel button
        // This is not the main config ok cancel button
        private void Button_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;
            switch (btn.Name)
            {
                case "cmdOK":
                    // Update setting
                    settingsXML.SelectSingleNode("/settings/PluginSettings/MovieLibrary/MySetting").InnerText = "MyValue";

                    // Close the form
                    this.Close();
                    break;

                case "cmdCancel":
                    // Close the form without saving
                    this.Close();
                    break;
            }
        }
        
    }
}
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 53,163
Threads: 958
Joined: May 2006
#3
2010-01-07, 12:52 PM
Thanks whurlston that clarifies things and also the

if (!this.Plugin)

on the saves in the plugin code, I didn't account for this. The downside seems to be I can't avoid the user hitting cancel by config.exe

Martin
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#4
2010-01-07, 03:30 PM
mvallevand Wrote:Thanks whurlston that clarifies things and also the

if (!this.Plugin)

on the saves in the plugin code, I didn't account for this. The downside seems to be I can't avoid the user hitting cancel by config.exe

Martin

You could write the changes manually and update the xml document. Double coding but then it insures the save whether they hit OK or Cancel.
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 53,163
Threads: 958
Joined: May 2006
#5
2010-01-07, 08:06 PM
That sounds like a good idea (except the order sounds reversed).

Martin
Ommina
Offline

Senior Member

Posts: 330
Threads: 39
Joined: Feb 2006
#6
2010-01-08, 04:31 AM
A perspective from the other side: as a user, if I hit cancel, I'd be annoyed if the changes were saved anyway.
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 53,163
Threads: 958
Joined: May 2006
#7
2010-01-08, 06:32 AM
That depends, the setting that I am saving is the database update time, and the user did already hit OK to save the change in the Plugin's Windows form. The database itself has already been committed to disk too but the next rescan won't know about it.

The proper fix is to put the scan time somewhere else maybe even in the database.

Martin
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Settings config screen for class IEventNotification plugin imilne 9 3,679 2011-09-17, 06:06 PM
Last Post: sub
  config.xml & unvisible steeb 9 3,208 2011-06-19, 12:16 AM
Last Post: steeb
  Calling NextPVR restart after config.xml changes steeb 33 10,828 2011-05-02, 04:24 PM
Last Post: steeb
  Reading config.xml McBainUK 4 2,366 2009-03-26, 04:28 PM
Last Post: JavaWiz
  Plugin settings in the Config application Khurram 6 2,653 2008-06-09, 04:20 AM
Last Post: Khurram
  Easy .net snippet for accessing config.xml? zehd 3 1,768 2008-03-23, 05:58 AM
Last Post: zehd
  Start Menu Shortcut & config.xml Ommina 3 2,622 2007-12-19, 11:05 PM
Last Post: sub
  PVRX2 Plugin in Config all psycik 7 2,548 2007-08-18, 03:29 AM
Last Post: sub
  Help needed with error in config.exe.log idkpmiller 3 1,883 2007-01-24, 06:08 AM
Last Post: sub
  plugin not appearing in config but running in GBPVR idkpmiller 3 1,733 2006-11-08, 01:20 PM
Last Post: McBainUK

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode