Esempio n. 1
0
        public DeviceStatusPage()
        {
            InitializeComponent();

            this.Title = "Device Status";

            this.contentPageComponent = new ContentPageComponent(this, this.blind);

            ICommand command = new Command(() => { RefreshDeviceStatus(); }, () => this.contentPageComponent.UserInteractionEnabled);

            ToolbarItems.Add(new ToolbarItem { Text = "Refresh", Icon = App.PlatformDepends.RefreshImage, Priority = 1, Order = ToolbarItemOrder.Primary, Command = command });

            this.observableCollection = new ObservableCollection<ListViewItemCollection>();

            this.listViewItemCollection = new ListViewItemCollection("Device Status");

            this.observableCollection.Add(this.listViewItemCollection);

            this.listView.ItemsSource = this.observableCollection;

            didAppear = false;
        }
Esempio n. 2
0
        public CashDrawerPage()
        {
            InitializeComponent();

            this.Title = "Cash Drawer";

            this.contentPageComponent = new ContentPageComponent(this, this.blind);

            this.observableCollection = new ObservableCollection <ListViewItemCollection>();

            this.listViewItemCollection = new ListViewItemCollection("Like a StarIO-SDK Sample");

            this.observableCollection.Add(this.listViewItemCollection);

            this.listView.ItemsSource = this.observableCollection;

            StarIoExtEmulation emulation = Configuration.Emulation;

            this.listViewItemCollection.Add(new ListViewItem("Channel1 (Check condition.)", () => { return(Functions.CashDrawerFunctions.CreateData(emulation, PeripheralChannel.No1)); }));
            this.listViewItemCollection.Add(new ListViewItem("Channel1 (Do not check condition.)", () => { return(Functions.CashDrawerFunctions.CreateData(emulation, PeripheralChannel.No1)); }));
            this.listViewItemCollection.Add(new ListViewItem("Channel2 (Check condition.)", () => { return(Functions.CashDrawerFunctions.CreateData(emulation, PeripheralChannel.No2)); }));
            this.listViewItemCollection.Add(new ListViewItem("Channel2 (Do not check condition.)", () => { return(Functions.CashDrawerFunctions.CreateData(emulation, PeripheralChannel.No2)); }));
        }
Esempio n. 3
0
        public PrinterPage(LocalizeReceipts.LanguageIndex languageIndex, LocalizeReceipts.PaperSizeIndex paperSizeIndex)
        {
            InitializeComponent();

            this.languageIndex  = languageIndex;
            this.paperSizeIndex = paperSizeIndex;

            this.Title = "Printer";

            this.contentPageComponent = new ContentPageComponent(this, this.blind);

            this.observableCollection = new ObservableCollection <ListViewItemCollection>();

            this.listViewItemCollection = new ListViewItemCollection("Like a StarIO-SDK Sample");

            this.observableCollection.Add(this.listViewItemCollection);

            this.listView.ItemsSource = this.observableCollection;

            LocalizeReceipts.ILocalizeReceipts localizeReceipts = new LocalizeReceipts.LocalizeReceipts(this.languageIndex, this.paperSizeIndex);

            string languageCode   = localizeReceipts.LanguageCode;
            string paperSize      = localizeReceipts.PaperSize;
            string scalePaperSize = localizeReceipts.ScalePaperSize;

            Dictionary <StarIoExtEmulation, List <bool> > userInteractionEnabledDictionary = new Dictionary <StarIoExtEmulation, List <bool> >()
            {
                { StarIoExtEmulation.StarPRNT, new List <bool>()
                  {
                      true, true, true, true, true, true, true
                  } },
                { StarIoExtEmulation.StarLine, new List <bool>()
                  {
                      true, true, true, true, true, true, true
                  } },
                { StarIoExtEmulation.StarGraphic, new List <bool>()
                  {
                      false, false, true, true, true, true, true
                  } },
                { StarIoExtEmulation.EscPos, new List <bool>()
                  {
                      true, false, true, true, true, true, true
                  } },
                { StarIoExtEmulation.EscPosMobile, new List <bool>()
                  {
                      true, false, true, true, true, true, true
                  } },
                { StarIoExtEmulation.StarDotImpact, new List <bool>()
                  {
                      true, true, false, false, false, true, true
                  } },
                { StarIoExtEmulation.StarPRNTL, new List <bool>()
                  {
                      true, true, true, true, true, true, true
                  } }
            };

            StarIoExtEmulation emulation = Configuration.Emulation;

            List <bool> userInteractionEnabledList = userInteractionEnabledDictionary[emulation];

            this.listViewItemCollection.Add(new ListViewItem()
            {
                Text     = languageCode + " " + paperSize + " " + "Text Receipt",
                Enabled  = userInteractionEnabledList[0],
                Function = () =>
                {
                    return(Functions.PrinterFunctions.CreateTextReceiptData(emulation, localizeReceipts, false));
                }
            });

            this.listViewItemCollection.Add(new ListViewItem()
            {
                Text     = languageCode + " " + paperSize + " " + "Text Receipt (UTF8)",
                Enabled  = userInteractionEnabledList[1],
                Function = () =>
                {
                    return(Functions.PrinterFunctions.CreateTextReceiptData(emulation, localizeReceipts, true));
                }
            });

            this.listViewItemCollection.Add(new ListViewItem()
            {
                Text          = languageCode + " " + paperSize + " " + "Raster Receipt",
                Enabled       = userInteractionEnabledList[2],
                AsyncFunction = async() =>
                {
                    return(await Functions.PrinterFunctions.CreateRasterReceiptData(emulation, localizeReceipts));
                }
            });

            this.listViewItemCollection.Add(new ListViewItem()
            {
                Text          = languageCode + " " + scalePaperSize + " " + "Raster Receipt (Both Scale)",
                Enabled       = userInteractionEnabledList[3],
                AsyncFunction = async() =>
                {
                    return(await Functions.PrinterFunctions.CreateScaleRasterReceiptData(emulation, localizeReceipts, (int)this.paperSizeIndex, true));
                }
            });

            this.listViewItemCollection.Add(new ListViewItem()
            {
                Text          = languageCode + " " + scalePaperSize + " " + "Raster Receipt (Scale)",
                Enabled       = userInteractionEnabledList[4],
                AsyncFunction = async() =>
                {
                    return(await Functions.PrinterFunctions.CreateScaleRasterReceiptData(emulation, localizeReceipts, (int)this.paperSizeIndex, false));
                }
            });

            this.listViewItemCollection.Add(new ListViewItem()
            {
                Text     = languageCode + " " + "Raster Coupon",
                Enabled  = userInteractionEnabledList[5],
                Function = () =>
                {
                    return(Functions.PrinterFunctions.CreateCouponData(emulation, localizeReceipts, (int)this.paperSizeIndex, BitmapConverterRotation.Normal));
                }
            });

            this.listViewItemCollection.Add(new ListViewItem()
            {
                Text     = languageCode + " " + "Raster Coupon (Rotation90)",
                Enabled  = userInteractionEnabledList[6],
                Function = () =>
                {
                    return(Functions.PrinterFunctions.CreateCouponData(emulation, localizeReceipts, (int)this.paperSizeIndex, BitmapConverterRotation.Right90));
                }
            });
        }
Esempio n. 4
0
        public ApiPage(LocalizeReceipts.PaperSizeIndex paperSizeIndex)
        {
            InitializeComponent();

            this.paperSizeIndex = paperSizeIndex;

            this.Title = "API";

            this.contentPageComponent = new ContentPageComponent(this, this.blind);

            this.observableCollection = new ObservableCollection <ListViewItemCollection>();

            this.listViewItemCollection = new ListViewItemCollection("Sample");

            this.observableCollection.Add(this.listViewItemCollection);

            this.listView.ItemsSource = this.observableCollection;

            StarIoExtEmulation emulation = Configuration.Emulation;

            this.listViewItemCollection.Add(new ListViewItem("Generic", () => { return(Functions.ApiFunctions.CreateGenericData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("Font Style", () => { return(Functions.ApiFunctions.CreateFontStyleData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("Initialization", () => { return(Functions.ApiFunctions.CreateInitializationData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("Code Page", () => { return(Functions.ApiFunctions.CreateCodePageData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("International", () => { return(Functions.ApiFunctions.CreateInternationalData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("Feed", () => { return(Functions.ApiFunctions.CreateFeedData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("Character Space", () => { return(Functions.ApiFunctions.CreateCharacterSpaceData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("Line Space", () => { return(Functions.ApiFunctions.CreateLineSpaceData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("Emphasis", () => { return(Functions.ApiFunctions.CreateEmphasisData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("Invert", () => { return(Functions.ApiFunctions.CreateInvertData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("Under Line", () => { return(Functions.ApiFunctions.CreateUnderLineData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("Multiple", () => { return(Functions.ApiFunctions.CreateMultipleData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("Absolute Position", () => { return(Functions.ApiFunctions.CreateAbsolutePositionData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("Alignment", () => { return(Functions.ApiFunctions.CreateAlignmentData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("Logo", () => { return(Functions.ApiFunctions.CreateLogoData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("Cut Paper", () => { return(Functions.ApiFunctions.CreateCutPaperData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("Peripheral", () => { return(Functions.ApiFunctions.CreatePeripheralData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("Sound", () => { return(Functions.ApiFunctions.CreateSoundData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("Bitmap", () => { return(Functions.ApiFunctions.CreateBitmapData(emulation, (int)this.paperSizeIndex)); }));
            this.listViewItemCollection.Add(new ListViewItem("Barcode", () => { return(Functions.ApiFunctions.CreateBarcodeData(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("PDF417", () => { return(Functions.ApiFunctions.CreatePdf417Data(emulation)); }));
            this.listViewItemCollection.Add(new ListViewItem("QR Code", () => { return(Functions.ApiFunctions.CreateQrCodeData(emulation)); }));

            this.listViewItemCollection.Add(new ListViewItem("Black Mark", async() =>
            {
                Dictionary <string, Func <byte[]> > functionDictionary = new Dictionary <string, Func <byte[]> >
                {
                    { "Invalid", () => { return(Functions.ApiFunctions.CreateBlackMarkData(emulation, BlackMarkType.Invalid)); } },
                    { "Valid", () => { return(Functions.ApiFunctions.CreateBlackMarkData(emulation, BlackMarkType.Valid)); } },
                    { "Valid with Detection", () => { return(Functions.ApiFunctions.CreateBlackMarkData(emulation, BlackMarkType.ValidWithDetection)); } }
                };

                string[] buttons = functionDictionary.Keys.ToArray();

                try
                {
                    return(functionDictionary[await DisplayActionSheet("Select black mark type.", "Cancel", null, buttons)]());
                }
                catch
                {
                }

                return(null);
            }));

            this.listViewItemCollection.Add(new ListViewItem("Page Mode", () => { return(Functions.ApiFunctions.CreatePageModeData(emulation, (int)this.paperSizeIndex)); }));
        }