private async Task <bool> FindReceiptPrinter()
        {
            if (printer == null)
            {
                rootPage.NotifyUser("Finding printer", NotifyType.StatusMessage);
                printer = await DeviceHelpers.GetFirstReceiptPrinterAsync();

                if (printer != null)
                {
                    rootPage.NotifyUser("Got Printer with Device Id : " + printer.DeviceId, NotifyType.StatusMessage);
                    return(true);
                }
                else
                {
                    rootPage.NotifyUser("No Printer found", NotifyType.ErrorMessage);
                    return(false);
                }
            }
            return(true);
        }
        /// <summary>
        /// Find the first receipt printer and create two instances of it.
        /// </summary>
        /// <returns></returns>
        private async Task <bool> FindReceiptPrinterInstances()
        {
            if (printerInstance1 == null || printerInstance2 == null)
            {
                rootPage.NotifyUser("Finding printer", NotifyType.StatusMessage);
                printerInstance1 = await DeviceHelpers.GetFirstReceiptPrinterAsync();

                if (printerInstance1 != null)
                {
                    rootPage.NotifyUser("Got Printer Instance 1 with Device Id : " + printerInstance1.DeviceId, NotifyType.StatusMessage);

                    // Create another instance of the same printer.
                    if (printerInstance2 != null)
                    {
                        printerInstance2.Dispose();
                        printerInstance2 = null;
                    }
                    printerInstance2 = await PosPrinter.FromIdAsync(printerInstance1.DeviceId);

                    if (printerInstance2 != null)
                    {
                        rootPage.NotifyUser("Got Printer Instance 2 with Device Id : " + printerInstance2.DeviceId, NotifyType.StatusMessage);
                        return(true);
                    }
                    else
                    {
                        rootPage.NotifyUser("Couldn't create second instance of printer.", NotifyType.StatusMessage);
                    }
                    return(false);
                }
                else
                {
                    rootPage.NotifyUser("No Printer found", NotifyType.ErrorMessage);
                    return(false);
                }
            }

            return(true);
        }