public void ShowOrderFormingScreen() { ExecutionEngine.EventLogger.Write("SelectStage:ShowOrderFormingScreen"); CheckDisposedState(); foreach (ThumbnailItem item in _selectScreen.ListControl.List.Items) { if (item.Checked && !_orderFormingScreen.ListControl.List.Items.Contains(item)) { item.HostList = _orderFormingScreen.ListControl.List; _orderFormingScreen.ListControl.List.AddItem(item); item.Order.Reset(); _currentOrder.OrderItems.Add(item.Order); } else if (!item.Checked && _orderFormingScreen.ListControl.List.Items.Contains(item)) { _orderFormingScreen.ListControl.List.RemoveItemWithoutUIUpdate(item); _currentOrder.OrderItems.Remove(item.Order); item.Order.Reset(); } } _orderFormingScreen.ListControl.WasInitialized = false; if (_orderFormingScreen.ListControl.List.Items.Count > 0) { LastVisitedPage = _orderFormingScreen; Engine.ExecuteCommand(new SwitchToScreenCommand(_orderFormingScreen)); } else { MessageDialog.Show((string)ExecutionEngine.Instance.Resource[Constants.MessageCheckSomePhotosKey]); } }
public ThumbnailItem GetPrevious() { if (HasPrevious()) { ThumbnailItem item = _hostList.FilteredItems[_hostList.FilteredItems.IndexOf(this) - 1]; try { item.Photo.LoadImage(); } catch (Exception e) { ExecutionEngine.EventLogger.WriteExceptionInfo(e); MessageDialog.Show((string)ExecutionEngine.Instance.Resource[Constants.MessageLoadingImageErrorKey]); return(this); } return(item); } else { return(this); } }
private void ShowMessageAndQuit(string message) { MessageDialog.Show(message); _mainWindow.Visibility = Visibility.Hidden; _mainWindow.Close(); }
private void ShowErrorMessage() { MessageDialog.Show(StringResources.GetString("MessagePhotoPrinterError")); _stage.SwitchToThankYouCancel(); }
public void SwitchToThankYou() { ExecutionEngine.EventLogger.Write("ProcessOrderStage:SwitchToThankYou"); LastVisitedPage = _thankYouScreen; if (ExecutionEngine.Config.EnableReceiptPrinter.Value && ExecutionEngine.Instance.PrimaryAction != PrimaryActionType.ProcessOrder) { try { var receiptData = new ReceiptData(); receiptData.Id = CurrentOrder.OrderId; receiptData.UserName = CurrentOrder.UserName; receiptData.UserPhone = CurrentOrder.UserPhone; receiptData.OrderPhotos = true; receiptData.BurnCd = false; if (ExecutionEngine.Instance.PrimaryAction == PrimaryActionType.BurnCd) { receiptData.Service = ExecutionEngine.Instance.Resource[Constants.OrderInfoControlCdBurningTextKey].ToString(); receiptData.OrderPhotos = false; receiptData.BurnCd = true; } receiptData.CropMode = Constants.CropToFillModeName == CurrentOrder.CropMode ? ExecutionEngine.Instance.Resource[Constants.CropToFillTextKey].ToString() : ExecutionEngine.Instance.Resource[Constants.ResizeToFitTextKey].ToString(); receiptData.PaperType = CurrentOrder.OrderPaperType.Name; receiptData.OrderDate = DateTime.Now.ToString(CultureInfo.CurrentCulture); receiptData.PhotosCount = CurrentOrder.OrderItems.Count; receiptData.PrintsCount = CurrentOrder.GetItemCount(); receiptData.OrderCost = CurrentOrder.GetTotalCost().ToString("c", NumberFormatInfo.CurrentInfo); if (ExecutionEngine.PriceManager.SalesTaxPercent.Value > 0) { string taxString = string.Format("{0} ({1}%)", (CurrentOrder.GetTotalCost() * ExecutionEngine.PriceManager.SalesTaxPercent.Value).ToString("c", CultureInfo.CurrentCulture), ExecutionEngine.PriceManager.SalesTaxPercent.Value * 100); if (!string.IsNullOrEmpty(ExecutionEngine.PriceManager.SalesTaxComment.Value)) { taxString += " " + ExecutionEngine.PriceManager.SalesTaxComment.Value; } receiptData.SalesTax = taxString; receiptData.TotalCost = (CurrentOrder.GetTotalCost() * (1 + ExecutionEngine.PriceManager.SalesTaxPercent.Value)).ToString("c", NumberFormatInfo.CurrentInfo); } foreach (PaperFormat format in ExecutionEngine.Instance.PaperFormats) { if (CurrentOrder.GetItemCount(format) > 0) { receiptData.Formats.Add(new FormatInfo(format.Name, CurrentOrder.GetItemCount(format))); } } int maxPhotosCount = Math.Min(CurrentOrder.OrderItems.Count, ExecutionEngine.Config.PhotosInReceipt.Value); for (int i = 0; i < maxPhotosCount; i++) { foreach (PaperFormat format in ExecutionEngine.Instance.PaperFormats) { if (CurrentOrder.OrderItems[i].GetCount(format) > 0) { receiptData.Photos.Add(new PhotoInfo(CurrentOrder.OrderItems[i].OrderStoreFileName, CurrentOrder.OrderItems[i].GetCount(format), format.Name)); } } } receiptData.MorePhotos = (maxPhotosCount < CurrentOrder.OrderItems.Count); if (ExecutionEngine.Instance.PrimaryAction == PrimaryActionType.OrderPhotos) { foreach (Service service in CurrentOrder.Services) { string servicePrice; if (service.IsPriceFixed) { servicePrice = service.GetPriceString(); } else { servicePrice = (CurrentOrder.GetTotalCost() * service.Price / 100.0f).ToString("c", CultureInfo.CurrentCulture) + " (" + service.GetPriceString() + ")"; } receiptData.Services.Add(new ServiceInfo(service.Name, servicePrice)); } } var receipt = new Receipt(receiptData, ExecutionEngine.Config.ReceiptTemplateFile.Value); receipt.Print(ExecutionEngine.Config.ReceiptPrinterName.Value); } catch (System.Exception e) { ExecutionEngine.ErrorLogger.WriteExceptionInfo(e); MessageDialog.Show(StringResources.GetString("MessageReceiptPrinterError")); } } if (ExecutionEngine.Instance.PrimaryAction == PrimaryActionType.OrderPhotos) { ExecutionEngine.Instance.OrderManager.AddOrder(_orderStoreManager.CurrentOrderPath); } EnableTimeout(); Engine.ExecuteCommand(new SwitchToScreenCommand(_thankYouScreen)); }
private void TimerTickHandler(object sender, EventArgs e) { _elapsedTime += _timer.Interval.TotalMilliseconds; if (!_timer.IsEnabled || !_photosFound) { return; } // No files at all if (_files.Count == 0) { _isThreadAlive = false; _timer.Stop(); if (_photosToRemove.Count != 0) { ExecutionEngine.Context[Constants.PhotosToRemove] = _photosToRemove; } MessageDialog.Show((string)ExecutionEngine.Instance.Resource[Constants.MessageNoFilesFoundKey]); if (Engine.IsShowFolders) { SwitchToSelectFoldersScreen(); } else if (ExecutionEngine.Config.IsBluetoothEnabled()) { SwitchToSelectDeviceScreen(); } else { SwitchToWelcomeScreen(); } return; } // No new files if (_photoItems.Count == 0) { _timer.Stop(); _isThreadAlive = false; SwitchToSelectPhotos(); return; } Bitmap exifSource = null; lock (_exifSources) { if (_exifSources.Count > 0) { exifSource = _exifSources[0]; _exifSources.RemoveAt(0); } } if (exifSource != null) { _progressScreen.AddPreviewPhoto(PhotoItem.CreateBitmapSource(exifSource)); } _progressScreen._progressBar.Value++; if (_elapsedTime >= ExecutionEngine.Config.SearchProcessDuration.Value) { _timer.Stop(); _isThreadAlive = false; SwitchToSelectPhotos(); } }