示例#1
0
        private void importFromDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                DB.SuspendTreeUpdates();
                var path = UserPreference.Lookup("bulk_import_folder");

                FolderBrowserDialog dlg = new FolderBrowserDialog();
                if (Directory.Exists(path))
                {
                    dlg.SelectedPath = path;
                }
                if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    UserPreference.Save("bulk_import_folder", dlg.SelectedPath);
                    BulkImportForm f = new BulkImportForm();
                    f.ImportClick += delegate {
                        BulkImportDirectory.Import(DB, f.SelectedPath, f.Filter, f.RegexFilter);
                    };
                    f.SelectedPath = dlg.SelectedPath;

                    f.ShowDialog();
                    DatabaseChanged();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                DB.ResumeTreeUpdates();
            }
        }
示例#2
0
        private void importFromDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {

                DB.SuspendTreeUpdates();
                var path = UserPreference.Lookup("bulk_import_folder");

                FolderBrowserDialog dlg = new FolderBrowserDialog();
                if (Directory.Exists(path))
                {
                    dlg.SelectedPath = path;
                }
                if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    UserPreference.Save("bulk_import_folder",dlg.SelectedPath);
                    BulkImportForm f = new BulkImportForm();
                    f.ImportClick += delegate {
                        BulkImportDirectory.Import(DB,f.SelectedPath, f.Filter,f.RegexFilter);
                    };
                    f.SelectedPath = dlg.SelectedPath;

                    f.ShowDialog();
                    DatabaseChanged();

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                DB.ResumeTreeUpdates();
            }
        }