Ejemplo n.º 1
0
        private async Task LoadPluginConfiguration(string filePath, Action <PluginDescription> setter, TextBox textBox)
        {
            if (!this.IsControlsEnabled)
            {
                return;
            }

            textBox.Text = string.Empty;

            ToggleControls(false, Properties.OutputStrings.LoadingPluginConfiguration);

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            if (!File.Exists(filePath))
            {
                return;
            }

            PluginDescription pluginDescription = null;

            try
            {
                pluginDescription = await PluginDescription.LoadAsync(filePath);
            }
            catch (Exception ex)
            {
                _iWriteToOutput.WriteErrorToOutput(null, ex);

                pluginDescription = null;
            }

            setter(pluginDescription);

            this._allEntities = null;

            textBox.Dispatcher.Invoke(() =>
            {
                if (pluginDescription != null)
                {
                    textBox.Text = filePath;
                }
                else
                {
                    textBox.Text = string.Empty;
                }
            });

            ToggleControls(true, Properties.OutputStrings.LoadingPluginConfigurationCompleted);

            ShowExistingAssemblies();
        }
Ejemplo n.º 2
0
        private async Task LoadPluginConfiguration(string filePath)
        {
            if (!this.IsControlsEnabled)
            {
                return;
            }

            this.Dispatcher.Invoke(() =>
            {
                this._itemsSource.Clear();

                txtBFilePath.Text = string.Empty;
            });

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            if (!File.Exists(filePath))
            {
                return;
            }

            ToggleControls(false, Properties.OutputStrings.LoadingPluginConfiguration);

            try
            {
                this._pluginDescription = await PluginDescription.LoadAsync(filePath);
            }
            catch (Exception ex)
            {
                _iWriteToOutput.WriteErrorToOutput(null, ex);

                this._pluginDescription = null;
            }

            txtBFilePath.Dispatcher.Invoke(() =>
            {
                if (this._pluginDescription != null)
                {
                    txtBFilePath.Text = filePath;
                }
                else
                {
                    txtBFilePath.Text = string.Empty;
                }
            });

            ToggleControls(true, Properties.OutputStrings.LoadingPluginConfigurationCompleted);

            ShowExistingPluginTypes();
        }
        private async Task LoadPluginConfiguration(string filePath)
        {
            if (!this.IsControlsEnabled)
            {
                return;
            }

            txtBFilePath.Text = string.Empty;

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            if (!File.Exists(filePath))
            {
                return;
            }

            ToggleControls(null, false, Properties.WindowStatusStrings.LoadingPluginAssemblies);

            try
            {
                this._pluginDescription = await PluginDescription.LoadAsync(filePath);
            }
            catch (Exception ex)
            {
                _iWriteToOutput.WriteErrorToOutput(null, ex);

                this._pluginDescription = null;
            }

            txtBFilePath.Dispatcher.Invoke(() =>
            {
                if (this._pluginDescription != null)
                {
                    txtBFilePath.Text = filePath;
                }
                else
                {
                    txtBFilePath.Text = string.Empty;
                }
            });

            ShowExistingAssemblies();
        }