public void AddTerm(string source, string target)
 {
     if (_providerSettings.IsReadOnly)
     {
         MessageBox.Show("Terminology Provider is configured as read only!", "Read Only", MessageBoxButtons.OK);
         return;
     }
     if (!_providerSettings.IsFileReady())
     {
         MessageBox.Show(
             @"The excel file configured as a terminology provider appears to be also opened in the Excel application. Please close the file!",
             @"Excel file is used by another process",
             MessageBoxButtons.OK);
         return;
     }
     AddTermInternal(source, target);
     Task.Run(Save);
 }
        protected override void OnClosing(CancelEventArgs e)
        {
            if (DialogResult == DialogResult.Cancel ||
                DialogResult == DialogResult.No ||
                DialogResult == DialogResult.Abort)
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(separatorTextBox.Text) || string.IsNullOrWhiteSpace(pathTextBox.Text))
            {
                MessageBox.Show(@"Please complete all fields", "", MessageBoxButtons.OK);
                e.Cancel = true;
                return;
            }

            var provider = new ProviderSettings
            {
                HasHeader      = hasHeader.Checked,
                ApprovedColumn = approvedBox.Text.ToUpper(),
                SourceColumn   = sourceBox.Text.ToUpper(),
                TargetColumn   = targetBox.Text.ToUpper(),
                SourceLanguage = (CultureInfo)sourceLanguageComboBox.SelectedItem,
                TargetLanguage = (CultureInfo)targetLanguageComboBox.SelectedItem,
                Separator      = separatorTextBox.Text[0],
                IsReadOnly     = chkIsReadOnly.Checked,
                TermFilePath   = pathTextBox.Text,
            };

            if (!provider.IsFileReady())
            {
                MessageBox.Show(
                    @"The excel file configured as a terminology provider appears to be also opened in the Excel application. Please close the file!",
                    @"Excel file is used by another process",
                    MessageBoxButtons.OK);
                e.Cancel = true;
                return;
            }

            _providerSettings = provider;
        }