private void importToolStripMenuItem_Click()

in src/IdFix/FormApp.cs [614:668]


        private void importToolStripMenuItem_Click(object sender, EventArgs e)
        {
            statusDisplay(StringLiterals.ImportFile);
            SettingsManager.Instance.DistinguishedName = string.Empty;

            if (SettingsManager.Instance.CurrentRuleMode == RuleMode.MultiTenant)
            {
                this.Text = string.Format(StringLiterals.IdFixVersionFormat, Application.ProductVersion) + StringLiterals.MultiTenant + " - Import";
            }
            else
            {
                this.Text = string.Format(StringLiterals.IdFixVersionFormat, Application.ProductVersion) + StringLiterals.Dedicated + " - Import";
            }

            action.Items.Clear();
            action.Items.Add(StringLiterals.Edit);
            action.Items.Add(StringLiterals.Remove);
            action.Items.Add(StringLiterals.Complete);
            editActionToolStripMenuItem.Visible = true;
            removeActionToolStripMenuItem.Visible = true;
            undoActionToolStripMenuItem.Visible = false;

            try
            {
                using (OpenFileDialog openFileDialog = new OpenFileDialog())
                {
                    openFileDialog.Filter = StringLiterals.ImportFileFilter;
                    openFileDialog.Title = StringLiterals.ImportFile;
                    openFileDialog.ShowDialog();

                    if (!String.IsNullOrEmpty(openFileDialog.FileName))
                    {
                        //First reset firstRun
                        firstRun = false;

                        this.Invoke(new Action(() =>
                        {
                            using (var reader = new StreamReader(openFileDialog.FileName))
                            {
                                this.grid.SetFromCsv(reader);
                            }

                            EnableButtons();

                            statusDisplay(StringLiterals.ActionSelection);
                        }));
                    }
                }
            }
            catch (Exception err)
            {
                statusDisplay(StringLiterals.Exception + "Import CSV - " + err.Message);
                throw;
            }
        }