Ejemplo n.º 1
0
 private void tsmiImportFiles_Click(object sender, EventArgs e)
 {
     OpenFileDialog openFileDialog = new OpenFileDialog();
     openFileDialog.InitialDirectory = @"D:\";
     openFileDialog.RestoreDirectory = true;
     openFileDialog.Title = Resources.MainForm_tsmiSelectFiles_Click_addBooks;
     openFileDialog.Filter = "All File(*.*)|*.*";
     openFileDialog.ValidateNames = true;
     openFileDialog.CheckFileExists = true;
     openFileDialog.CheckPathExists = true;
     openFileDialog.Multiselect = true;
     try
     {
         if (openFileDialog.ShowDialog() == DialogResult.OK)
         {
             string[] bookFiles = openFileDialog.FileNames;
             CategoryForm categoryForm = new CategoryForm();
             if (categoryForm.ShowDialog() == DialogResult.OK)
             {
                 bookManagement.ImportBooks(bookFiles, (TreeNode)categoryForm.Tag);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(Resources.MainForm_tsmiSelectFiles_Click_ErrorAddBooks + ex.Message);
     }
     showUI(true);
 }
Ejemplo n.º 2
0
 private void tsmiImportFolder_Click(object sender, EventArgs e)
 {
     try
     {
         FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
         folderBrowserDialog.Description = Resources.MainForm_tsmiSelectFolder_Click_addBooksFolderPlease;
         folderBrowserDialog.RootFolder = Environment.SpecialFolder.MyComputer;
         folderBrowserDialog.ShowNewFolderButton = false;
         if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
         {
             string folderPath = folderBrowserDialog.SelectedPath;
             CategoryForm categoryForm = new CategoryForm();
             if (categoryForm.ShowDialog() == DialogResult.OK)
             {
                 bookManagement.ImportBookDirectory(folderPath, (TreeNode)categoryForm.Tag);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(Resources.MainForm_tsmiSelectFolder_Click_addBooksFolderError + ex.Message);
     }
     showUI(true);
 }
Ejemplo n.º 3
0
 private void tsmiCategoryManage_Click(object sender, EventArgs e)
 {
     CategoryForm frm = new CategoryForm();
     frm.ShowDialog();
 }