예제 #1
0
        } // end InitializeComponent

        #endregion

        #region GetRenamingPropertiesAndRename

        /// <summary>
        /// Displays the Renaming Properties Form to the user, and if the user presses the "OK" button,
        /// then the properties selected are sent to the renamer process.  At that point, a thread will be started
        /// to process the renamer process's RenameFiles method to rename the files.
        /// </summary>
        private void GetRenamingPropertiesAndRename()
        {
            // If the file renamer property dialog has not been instantiated, do so.
            if (_frmFileRenamerProps == null)
            {
                _frmFileRenamerProps = new FileRenamerPropertiesForm();
            } // end if

            if (_frmFileRenamerProps.ShowDialog(this) == DialogResult.OK)
            {
                RenamerProcess renamerProcess = new RenamerProcess(_sFileNames,
                                                                   (RenamingTypes)Enum.Parse(typeof(RenamingTypes), _frmFileRenamerProps.ItemToUpdate),
                                                                   _frmFileRenamerProps.FilenameTemplate,
                                                                   _frmFileRenamerProps.TimeOffset,
                                                                   _frmFileRenamerProps.SortingOption,
                                                                   _frmFileRenamerProps.TestRun);

                if (!_frmFileRenamerProps.TestRun)
                {
                    _bRunFileRenaming = false;
                } // end if
                else
                {
                    _bUndo = false;
                } // end else

                Rename(renamerProcess);
            } // end if
        } // end GetRenamingPropertiesAndRename
예제 #2
0
        } // end GetRenamingPropertiesAndRename

        #endregion

        #region Rename

        private void Rename(RenamerProcess renamerProcess)
        {
            Thread thread;

            renamerProcess.FileRenamed += new FileRenamedEventHandler(AddRenamedFileToLog);
            renamerProcess.Finished += new RenamingFinished(HandleRenamingComplete);
            Cursor = Cursors.WaitCursor;

            _iFilesRenamed = 0;
            _prgRenaming.Value = 0;

            thread = new Thread(new ThreadStart(renamerProcess.RenameFiles));

            thread.Start();
        } // end Rename