Unique Configuration Class

Unique Configuration Class

The settings class is a Serializable class that you define with properties that are necessary to configure your external store object.  The configuration object is used to dynamically generate a user interface to configure your external store object. The properties can be of the following types:

The configuration class must be marked with the [Serializable] with attribute because the configuration settings for your external store object are serialized and stored in the advanced.config file.  It also must be marked with the[ExternalStoreConfigurationAttribute] attribute so that the framework can locate the configuration class in your external store-addin.

Each property is decorated with one or more attributes:

The constructor of the configuration class is used to assign default values for all class members, and the defaults will be the initial values displayed when the tutorial external store user-interface is displayed for the first time.

For the tutorial, we will create an external store addin that stores the DICOM datasets in a folder that you specify in the external store configuration UI. 

We will create a configuration that causes the following user interface to be generated:

      

Most of the user-interface will be not actually be used to configure the external store add-in, but instead serves as a demonstration of the different user-interface objects that can be created.

External Store Generated User Interface

We now define the following class to generate this user-interface:

Unique Configuration Class

Copy Code

// Configuration Class 
[Serializable] 
[ExternalStoreConfigurationAttribute] 
public class TutorialConfiguration 
{ 
   [DisplayNameAttribute("User ID")] 
   [ControlAttribute(Width = 400)] 
   public string UserId 
   { 
      get; 
      set; 
   } 
   [DisplayNameAttribute("Password")] 
   [ControlAttribute(Width = 400, Password = true)] 
   public string Password 
   { 
      get; 
      set; 
   } 
   [DisplayNameAttribute("Name")] 
   [ControlAttribute(Width = 400)] 
   public string Name 
   { 
      get; 
      set; 
   } 
   TutorialGenderEnum _gender; 
   [DisplayNameAttribute("Gender")] 
   [ControlAttribute(Width = 200, Height = 30)] 
   public TutorialGenderEnum Gender 
   { 
      get { return _gender; } 
      set { _gender = value; } 
   } 
   [DisplayNameAttribute("Age (0..99)")] 
   [RangeAttribute(0, 99)] 
   public int Age 
   { 
      get; 
      set; 
   } 
      
   [DisplayNameAttribute("Location")] 
   [ControlAttribute(Width = 400)] 
   public string Location 
   { 
      get; 
      set; 
   } 
   private bool _storeLocally; 
   [DisplayNameAttribute("Store Locally")] 
   public bool StoreLocally 
   { 
      get { return _storeLocally; } 
      set { _storeLocally = value; } 
   } 
   public TutorialConfiguration() 
   { 
      UserId = "Enter User ID"; 
      Password = "Enter Password"; 
      Name = "Enter Name"; 
      Age = 18; 
      StoreLocally = true; 
      Location = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ExternalStoreTutorialStore"); 
   } 
} 
   public enum TutorialGenderEnum 
   { 
      [Description("Male")] 
      Male = 0, 
      [Description("Female")] 
      Female = 1, 
      [Description("Unknown")] 
      Unknown = 2 
   } 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Imaging, Medical, and Document