Пример #1
0
 /// <summary>
 /// Duplicate (Clone) a BatchInfo.
 /// </summary>
 /// <param name="other"></param>
 public BatchInfo(BatchInfo other)
     : this(other.FullPath)
 {
 }
Пример #2
0
        void tbox_savePath_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (saveMode == SaveMode.ExportResults)
            {
                if (Directory.Exists(tbox_savePath.Text))
                {
                    tbox_savePath.Background = new SolidColorBrush(Colors.White);
                    Properties.Settings.Default.saveFolderPath = tbox_savePath.Text;
                    Properties.Settings.Default.Save();
                }

                else
                    tbox_savePath.Background = new SolidColorBrush(Colors.Pink);

            }

            if (saveMode == SaveMode.CreateZipFile)
            {
                BatchInfo saveFile = new BatchInfo(tbox_savePath.Text);

                if (Directory.Exists(saveFile.Folder) && tbox_savePath.Text.ToLower().EndsWith(".zip"))
                {
                    tbox_savePath.Background = new SolidColorBrush(Colors.White);
                    Properties.Settings.Default.saveZipPath = tbox_savePath.Text;
                    Properties.Settings.Default.Save();
                }
                else
                    tbox_savePath.Background = new SolidColorBrush(Colors.Pink);
            }
        }
Пример #3
0
        void btn_BrowseButton_Click(object sender, RoutedEventArgs e)
        {
            if (saveMode == SaveMode.ExportResults)
            {
                using (var dialog = new FolderBrowserDialog())
                {

                    dialog.Description = "Open a destination folder";
                    dialog.RootFolder = Environment.SpecialFolder.MyComputer;
                    dialog.SelectedPath = Properties.Settings.Default.saveFolderPath ?? Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);
                    dialog.ShowNewFolderButton = true;

                    if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        Properties.Settings.Default.saveFolderPath = tbox_savePath.Text = dialog.SelectedPath;
                }
            }

            if (saveMode == SaveMode.CreateZipFile)
            {
                using (var dialog = new SaveFileDialog())
                {
                    dialog.InitialDirectory = Properties.Settings.Default.saveFolderPath ?? Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);
                    dialog.Filter = "Zip File(*.zip)|*.zip";

                    if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        BatchInfo saveFile = new BatchInfo(dialog.FileName);
                        Properties.Settings.Default.saveZipPath = tbox_savePath.Text = dialog.FileName;
                        Properties.Settings.Default.saveFolderPath = saveFile.Folder;
                    }

                }
            }
        }
Пример #4
0
        /// <summary>
        /// Check if file and folder configurations are OK.
        /// </summary>
        bool CheckFileSettings()
        {
            if (listView.Items.Count == 0)
            {
                System.Windows.MessageBox.Show("You must add a file.");
                return false;
            }

            if (saveMode == SaveMode.ExportResults)
            {
                if (!Directory.Exists(Properties.Settings.Default.saveFolderPath) || !Directory.Exists(tbox_savePath.Text))
                {
                    System.Windows.MessageBox.Show("The selected folder does not exist. Select a correct folder.");
                    return false;
                }
            }

            if (saveMode == SaveMode.CreateZipFile)
            {
                var saveFile = new BatchInfo(tbox_savePath.Text);

                if (!(Directory.Exists(saveFile.Folder) && tbox_savePath.Text.ToLower().EndsWith(".zip")))
                {
                    System.Windows.MessageBox.Show("You must select a valid destination ZIP file.");
                    return false;
                }

                if (string.IsNullOrEmpty(Properties.Settings.Default.saveZipPath))
                {
                    System.Windows.MessageBox.Show("You must select a destination ZIP file.");
                    return false;
                }
                var bInfo = new BatchInfo(Properties.Settings.Default.saveZipPath);

                if (!Directory.Exists(bInfo.Folder))
                {
                    System.Windows.MessageBox.Show("The selected folder does not exist. Select a correct folder.");
                    return false;
                }
            }
            return true;
        }
Пример #5
0
        void btn_addFiles_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var openFileDialog = new OpenFileDialog { Multiselect = true };

                var fileExtensions = ImageBuilder.Current.GetSupportedFileExtensions();

                string filter = "Image Files(*.BMP;*.JPG;*.GIF;*.PNG)|*.BMP;*.JPG;*.GIF;*.PNG";

                if (fileExtensions.Count() > 0)
                {
                    filter = "";
                    foreach (var fileExtension in fileExtensions)
                        filter += "*." + fileExtension.ToUpper() + ";";
                    filter.Remove(filter.Length - 1);

                    filter = "Image Files(" + filter + ")|" + filter;
                }

                openFileDialog.Filter = filter;

                if (!string.IsNullOrEmpty(Properties.Settings.Default.openFolderPath))
                    openFileDialog.InitialDirectory = Properties.Settings.Default.openFolderPath;

                if (openFileDialog.ShowDialog(this) == true)
                {
                    if (openFileDialog.FileNames.Length > 0)
                    {
                        BatchInfo openFile = new BatchInfo(openFileDialog.FileName);
                        Properties.Settings.Default.openFolderPath = openFile.Folder;

                        AddFilesToBatch(openFileDialog.FileNames);
                    }
                }

            }
            catch
            { }
        }