Example #1
0
        private void PrintReceipt()
        {
            this.Dispatcher.Invoke((Action)(() =>
            {
                PrintButton.IsEnabled = false;
                PrintButton.Content = "Printing...";
            }));

            if (orderDetails.CurrentAddress == null)
            {
                printer.Print(orderDetails);
            }

            ItemManager.AddOrderToCount(orderDetails.ItemBasket.Items);
            if (orderDetails.CurrentAddress != null)
            {
                if (!string.IsNullOrEmpty(orderDetails.CurrentAddress.Number) && !string.IsNullOrEmpty(orderDetails.CurrentAddress.Road) && !string.IsNullOrEmpty(orderDetails.CurrentAddress.PhoneNumber))
                {
                    printer.Print(orderDetails);
                    AddressManager.AddCustomerToCount(orderDetails.CurrentAddress);
                }
                NotifyPropertyChanged("PrintDiagnosticMessage");
            }
            AddressManager.AddToRecentOrder(orderDetails);
        }