Jump to content

Now how to 'Plugin.Instance.UpdateConfiguration'


Recommended Posts

Posted (edited)

I have understood the new layout in plugins, I get it. 

I'm not sure why it was changed.... whatever....

 

 

But now I want to update my plugin configuration form the C# side of things.

 

I just keep getting errors. Can someone give me a hand please.

            var options = new PluginConfiguration.MessageOptions[]{};
            options[0].Messages = tempMessageList;

            Plugin.Instance.UpdateConfiguration(new PluginConfiguration(){Options = options});



Why can't I add my new option parameters to my plugin config?

 

Is it because it is a Generic List<String> as an element in an array?

Edited by chef
Posted (edited)

looks like you are creating an empty array. Arrays are sized when you create them

 

try something like

var options = new PluginConfiguration.MessageOptions[1]{};
options[0] = new PluginConfiguration.MessageOptions { Messages = tempMessageList };

or the full intializer syntax (untested)

var config = new PluginConfiguration {
     Options = new [] {
          new PluginConfiguration.MessageOptions {
               Messages = tempMessageList
          }
     }
};

Plugin.Instance.UpdateConfiguration(config);
Edited by rhodges

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...