Esempio n. 1
0
        public void onSeparateFilesFinish(DirectoryHandler dh, ProgressEventArgs e)
        {
            progressBarOutputProcess.Value++;
            progressBarOutputProcess.UpdateLayout();

            System.Windows.Forms.MessageBox.Show("Process finished!", "Descartes", MessageBoxButtons.OK, MessageBoxIcon.Information);
            System.Collections.Hashtable stats = dh.getProcessStats();
            labelSummaryTotalFiles.Content = stats["input"];
            labelSummarySelectedFiles.Content = stats["selected"];
            labelSummaryDiscardedFiles.Content = stats["discarded"];
            labelSummaryIgnoredFiles.Content = stats["ignored"];
            tabItemInput.IsEnabled = false;
            tabItemProcess.IsEnabled = false;
            tabItemOutput.IsEnabled = false;
            tabItemEnd.IsEnabled = true;
            tabItemEnd.Focus();
        }
Esempio n. 2
0
        public void separateFiles()
        {
            Boolean ret = true;
            Int32 totalFiles = 0;
            try
            {
                if (this.GenerateFileStructureForDiscardedFiles || this.GenerateFileStructureForSelectedFiles)
                    this.checkAndCreateOutputDirs();

                //start collect process with discarded files
                StreamWriter fileWriter = new StreamWriter(this.DiscardedFilesListFileFullName);
                foreach (Image item in this.discardedList.getList())
                {
                    foreach (File file in item.getFiles())
                    {
                        //write discarded files list file
                        if (this.GenerateListFileForDiscardedFiles)
                            fileWriter.WriteLine(file.Name);

                        //write discarded files structure
                        if (this.GenerateFileStructureForDiscardedFiles)
                        {
                            file.move(this.OutputDiscardedPath + @"\" + file.Name, this.KeepCopyOfDiscardedFiles);
                        }
                        totalFiles++;

                        if (Progress != null)
                        {
                            ProgressEventArgs progress = new ProgressEventArgs();
                            progress.Progress = totalFiles;
                            Progress(this, progress);

                        }
                    }
                }
                fileWriter.Flush();
                fileWriter.Close();
                fileWriter.Dispose();

                //next collect process with selected files
                fileWriter = new StreamWriter(this.SelectedFilesListFileFullName);
                foreach (Image item in this.selectedList.getList())
                {
                    foreach (File file in item.getFiles())
                    {
                        //selectedFilesPlainList.Add(file.ToString());
                        if (this.GenerateListFileForSelectedFiles)
                            fileWriter.WriteLine(file.Name);

                        if (this.GenerateFileStructureForSelectedFiles)
                        {
                            //write selected files structure
                            file.move(this.OutputSelectedPath + @"\" + file.Name, this.KeepCopyOfSelectedFiles);
                        }
                        totalFiles++;

                        if (Progress != null)
                        {
                            ProgressEventArgs progress = new ProgressEventArgs();
                            progress.Progress = totalFiles;
                            Progress(this, progress);
                        }
                    }
                }
                fileWriter.Flush();
                fileWriter.Close();
                fileWriter.Dispose();

                if (Finish != null)
                {
                    ProgressEventArgs progress = new ProgressEventArgs();
                    progress.Progress = totalFiles;
                    progress.Data.Add("totalFiles",totalFiles);
                    Finish(this, progress);
                }

            }
            catch (Exception ex)
            {

                ret = false;
            }
            //return ret;
        }
Esempio n. 3
0
 public void onSeparateFilesProgress(DirectoryHandler dh, ProgressEventArgs e)
 {
     progressBarOutputProcess.Value++;
     progressBarOutputProcess.UpdateLayout();
     System.Windows.Forms.Application.DoEvents();
 }