Example #1
0
        /// <summary>
        /// Initializes the specified settings file name.
        /// </summary>
        /// <param name="settingsFileName">Name of the settings file.</param>
        public void Initialize(string settingsFileName)
        {
            if (settingsFileName == null)
            {
                throw new ArgumentNullException(nameof(settingsFileName));
            }

            try
            {
                IsInitialized = true;
                RetrieveLocalConfiguration(settingsFileName);
                LoadExternalAssemblies();


                _sendingPModeWatcher =
                    new PModeWatcher <SendingProcessingMode>(
                        Path.Combine(ApplicationPath, configurationfolder, sendpmodefolder),
                        SendingProcessingModeValidator.Instance);

                _receivingPModeWatcher =
                    new PModeWatcher <ReceivingProcessingMode>(
                        Path.Combine(ApplicationPath, configurationfolder, receivepmodefolder),
                        ReceivingProcessingModeValidator.Instance);

                _sendingPModeWatcher.Start();
                _receivingPModeWatcher.Start();
            }
            catch (Exception exception)
            {
                IsInitialized = false;
                Logger.Fatal(exception.Message);

                throw;
            }
        }
Example #2
0
        private static ConfiguredPMode GetPModeEntry <T>(string id, PModeWatcher <T> watcher) where T : class, IPMode
        {
            if (String.IsNullOrEmpty(id))
            {
                throw new KeyNotFoundException($"Given {typeof(T).Name} key is null");
            }

            ConfiguredPMode entry = watcher.GetPModeEntry(id);

            if (entry == null)
            {
                throw new ConfigurationErrorsException($"No {typeof(T).Name} found for {id}");
            }

            return(entry);
        }
Example #3
0
        private void PopulateSendingPModeCombobox()
        {
            if (_sendPModeWatcher != null)
            {
                _sendPModeWatcher.Stop();
                PModeCombobox.ItemsSource = new string[] { };
            }

            if (String.IsNullOrWhiteSpace(SendingPModeLocationTextBox.Text))
            {
                return;
            }

            _sendPModeWatcher = new PModeWatcher <SendingProcessingMode>(SendingPModeLocationTextBox.Text);
            _sendPModeWatcher.Start();

            PModeCombobox.ItemsSource = _sendPModeWatcher.GetPModes().OrderBy(p => p.Id);
        }