Beispiel #1
0
        public void ThreadProcMetadata()
        {
            if (_myMetadataForm == null)
            {
                _myMetadataForm = new FormManageMetadata(this);
                Application.Run(_myMetadataForm);
            }
            else
            {
                if (_myMetadataForm.InvokeRequired)
                {
                    // Thread Error
                    _myMetadataForm.Invoke((MethodInvoker) delegate { _myMetadataForm.Close(); });
                    _myMetadataForm.FormClosed += CloseMetadataForm;

                    _myMetadataForm = new FormManageMetadata(this);
                    Application.Run(_myMetadataForm);
                }
                else
                {
                    try
                    {
                        // No invoke required - same thread
                        _myMetadataForm.FormClosed += CloseMetadataForm;
                        _myMetadataForm             = new FormManageMetadata(this);

                        Application.Run(_myMetadataForm);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Cannot close the form that is open. The reported reason is: " + ex);
                    }
                }
            }
        }
Beispiel #2
0
        public FormManageValidation(FormManageMetadata parent)
        {
            _myParent = parent;
            InitializeComponent();

            // Make sure the validation information is available in this form.
            try
            {
                var validationFile = GlobalParameters.ConfigurationPath + GlobalParameters.ValidationFileName + '_' + GlobalParameters.WorkingEnvironment + GlobalParameters.FileExtension;

                // If the config file does not exist yet, create it by calling the EnvironmentConfiguration Class
                if (!File.Exists(validationFile))
                {
                    ValidationSetting.CreateDummyValidationFile(validationFile);
                }

                // Load the validation settings file using the paths retrieved from the application root contents (configuration path)
                ValidationSetting.LoadValidationFile(validationFile);

                richTextBoxInformation.Text += $@"The validation file {validationFile} has been loaded.";

                // Apply the values to the form
                LocalInitialiseValidationSettings();
            }
            catch (Exception)
            {
                // Do nothing
            }
        }