/// <summary>
        /// Handle configuration import request by user.
        /// </summary>
        private void OnImportConfiguration(object sender, EventArgs e)
        {
            // Not capable of exporting new configurations yet.
            if (IsDirty)
            {
                MessageBox.Show(_view, xWorksStrings.kstidConfigsChangedImport);
                return;
            }

            var importController = new DictionaryConfigurationImportController(_cache, _projectConfigDir, _configurations);

            using (var importDialog = new DictionaryConfigurationImportDlg(_mediator.HelpTopicProvider)
            {
                HelpTopic = _view.HelpTopic
            })
            {
                importController.DisplayView(importDialog);
            }

            if (!importController.ImportHappened)
            {
                return;
            }
            CloseDialogAndRefreshProject();
        }
Exemple #2
0
 /// <summary>
 /// Connect to and show a view for the user to perform an import.
 /// </summary>
 /// <param name="dialog"></param>
 public void DisplayView(DictionaryConfigurationImportDlg dialog)
 {
     _view = dialog;
     _view.browseButton.Click                    += (a, b) => OnBrowse();
     _view.importPathTextBox.TextChanged         += (a, b) => RefreshBasedOnNewlySelectedImportFile();
     _view.importButton.Click                    += (a, b) => DoImport();
     _view.doOverwriteRadioOption.CheckedChanged += (a, b) =>
     {
         if (_view.doOverwriteRadioOption.Checked)
         {
             UserRequestsOverwrite();
         }
         else
         {
             UserRequestsNotOverwrite();
         }
         RefreshStatusDisplay();
     };
     _view.overwriteGroupBox.Visible = false;
     _view.importButton.Enabled      = false;
     _view.ShowDialog();
 }