Exemplo n.º 1
0
        protected void UpdateValues()
        {
            try
            {
                RasterImage  tempImage;
                CloneCommand clone = new CloneCommand();

                clone.Run(_originalImage);

                tempImage = clone.DestinationImage;

                if (DoEffect(ref tempImage))
                {
                    if (_afterImage != null)
                    {
                        _afterImage.Dispose();

                        _afterImage = null;
                    }

                    _afterImage = tempImage;

                    _afterViewer.Image = _afterImage;

                    _afterViewer.OffsetImage(_beforeViewer.Offset);

                    _afterViewer.Invalidate();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        public ColorResolutionDialog(RasterImage image, RasterPaintProperties paintProperties)
        {
            InitializeComponent();

            if (image != null)
            {
                CloneCommand clone = new CloneCommand();

                clone.Run(image);

                _originalImage = image;
                _afterImage    = clone.DestinationImage;

                _beforeViewer = new ImagePreviewCtrl(_originalImage, paintProperties, _lblBefore.Location, _lblBefore.Size);
                _afterViewer  = new ImagePreviewCtrl(_afterImage, paintProperties, _lblAfter.Location, _lblAfter.Size);

                Controls.Add(_beforeViewer);
                Controls.Add(_afterViewer);
                _beforeViewer.BringToFront();
                _afterViewer.BringToFront();

                _beforeViewer.PanImage += new EventHandler <PanImageEvent>(_beforeViewer_PanImage);
                _afterViewer.PanImage  += new EventHandler <PanImageEvent>(_afterViewer_PanImage);
            }
            else
            {
                _tsZoomLevel.Visible = false;
            }
        }
Exemplo n.º 3
0
        public void ALocalRepoistoryCanBeCloned()
        {
            MockGitLocationForConfiguration();

            Command command = MockCommandProperties();

            Runner runner = MockRunner();

            Mocks.ReplayAll();

            runner.Output = string.Format("Cloning into {0}...", RepositoryDestination);

            var clone = new CloneCommand
            {
                ProjectLocation     = GitEmptyTestProjectLocation,
                RepositoryToClone   = GitEmptyTestProjectLocation,
                Destination         = RepositoryDestination,
                Runner              = runner,
                CommandArguments    = command,
                EnvironmentVariable = StubEnvironmentVariable()
            };

            IAsyncResult result = clone.Run();

            result.AsyncWaitHandle.WaitOne();

            Assert.That(clone.Output.Contains(string.Format("Cloning into {0}...", RepositoryDestination)));
            Assert.That(runner.Command, Is.EqualTo(command));
            Assert.That(command.CommandFullLocation, Is.EqualTo(GitInstallLocation));
            Assert.That(command.Arguments, Is.EqualTo("clone -v --verbose --progress \"C:\\Empty\\GitProject\" \"C:\\SomeFakeUnitTestDirectory\\MoreUnitTestFakey\""));
            Assert.That(command.WorkingDirectory, Is.EqualTo(GitEmptyTestProjectLocation));
        }
Exemplo n.º 4
0
        public void WhenCloningARepositoryTheProgressIsProvided()
        {
            MockGitLocationForConfiguration();

            Command command = MockCommandProperties();

            Runner runner = MockRunner();

            Mocks.ReplayAll();

            var clone = new CloneCommand
            {
                ProjectLocation     = GitTestProjectLocation,
                RepositoryToClone   = GitTestProjectLocation,
                Destination         = RepositoryDestination,
                Runner              = runner,
                CommandArguments    = command,
                EnvironmentVariable = StubEnvironmentVariable()
            };

            string progressMessage = string.Empty;
            bool   messageRecieved = false;

            clone.Progress += (s, e) =>
            {
                if (!messageRecieved)
                {
                    progressMessage = e.Message;
                    messageRecieved = true;
                }
            };

            clone.Run();

            var eventArgs = new OutputReceivedArgs
            {
                Data = "This is a progress message"
            };

            runner.Raise(v => v.ErrorOutputReceived += null, eventArgs);

            Stopwatch watch = Stopwatch.StartNew();

            while (!messageRecieved && watch.Elapsed < TimeSpan.FromMilliseconds(500))
            {
                Thread.Sleep(1);
            }

            Assert.That(messageRecieved);
            Assert.That(progressMessage.StartsWith("This is a progress message"));
        }
Exemplo n.º 5
0
        public MatchHistogramDialog(RasterImage image, RasterPaintProperties paintProperties, Form[] ViewerForms)
        {
            try
            {
                InitializeComponent();

                if (image != null)
                {
                    for (int i = 0; i < ViewerForms.Length; i++)
                    {
                        if ((image.BitsPerPixel == 24 && (((ViewerForm)ViewerForms[i]).Image.BitsPerPixel == 24) || ((ViewerForm)ViewerForms[i]).Image.BitsPerPixel == 8) || (image.BitsPerPixel == 8 && ((ViewerForm)ViewerForms[i]).Image.BitsPerPixel == 8))
                        {
                            _images.Add(((ViewerForm)ViewerForms[i]).Image);
                            _cmbREFImage.Items.Add(System.IO.Path.GetFileName(ViewerForms[i].Text));
                        }
                    }
                    _imageIndex = 0;
                    _REFImage   = _images[_imageIndex];
                    CloneCommand clone = new CloneCommand();
                    clone.Run(image);
                    _originalImage = image;
                    _DSTImage      = clone.DestinationImage;

                    _DSTViewer = new ImagePreviewCtrl(_DSTImage, paintProperties, _lblDST.Location, _lblDST.Size);
                    _REFViewer = new ImagePreviewCtrl(_REFImage, paintProperties, _lblREF.Location, _lblREF.Size);

                    Controls.Add(_DSTViewer);
                    Controls.Add(_REFViewer);
                    _DSTViewer.BringToFront();
                    _REFViewer.BringToFront();

                    _DSTViewer.PanImage       += new EventHandler <PanImageEvent>(_beforeViewer_PanImage);
                    _REFViewer.PanImage       += new EventHandler <PanImageEvent>(_afterViewer_PanImage);
                    _cmbREFImage.SelectedIndex = 0;
                }
                else
                {
                    _tsZoomLevel.Visible = false;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 6
0
        public BalanceColorsDialog(RasterImage image, RasterPaintProperties paintProperties)
        {
            try
            {
                InitializeComponent();

                if (image != null)
                {
                    CloneCommand clone = new CloneCommand();

                    clone.Run(image);

                    _originalImage = image;
                    _afterImage    = clone.DestinationImage;

                    _beforeViewer = new ImagePreviewCtrl(_originalImage, paintProperties, _lblBefore.Location, _lblBefore.Size);
                    _afterViewer  = new ImagePreviewCtrl(_afterImage, paintProperties, _lblAfter.Location, _lblAfter.Size);

                    Controls.Add(_beforeViewer);
                    Controls.Add(_afterViewer);
                    _beforeViewer.BringToFront();
                    _afterViewer.BringToFront();

                    _beforeViewer.PanImage += new EventHandler <PanImageEvent>(_beforeViewer_PanImage);
                    _afterViewer.PanImage  += new EventHandler <PanImageEvent>(_afterViewer_PanImage);
                }
                else
                {
                    _tsZoomLevel.Visible = false;
                }

                _redWeights           = new BalanceColorCommandFactor();
                _greenWeights         = new BalanceColorCommandFactor();
                _blueWeights          = new BalanceColorCommandFactor();
                _internalRedWeights   = new BalanceColorCommandFactor();
                _internalGreenWeights = new BalanceColorCommandFactor();
                _internalBlueWeights  = new BalanceColorCommandFactor();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public GammaAdjustmentDialog(RasterImage image, RasterPaintProperties paintProperties)
        {
            try
            {
                InitializeComponent();

                if (image != null)
                {
                    CloneCommand clone = new CloneCommand();

                    clone.Run(image);

                    _originalImage = image;
                    _afterImage    = clone.DestinationImage;

                    _beforeViewer = new ImagePreviewCtrl(_originalImage, paintProperties, _lblBefore.Location, _lblBefore.Size);
                    _afterViewer  = new ImagePreviewCtrl(_afterImage, paintProperties, _lblAfter.Location, _lblAfter.Size);

                    Controls.Add(_beforeViewer);
                    Controls.Add(_afterViewer);
                    _beforeViewer.BringToFront();
                    _afterViewer.BringToFront();

                    _beforeViewer.PanImage += new EventHandler <PanImageEvent>(_beforeViewer_PanImage);
                    _afterViewer.PanImage  += new EventHandler <PanImageEvent>(_afterViewer_PanImage);
                }
                else
                {
                    _tsZoomLevel.Visible = false;
                }

                _internalGammaValue = 10;
                _gamma = 10;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }