Show / Hide Table of Contents

Configuration

Reading configuration file by (your) parent application

The configuration file modified by Portos eKasa Servis application is stored in text file with JSON format. To use same settings in your application, you can load same JSON file and pass its deserialized content to constructor of the Client class easily:

// path to the default working directory which contains configuration file
string ekasaWorkingDirectoryPath = Path.Combine(
  Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
  "NineDigit",
  "Portos.eKasa");

// full path to the confiuration file
string configurationFilePath = Path.Combine(ekasaWorkingDirectoryPath, "settings.json");

// create new instance of configuration reader
IDataSource<ClientConfiguration> configurationDataSource = new JsonClientConfigurationFileDataSource(configurationFilePath);

// load content of the configuration file into the configuration object
ClientConfiguration configuration = configurationDataSource.Load();

// finally, pass the configuration object to constructor of client class,
// so the client instance uses same settings as were edited in portos ekasa servis application
Client client = new Client(configuration);

The class JsonClientConfigurationFileDataSource is available in NuGet package NineDigit.eKasa.Configuration, in NineDigit.eKasa.Configuration.DataSources namespace.

Editing another configuration file in Portos eKasa Servis application

If you want to edit another configuration file in the Portos eKasa application, you can pick different file path in application by following these steps:

  1. click the menu button in upper right corner of portos ekasa servis application
  2. select the "nastavenia aplikácie" (application settings) menu item
  3. type in the path to the configuration file. You can use browse button to locate the file via select file dialog.
In This Article
Na začiatok stránky Nine Digit, s.r.o. ©