Exemple #1
0
 internal Presenter(ICopyEngine copyEngine, ICopyViewer copyViewer, DirectoryEngine directoryEngine, SynchronizeEngine synchronizeEngine, IProfileManager profileManager)
 {
     _copyEngine        = copyEngine;
     _copyViewer        = copyViewer;
     _directoryEngine   = directoryEngine;
     _synchronizeEngine = synchronizeEngine;
     _copyViewer.OnPreviousSelectionSelectedIndexChanged += new PreviousSelectionSelectedIndexChangedHandler(_copyViewer_OnPreviousSelectionSelectedIndexChanged);
     _copyViewer.OnRemovePreviousSelection += new RemovePreviousSelectionHandler(_copyViewer_OnRemovePreviousSelection);
     _copyViewer.OnChooseNewBaseDirectory  += new ChooseNewBaseDirectoryHandler(_copyViewer_OnChooseNewBaseDirectory);
     _copyViewer.OnChooseOldBaseDirectory  += new ChooseOldBaseDirectoryHandler(_copyViewer_OnChooseOldBaseDirectory);
     _copyViewer.OnCopyNewBaseDirectory    += new CopyNewBaseDirectoryHandler(_copyViewer_OnCopyNewBaseDirectory);
     _copyViewer.OnCopyOldBaseDirectory    += new CopyOldBaseDirectoryHandler(_copyViewer_OnCopyOldBaseDirectory);
     _copyViewer.OnCopyAction   += new CopyActionHandler(_copyViewer_OnCopyAction);
     _copyViewer.OnDeleteAction += new DeleteActionHandler(_copyViewer_OnDeleteAction);
     _copyViewer.OnSynchronizePreventDeleteAction += new SynchronizePreventDeleteActionHandler(_copyViewer_OnSynchronizePreventDeleteAction);
     _copyViewer.OnSynchronizeAction        += new SynchronizeActionHandler(_copyViewer_OnSynchronizeAction);
     _copyViewer.OnSynchronizeAllAction     += new SynchronizeAllActionHandler(_copyViewer_OnSynchronizeAllAction);
     _copyViewer.OnSynchronizePlusAction    += new SynchronizePlusActionHandler(_copyViewer_OnSynchronizePlusAction);
     _copyViewer.OnSynchronizePlusAllAction += new SynchronizePlusAllActionHandler(_copyViewer_OnSynchronizePlusAllAction);
     _copyViewer.OnCancelAction             += new CancelActionHandler(_copyViewer_OnCancelAction);
     _profileManager          = profileManager;
     _currentActivityProgress = new ProgressLink();
     _overallProgress         = new ProgressLink();
     _copyViewer.EnableControls(true);
     LoadParameters();
     RefreshCombo();
 }
Exemple #2
0
        void _copyViewer_OnDeleteAction(EventArgs e)
        {
            _copyViewer.EnableControls(false);
            _overallProgress                    = new ProgressLink();
            _copyViewer.OverallProgress         = _overallProgress;
            _currentActivityProgress            = new ProgressLink();
            _copyViewer.CurrentActivityProgress = _currentActivityProgress;

            //Validate all fields.
            int errorCount = ValidateFields();

            if (errorCount > 0)
            {
                return;
            }

            //Save Parameters.
            _profileManager.UserSettings.Select(_currentKey);
            _profileManager.Interrupt.Reason = "OK";
            SaveParameters();
            RefreshCombo();

            //Copy.
            _copyEngine = new CopyEngine();
            _copyEngine.OnBeginCount      += new CopyEngine.BeginCountHandler(_copyEngine_OnBeginCount);
            _copyEngine.OnUpdateCount     += new CopyEngine.UpdateCountHandler(_copyEngine_OnUpdateCount);
            _copyEngine.OnEndOfCount      += new CopyEngine.EndOfCountHandler(_copyEngine_OnEndOfCount);
            _copyEngine.OnBeginDelete     += new CopyEngine.BeginDeleteHandler(_copyEngine_OnBeginDelete);
            _copyEngine.OnUpdateDelete    += new CopyEngine.UpdateDeleteHandler(_copyEngine_OnUpdateDelete);
            _copyEngine.OnEndOfDelete     += new CopyEngine.EndOfDeleteHandler(_copyEngine_OnEndOfDelete);
            _copyEngine.CopyRule           = _profileManager.UserSettings.SelectedItem.CopyRule;
            _copyEngine.MonitoredTypesOnly = _profileManager.UserSettings.SelectedItem.MonitoredTypesOnly;
            _copyEngine.Interrupt          = _profileManager.Interrupt;

            try
            {
                _copyEngine.XDelete(_profileManager.UserSettings.SelectedItem.NewBaseDir);
                Administrator.View();
            }
            catch (ParameterException pe)
            {
                _copyViewer.SetFieldError(pe.Parameter, pe.Message);
                //_copyViewer.DisplayMessageBox(ae.Message, _copyViewer.Caption, MsgButtons.OK, MsgIcon.Error);
            }
            finally
            {
                _copyViewer.EnableControls(true);
            }
        }