Profile Picture

IService.ShowCustomSettingsForm

Posted By bobferg 2 Years Ago
Message
Posted Thursday January 15 2015
The ShowCustomSettingsForm method is not working for me.
The code never enters the HasCustomSettings() method an simply shows a blank form rather than my custom form.
Wonder what I have done wrong?
Checked the various the example projects and my code seems to conform with the examples.
I am using build 53 and targeting .Net 4.5.
Here is my code:
  public IService GetService() { return this; }
   public bool HasCustomSettings()
   {
    return true;
   }
   public bool ShowCustomSettingsForm(ref SerializableDictionary<string, string> settings)
   {
    // IMPLEMENT DIALOG BOX HERE
    ServiceSetupDialog dlg = new ServiceSetupDialog();
    return dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK;
    }






Posted Friday January 16 2015
My first guess would be that RightEdge is loading an older version of your service DLL.

Have you copied the right version to the RightEdge plugins folder?

If that doesn't help, try the following:
  • Debug RightEdge in Visual Studio
  • Go to the blank form
  • Break execution
  • Examine the loaded modules (Debug\Windows\Modules) to see if your DLL is loaded and where it's loaded from
Thanks,
Daniel
Posted Sunday January 18 2015
All loaded modules are from the most recently built DLL in the plugins folder.
I changed the code slightly for our IDataStore derived class to alos inherit from IService:
public class PremiumDataDataStore : IDataStore, IService
Now get slightly different results as on the attachment, but still no cigar.


Attachments
Doc1.pdf (270 views, 142.00 KB)
Posted Sunday January 18 2015
I see, you're writing a data storage plugin.  There's various types of plugins in RightEdge, and some of them are written differently.

A data store plugin is different from a service plugin.  It doesn't need to implement IService, and it doesn't use HasCustomSettings and ShowCustomSettingsForm.

By default, settings for a data store plugin are edited using a PropertyGrid.  This will automatically show the public properties of your class and allow them to be edited.  You can customize this in various ways- for example setting the name and description of a property with the DisplayNameAttribute and DescriptionAttribute.  An example of a plugin that does this is the BinaryDataStore.

You can also define a custom UI to edit your data storage plugin's properties.  To do so, create a Windows Forms Control with your custom UI which implements the IPluginEditor interface.  Then on the plugin class, put a PluginEditorAttribute that points to the class with your IPluginEditor implementation.  The LinqToSQLStorage plugin is an example of how to do this.

Let me know if you have any issues.

Thanks,
Daniel
Posted Monday January 19 2015
Thanks Daniel.
Posted Tuesday January 20 2015
Still having a little trouble with this.
Can see that the public properties of my class derived from IDataStore are saved in AppData\Roaming\Yye_Software\...\user.config xml file when entered in the "Plugin Settings" dialog.
However I can't find a method to load these saved settings on derived class instantiation.
I wouldn't think that they have to be manually read from the user.config file.
Will probably have to design a custom UI anyway, but nevertheless would still like to understand the process.

Posted Tuesday January 20 2015
You shouldn't need to explicitly load the settings.  RightEdge saves and loads the properties of your plugin using Xml Serialization.

Thanks,
Daniel
Posted Tuesday January 20 2015
I can see the property values are being saved in user.config and the "Plugin Settings" dialog is reading them correctly.
Problem is the saved values are not making it into the public properties of the derived IDataStore class upon instantiation.
  public PaddingType PaddingSettings { get; set; }
  public AdjustmentType DilutionSettings { get; set; }

Posted Tuesday January 20 2015
Problem solved.
The public properties of the IDataStore derived class must be populated with saved settings sometime AFTER instantiation.
The saved properties of the IDataSore derived class were available to the constructor of the class derived from IDataAccessor<T> class.
So we can pass those saved properties to our private data retreival class at that point.
Thanks for your help.
Regards,
Bob.




 




Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems