Esempio n. 1
0
 private void ActionBeginProgress(ProgressLink progressLink, long length)
 {
     _originalMaximum     = length;
     progressLink.Minimum = 0;
     progressLink.Maximum = (int)_originalMaximum;
     progressLink.Value   = 0;
 }
Esempio n. 2
0
 void _reportEngine_OnBeginReport(ReportEngine.BeginReportEventArgs e)
 {
     _currentActivityProgress     = new ProgressLink();
     _overallProgress             = new ProgressLink();
     _compareViewer.CursorMode    = CursorModes.Wait;
     _compareViewer.StatusMessage = "Writing ...";
     ActionBeginProgress(_overallProgress, e.ReportLength);
     _compareViewer.OverallProgress = _overallProgress;
 }
Esempio n. 3
0
 private void ActionUpdateProgress(ProgressLink progressLink, long increment)
 {
     if (progressLink.Value + (int)increment <= progressLink.Maximum)
     {
         progressLink.Value += (int)increment;
     }
     else
     {
         progressLink.Maximum += (int)increment;
         //progressLink.Maximum += (int)_originalMaximum;
         progressLink.Value += (int)increment;
     }
 }
Esempio n. 4
0
        void _compareViewer_OnCompareMeldAction(EventArgs e)
        {
            _compareViewer.EnableControls(false);
            _overallProgress = new ProgressLink();
            _compareViewer.OverallProgress         = _overallProgress;
            _currentActivityProgress               = new ProgressLink();
            _compareViewer.CurrentActivityProgress = _currentActivityProgress;
            if (_compareEngine.Interrupt != null)
            {
                _compareEngine.Interrupt.Reason = "OK";
            }

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

            if (errorCount > 0)
            {
                return;
            }

            //Save Parameters.
            _profileManager.UserSettings.Select(_currentKey);
            SaveParameters();
            RefreshCombo();

            //Comparison with Meld.
            try
            {
                MeldCompare(_profileManager.UserSettings.SelectedItem.NewFile, _profileManager.UserSettings.SelectedItem.OldFile);
            }
            catch (ParameterException pe)
            {
                _compareViewer.SetFieldError(pe.Parameter, pe.Message);
                //_compareViewer.DisplayMessageBox(ae.Message, _compareViewer.Caption, MsgButtons.OK, MsgIcon.Error);
            }
            finally
            {
                _compareViewer.EnableControls(true);
            }
        }
Esempio n. 5
0
 internal Presenter(ICompareEngine compareEngine, ICompareViewer compareViewer, IProfileManager profileManager)
 {
     _compareEngine = compareEngine;
     _compareViewer = compareViewer;
     _compareViewer.OnPreviousSelectionSelectedIndexChanged += new PreviousSelectionSelectedIndexChangedHandler(_compareViewer_OnPreviousSelectionSelectedIndexChanged);
     _compareViewer.OnRemovePreviousSelection += new RemovePreviousSelectionHandler(_compareViewer_OnRemovePreviousSelection);
     _compareViewer.OnChooseNewBaseDirectory  += new ChooseNewBaseDirectoryHandler(_compareViewer_OnChooseNewBaseDirectory);
     _compareViewer.OnChooseOldBaseDirectory  += new ChooseOldBaseDirectoryHandler(_compareViewer_OnChooseOldBaseDirectory);
     _compareViewer.OnCopyNewBaseDirectory    += new CopyNewBaseDirectoryHandler(_compareViewer_OnCopyNewBaseDirectory);
     _compareViewer.OnCopyOldBaseDirectory    += new CopyOldBaseDirectoryHandler(_compareViewer_OnCopyOldBaseDirectory);
     _compareViewer.OnChooseNewFile           += new ChooseNewFileHandler(_compareViewer_OnChooseNewFile);
     _compareViewer.OnChooseOldFile           += new ChooseOldFileHandler(_compareViewer_OnChooseOldFile);
     _compareViewer.OnCompareAction           += new CompareActionHandler(_compareViewer_OnCompareAction);
     _compareViewer.OnCompareMeldAction       += new CompareMeldActionHandler(_compareViewer_OnCompareMeldAction);
     _compareViewer.OnCancelAction            += new CancelActionHandler(_compareViewer_OnCancelAction);
     _profileManager          = profileManager;
     _currentActivityProgress = new ProgressLink();
     _overallProgress         = new ProgressLink();
     _compareViewer.EnableControls(true);
     LoadParameters();
     RefreshCombo();
 }
Esempio n. 6
0
 private void ActionEndOfProgress(ProgressLink progressLink)
 {
     progressLink.Value = progressLink.Maximum;
 }
Esempio n. 7
0
        void _compareViewer_OnCompareAction(EventArgs e)
        {
            _compareViewer.EnableControls(false);
            _overallProgress = new ProgressLink();
            _compareViewer.OverallProgress         = _overallProgress;
            _currentActivityProgress               = new ProgressLink();
            _compareViewer.CurrentActivityProgress = _currentActivityProgress;
            if (_compareEngine.Interrupt != null)
            {
                _compareEngine.Interrupt.Reason = "OK";
            }

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

            if (errorCount > 0)
            {
                return;
            }

            //Save Parameters.
            _profileManager.UserSettings.Select(_currentKey);
            SaveParameters();
            RefreshCombo();

            //Comparison.
            _compareEngine = new CompareEngine();
            _compareEngine.OnBeginSegment   += new CompareEngine.BeginSegmentHandler(_compareEngine_OnBeginSegment);
            _compareEngine.OnUpdateSegment  += new CompareEngine.UpdateSegmentHandler(_compareEngine_OnUpdateSegment);
            _compareEngine.OnEndOfSegment   += new CompareEngine.EndOfSegmentHandler(_compareEngine_OnEndOfSegment);
            _compareEngine.OnBeginCompare   += new CompareEngine.BeginCompareHandler(_compareEngine_OnBeginCompare);
            _compareEngine.OnUpdateCompare  += new CompareEngine.UpdateCompareHandler(_compareEngine_OnUpdateCompare);
            _compareEngine.OnEndOfCompare   += new CompareEngine.EndOfCompareHandler(_compareEngine_OnEndOfCompare);
            _compareEngine.OnBeginReport    += new CompareEngine.BeginReportHandler(_compareEngine_OnBeginReport);
            _compareEngine.OnUpdateReport   += new CompareEngine.UpdateReportHandler(_compareEngine_OnUpdateReport);
            _compareEngine.OnEndOfReport    += new CompareEngine.EndOfReportHandler(_compareEngine_OnEndOfReport);
            _compareEngine.MinChars          = _profileManager.UserSettings.SelectedItem.MinChars;
            _compareEngine.MinLines          = _profileManager.UserSettings.SelectedItem.MinLines;
            _compareEngine.LimitCharacters   = _profileManager.UserSettings.SelectedItem.LimitCharacters;
            _compareEngine.LimitLines        = _profileManager.UserSettings.SelectedItem.LimitLines;
            _compareEngine.SubLineMatchLimit = _profileManager.UserSettings.SelectedItem.SubLineMatchLimit;
            _compareEngine.CompleteLines     = _profileManager.UserSettings.SelectedItem.CompleteLines;
            _compareEngine.Interrupt         = _profileManager.Interrupt;
            try
            {
                _compareEngine.CompareFiles(_profileManager.UserSettings.SelectedItem.NewFile, _profileManager.UserSettings.SelectedItem.OldFile);
                string reportViewer = _profileManager.ProfileCache.Fetch("ReportViewer");
                switch (reportViewer)
                {
                case "ViewerHtml":
                    _reportEngine = new ReportEngineHtml(_compareEngine, _profileManager);
                    _reportEngine.OnBeginReport  += new ReportEngine.BeginReportHandler(_reportEngine_OnBeginReport);
                    _reportEngine.OnUpdateReport += new ReportEngine.UpdateReportHandler(_reportEngine_OnUpdateReport);
                    _reportEngine.OnEndOfReport  += new ReportEngine.EndOfReportHandler(_reportEngine_OnEndOfReport);
                    _reportEngine.Report();
                    View(_profileManager.ProfileCache.Fetch("ViewerHtml"), _profileManager.ProfileCache.Fetch("HtmlOutputFile"));
                    break;

                case "ViewerUnix":
                    _reportEngine = new ReportEngineText(_compareEngine, _profileManager);
                    _reportEngine.OnBeginReport  += new ReportEngine.BeginReportHandler(_reportEngine_OnBeginReport);
                    _reportEngine.OnUpdateReport += new ReportEngine.UpdateReportHandler(_reportEngine_OnUpdateReport);
                    _reportEngine.OnEndOfReport  += new ReportEngine.EndOfReportHandler(_reportEngine_OnEndOfReport);
                    _reportEngine.Report();
                    break;

                case "Both":
                    _reportEngine = new ReportEngineText(_compareEngine, _profileManager);
                    _reportEngine.OnBeginReport  += new ReportEngine.BeginReportHandler(_reportEngine_OnBeginReport);
                    _reportEngine.OnUpdateReport += new ReportEngine.UpdateReportHandler(_reportEngine_OnUpdateReport);
                    _reportEngine.OnEndOfReport  += new ReportEngine.EndOfReportHandler(_reportEngine_OnEndOfReport);
                    _reportEngine.Report();
                    _reportEngine = new ReportEngineHtml(_compareEngine, _profileManager);
                    _reportEngine.OnBeginReport  += new ReportEngine.BeginReportHandler(_reportEngine_OnBeginReport);
                    _reportEngine.OnUpdateReport += new ReportEngine.UpdateReportHandler(_reportEngine_OnUpdateReport);
                    _reportEngine.OnEndOfReport  += new ReportEngine.EndOfReportHandler(_reportEngine_OnEndOfReport);
                    _reportEngine.Report();
                    View(_profileManager.ProfileCache.Fetch("ViewerHtml"), _profileManager.ProfileCache.Fetch("HtmlOutputFile"));
                    break;

                default:
                    _reportEngine = new ReportEngineText(_compareEngine, _profileManager);
                    _reportEngine.OnBeginReport  += new ReportEngine.BeginReportHandler(_reportEngine_OnBeginReport);
                    _reportEngine.OnUpdateReport += new ReportEngine.UpdateReportHandler(_reportEngine_OnUpdateReport);
                    _reportEngine.OnEndOfReport  += new ReportEngine.EndOfReportHandler(_reportEngine_OnEndOfReport);
                    _reportEngine.Report();
                    break;
                }
            }
            catch (ParameterException pe)
            {
                _compareViewer.SetFieldError(pe.Parameter, pe.Message);
                //_compareViewer.DisplayMessageBox(ae.Message, _compareViewer.Caption, MsgButtons.OK, MsgIcon.Error);
            }
            finally
            {
                _compareViewer.EnableControls(true);
            }
        }