Пример #1
0
        public void CompleteOrder()
        {
            DisableTimeout();

            ProgressDialog progressDialog;

            ExecutionEngine.EventLogger.Write("ProcessOrderStage:CompleteOrder");

            if (ExecutionEngine.Instance.PrimaryAction == PrimaryActionType.BurnCd)
            {
                progressDialog = new ProgressDialog((string)ExecutionEngine.Instance.Resource[Constants.MessagePreparingImageKey]);
            }
            else
            {
                progressDialog = new ProgressDialog((string)ExecutionEngine.Instance.Resource[Constants.MessageProgressOrderKey]);
            }

            ExecutionEngine.EventLogger.Write("ProgressOrderStage:StartOrderProgress");

            _orderStoreManager.Add((IProgressCallback)progressDialog);
            bool     result         = false;
            DateTime showDialogTime = DateTime.Now.AddSeconds(Constants.ProgressDialogTimeout);

            while (DateTime.Now.Second < showDialogTime.Second)
            {
                if (progressDialog.IsComplete)
                {
                    result = true;
                    break;
                }
            }

            if (!result)
            {
                progressDialog.ShowDialog();
                result = progressDialog.DialogResult.Value;
            }

            if (result)
            {
                if (Engine.PrimaryAction == PrimaryActionType.BurnCd)
                {
                    if (ExecutionEngine.Config.CDBurningRequireConfirm.Value)
                    {
                        SwitchToThankYou();
                    }
                    else
                    {
                        SwitchToBurningScreen(null);
                    }
                }
                else if (Engine.PrimaryAction == PrimaryActionType.PrintPhotos)
                {
                    if (ExecutionEngine.Config.PhotoPrintingRequireConfirm.Value)
                    {
                        SwitchToThankYou();
                    }
                    else
                    {
                        SwitchToPrintingScreen(null);
                    }
                }
                else
                {
                    SwitchToThankYou();
                }
            }
            else
            {
                SwitchToThankYouCancel();
            }

            if (ExecutionEngine.Instance.IsBluetooth)
            {
                FileOrderStorage.ClearBluetoothDirectory();
            }
        }
Пример #2
0
        private void NextRedEyeButtonClickHandler(object sender, RoutedEventArgs e)
        {
            // The first step. Auto red eye removal
            if (_redEyeRemovalStep == 0)
            {
                _redEyeBitmap = (Aurigma.GraphicsMill.Bitmap)_sourceBitmap.Clone();
                if (!TransformBitmap(_redEyeBitmap))
                {
                    return;
                }

                _redEyeBitmap.UndoRedoEnabled = true;

                float x      = (float)(_rectangleAdorner.Rectangle.X * (_redEyeBitmap.Width / _frame.Photo.ActualWidth));
                float y      = (float)(_rectangleAdorner.Rectangle.Y * (_redEyeBitmap.Height / _frame.Photo.ActualHeight));
                float width  = (float)(_rectangleAdorner.Rectangle.Width * (_redEyeBitmap.Width / _frame.Photo.ActualWidth));
                float height = (float)(_rectangleAdorner.Rectangle.Height * (_redEyeBitmap.Height / _frame.Photo.ActualHeight));
                _redEyeRect = new System.Drawing.RectangleF(x, y, width, height);

                _redEyeBitmap.Transforms.Crop(_redEyeRect);

                _progressDialog = new ProgressDialog((string)ExecutionEngine.Instance.Resource[Constants.MessageTransformImageKey]);

                var workerThread = new Thread(new ParameterizedThreadStart(DoAutoRedEye));
                workerThread.Start((object)_redEyeBitmap);

                DateTime showDialogTime = DateTime.Now.AddSeconds(Constants.ProgressDialogTimeout);
                while (DateTime.Now.Second < showDialogTime.Second)
                {
                    if (_progressDialog.IsComplete)
                    {
                        break;
                    }
                }

                if (!_progressDialog.IsComplete)
                {
                    _progressDialog.ShowDialog();
                    if (!_progressDialog.DialogResult.Value)
                    {
                        return;
                    }
                }

                _redEyeTransform.Transforms.Add(new AutoRedEyeRemoval(_redEyeRect));
                RegisterTransform(_redEyeTransform);

                _frame.Photo.Source            = PhotoItem.CreateBitmapSource(CreatePreviewBitmap(_redEyeBitmap, Aurigma.GraphicsMill.Transforms.ResizeMode.Fit));
                _rectangleAdorner.Visibility   = Visibility.Collapsed;
                _pointAdorner.Visibility       = Visibility.Collapsed;
                _manualRedEyeButton.Visibility = Visibility.Visible;
                _applyRedEyeButton.IsEnabled   = true;
                _nextRedEyeButton.Visibility   = Visibility.Collapsed;
                _removeRedEyeButton.Visibility = Visibility.Collapsed;

                _stepDescription.Text = (string)FindResource(Constants.ImageEditorRedEyeStep2TextKey);

                _redEyeRemovalStep = 1;
            }
            else
            {
                throw new System.Exception("Internal state error. NextRedEyeButtonClickHandler");
            }
        }