Esempio n. 1
0
        //The Click Event for the 'Save' PictureBox button
        private void pbSave_Click(object sender, EventArgs e)
        {
            //If the user is saving for the first time
            if (String.IsNullOrEmpty(selectedPath))
            {
                // Displays a FolderBrowserDialog so that the user could choose where to save the images
                FolderBrowserDialog fbDialog = new FolderBrowserDialog();

                //The message shown to the user
                fbDialog.Description = "Select the directory where you want to save the images";

                //Set the default folder to 'My Documents'
                fbDialog.RootFolder = Environment.SpecialFolder.MyDocuments;

                // Show the FolderBrowserDialog
                DialogResult result = fbDialog.ShowDialog();

                //Get the selsected directory
                if (result == DialogResult.OK)
                {
                    selectedPath = fbDialog.SelectedPath;
                }
            }

            // If the file name is not an empty string open it for saving
            if (!String.IsNullOrEmpty(selectedPath))
            {
                //Create a new instance of the saving progress form, passing the full image URLs, selected images, search text, page number and selected path as input
                SavingProgressForm progressForm = new SavingProgressForm(fullImages, imageSelected, searchText, pageNumber, selectedPath);

                //Show the saving progress form
                progressForm.ShowDialog();
            }
        }
        //The Click Event for the 'Save' PictureBox button
        private void pbSave_Click(object sender, EventArgs e)
        {
            //If the user is saving for the first time
            if (String.IsNullOrEmpty(selectedPath))
            {
                // Displays a FolderBrowserDialog so that the user could choose where to save the images
                FolderBrowserDialog fbDialog = new FolderBrowserDialog();

                //The message shown to the user
                fbDialog.Description = "Select the directory where you want to save the images";

                //Set the default folder to 'My Documents'
                fbDialog.RootFolder = Environment.SpecialFolder.MyDocuments;

                // Show the FolderBrowserDialog
                DialogResult result = fbDialog.ShowDialog();

                //Get the selsected directory
                if (result == DialogResult.OK)
                {
                    selectedPath = fbDialog.SelectedPath;
                }
            }

            // If the file name is not an empty string open it for saving
            if (!String.IsNullOrEmpty(selectedPath))
            {
                //Create a new instance of the saving progress form, passing the full image URLs, selected images, search text, page number and selected path as input
                SavingProgressForm progressForm = new SavingProgressForm(fullImages, imageSelected, searchText, pageNumber, selectedPath);

                //Show the saving progress form
                progressForm.ShowDialog();
            }
        }