Exemplo n.º 1
0
 public ResetOrderDataCommand()
     : base(Constants.ResetOrderData)
 {
     FileOrderStorage.ClearBluetoothDirectory();
 }
Exemplo n.º 2
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();
            }
        }
Exemplo n.º 3
0
        public ExecutionEngine(Frame frame, MainWindow mainWindow)
        {
            _lastInstance = this;
            _mainWindow   = mainWindow;
            _isBluetooth  = false;
            _showingFrame = frame;
            _resource     = mainWindow.Resources;
            _orderManager = new OrderManagerAddon();

            LoadDefaultResources();

            try
            {
                if (Mutex.OpenExisting(MutexName) != null)
                {
                    ShowMessageAndQuit(StringResources.GetString("MessageOnlyOneInstanceCanBeRun"));
                    return;
                }
            }
            catch (WaitHandleCannotBeOpenedException) { }    // no need to handle

            _namedMutex = new Mutex(false, MutexName);

            _errorLogger         = new WindowsAppLog(true);
            _errorLogger.Enabled = true;

            try
            {
                _config = new Config(true);
            }
            catch (Exception e)
            {
                _errorLogger.WriteExceptionInfo(e);
                ShowMessageAndQuit(StringResources.GetString("MessageConfigReadingError"));
                return;
            }

            try
            {
                _priceManager = new PriceManager(true, _config.PriceFile.Value);
            }
            catch (Exception e)
            {
                _errorLogger.WriteExceptionInfo(e);
                ShowMessageAndQuit(StringResources.GetString("MessagePriceReadingError"));
                return;
            }

            try
            {
                _crops = new CropManager(true, _config.CropFile.Value);
            }
            catch (Exception e)
            {
                _errorLogger.WriteExceptionInfo(e);
                ShowMessageAndQuit(StringResources.GetString("MessageCropsReadingError"));
                return;
            }

            _eventLogger         = new FileLog(Config.EventLogFile, false);
            _eventLogger.Enabled = _config.EnableEventLogging.Value;

            _dataContext = new DataContext();
            _dataContext[Constants.OrderContextName] = new Order();
            _lastUserActionTime = System.DateTime.Now;

            _eventLogger.Write(string.Format(CultureInfo.InvariantCulture, "ExecutionEngine:Load headers and backgrounds"));
            _headerDictionary     = new Dictionary <string, BitmapImage>();
            _backgroundDictionary = new Dictionary <string, ImageBrush>();

            // Add main banner to resources
            try
            {
                _resource.Add(Constants.ImageBannerKey, BitmapFrame.Create(new Uri(_config.MainBanner.Value)));
            }
            catch (Exception e)
            {
                _eventLogger.Write(string.Format(StringResources.GetString("MessageImageLoadError"), _config.MainBanner.Value, e.Message));
                _resource.Add(Constants.ImageBannerKey, null);
            }

            LoadScreenSettings(_config.Screens);

            LoadCustomResources();

            _stages = new List <StageBase>();
            _stages.Add(new WelcomeStage());
            _stages.Add(new SelectStage());
            _stages.Add(new ImageEditorStage());
            _stages.Add(new ProcessOrderStage());
            _stages.Add(new FindingPhotosStage());

            // Clear bluetooth folder
            FileOrderStorage.ClearBluetoothDirectory();

            NativeMethods.SetErrorMode(NativeMethods.SEM_FAILCRITICALERRORS);
        }
Exemplo n.º 4
0
 public void UseBluetooth()
 {
     Engine.IsBluetooth = true;
     FileOrderStorage.ClearBluetoothDirectory();
     SwitchToBluetoothLoadSceen();
 }