public static byte[] CreatePasteTextBlackMarkData(StarIoExtEmulation emulation, LocalizeReceipts.ILocalizeReceipts localizeReceipts, string text, bool doubleHeight, BlackMarkType type, bool utf8) { ICommandBuilder commandBuilder = Extension.CreateCommandBuilder(emulation); commandBuilder.BeginDocument(); commandBuilder.AppendBlackMark(type); if (doubleHeight) { commandBuilder.AppendMultipleHeight(2); localizeReceipts.AppendPasteTextLabelData(commandBuilder, text, utf8); commandBuilder.AppendMultipleHeight(1); } else { localizeReceipts.AppendPasteTextLabelData(commandBuilder, text, utf8); } commandBuilder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); // commandBuilder.AppendBlackMark(BlackMarkType.Invalid); commandBuilder.EndDocument(); return(commandBuilder.Commands); }
public static byte[] CreateData(StarIoExtEmulation emulation, PeripheralChannel channel) { ICommandBuilder commandBuilder = Extension.CreateCommandBuilder(emulation); commandBuilder.BeginDocument(); commandBuilder.AppendPeripheral(channel); commandBuilder.EndDocument(); return(commandBuilder.Commands); }
public static byte[] CreateTextReceiptData(StarIoExtEmulation emulation, LocalizeReceipts.ILocalizeReceipts localizeReceipts, bool utf8) { ICommandBuilder commandBuilder = Extension.CreateCommandBuilder(emulation); commandBuilder.BeginDocument(); localizeReceipts.AppendTextReceiptData(commandBuilder, utf8); commandBuilder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); commandBuilder.EndDocument(); return(commandBuilder.Commands); }
public static byte[] CreateCouponData(StarIoExtEmulation emulation, LocalizeReceipts.ILocalizeReceipts localizeReceipts, int width, BitmapConverterRotation rotation) { Stream stream = localizeReceipts.CreateCouponImage(); ICommandBuilder commandBuilder = Extension.CreateCommandBuilder(emulation); commandBuilder.BeginDocument(); commandBuilder.AppendBitmap(stream, false, width, true, rotation); commandBuilder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); commandBuilder.EndDocument(); return(commandBuilder.Commands); }
public async static Task <byte[]> CreateScaleRasterReceiptData(StarIoExtEmulation emulation, LocalizeReceipts.ILocalizeReceipts localizeReceipts, int width, bool bothScale) { Stream stream = await localizeReceipts.CreateScaleRasterReceiptImageAsync(); ICommandBuilder commandBuilder = Extension.CreateCommandBuilder(emulation); commandBuilder.BeginDocument(); commandBuilder.AppendBitmap(stream, false, width, bothScale); commandBuilder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); commandBuilder.EndDocument(); return(commandBuilder.Commands); }
public static byte[] CreateTextBlackMarkData(StarIoExtEmulation emulation, LocalizeReceipts.ILocalizeReceipts localizeReceipts, BlackMarkType type, bool utf8) { ICommandBuilder commandBuilder = Extension.CreateCommandBuilder(emulation); commandBuilder.BeginDocument(); commandBuilder.AppendBlackMark(type); localizeReceipts.AppendTextLabelData(commandBuilder, utf8); commandBuilder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); // commandBuilder.AppendBlackMark(BlackMarkType.Invalid); commandBuilder.EndDocument(); return(commandBuilder.Commands); }
public static byte[] CreateTextPageModeData(StarIoExtEmulation emulation, LocalizeReceipts.ILocalizeReceipts localizeReceipts, Rectangle rectangle, BitmapConverterRotation rotation, bool utf8) { ICommandBuilder commandBuilder = Extension.CreateCommandBuilder(emulation); commandBuilder.BeginDocument(); commandBuilder.BeginPageMode(rectangle, rotation); localizeReceipts.AppendTextLabelData(commandBuilder, utf8); commandBuilder.EndPageMode(); commandBuilder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); commandBuilder.EndDocument(); return(commandBuilder.Commands); }
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)); })); }
protected override void OnAppearing() { base.OnAppearing(); this.listViewItemCollection0.Clear(); this.listViewItemCollection1.Clear(); this.listViewItemCollection2.Clear(); this.listViewItemCollection3.Clear(); this.listViewItemCollection4.Clear(); this.listViewItemCollection5.Clear(); bool userInteractionEnabled; string modelName = Configuration.ModelName; string portName = Configuration.PortName; if (modelName == "") { this.listViewItemCollection0.Add(new ListViewItem("Unselected State", Color.Red, async() => { await Navigation.PushAsync(new SearchPortPage(), true); })); userInteractionEnabled = false; } else { this.listViewItemCollection0.Add(new ListViewItem(modelName + " " + "(" + portName + ")", Color.Blue, async() => { await Navigation.PushAsync(new SearchPortPage(), true); })); userInteractionEnabled = true; } Dictionary <StarIoExtEmulation, List <bool> > userInteractionEnabledDictionary = new Dictionary <StarIoExtEmulation, List <bool> >() { { StarIoExtEmulation.StarPRNT, new List <bool>() { userInteractionEnabled, userInteractionEnabled, userInteractionEnabled, userInteractionEnabled } }, { StarIoExtEmulation.StarLine, new List <bool>() { userInteractionEnabled, userInteractionEnabled, userInteractionEnabled, userInteractionEnabled } }, { StarIoExtEmulation.StarGraphic, new List <bool>() { userInteractionEnabled, userInteractionEnabled, userInteractionEnabled, userInteractionEnabled } }, { StarIoExtEmulation.EscPos, new List <bool>() { userInteractionEnabled, userInteractionEnabled, userInteractionEnabled, userInteractionEnabled } }, { StarIoExtEmulation.EscPosMobile, new List <bool>() { userInteractionEnabled, false, userInteractionEnabled, userInteractionEnabled } }, { StarIoExtEmulation.StarDotImpact, new List <bool>() { userInteractionEnabled, userInteractionEnabled, userInteractionEnabled, userInteractionEnabled } }, { StarIoExtEmulation.StarPRNTL, new List <bool>() { userInteractionEnabled, userInteractionEnabled, userInteractionEnabled, userInteractionEnabled } } }; Dictionary <string, LocalizeReceipts.LanguageIndex> languageDictionary = new Dictionary <string, LocalizeReceipts.LanguageIndex> { { "English", LocalizeReceipts.LanguageIndex.English }, { "Japanese", LocalizeReceipts.LanguageIndex.Japanese }, { "French", LocalizeReceipts.LanguageIndex.French }, { "Portuguese", LocalizeReceipts.LanguageIndex.Portuguese }, { "Spanish", LocalizeReceipts.LanguageIndex.Spanish }, { "German", LocalizeReceipts.LanguageIndex.German }, { "Russian", LocalizeReceipts.LanguageIndex.Russian }, { "Simplified Chinese", LocalizeReceipts.LanguageIndex.SimplifiedChinese }, { "Traditional Chinese", LocalizeReceipts.LanguageIndex.TraditionalChinese } }; Dictionary <string, LocalizeReceipts.PaperSizeIndex> paperSizeDictionary = new Dictionary <string, LocalizeReceipts.PaperSizeIndex> { { "2\" (384dots)", LocalizeReceipts.PaperSizeIndex.TwoInch }, { "3\" (576dots)", LocalizeReceipts.PaperSizeIndex.ThreeInch }, { "4\" (832dots)", LocalizeReceipts.PaperSizeIndex.FourInch } }; List <bool> userInteractionEnabledList = userInteractionEnabledDictionary[Configuration.Emulation]; this.listViewItemCollection1.Add(new ListViewItem("Sample", userInteractionEnabledList[0], async() => { try { LocalizeReceipts.LanguageIndex languageIndex = languageDictionary[await DisplayActionSheet("Select language.", "Cancel", null, languageDictionary.Keys.ToArray())]; LocalizeReceipts.PaperSizeIndex paperSizeIndex; StarIoExtEmulation emulation = Configuration.Emulation; if (emulation == StarIoExtEmulation.EscPos) { paperSizeIndex = LocalizeReceipts.PaperSizeIndex.EscPosThreeInch; } else if (emulation == StarIoExtEmulation.StarDotImpact) { paperSizeIndex = LocalizeReceipts.PaperSizeIndex.DotImpactThreeInch; } else { paperSizeIndex = paperSizeDictionary[await DisplayActionSheet("Select paper size.", "Cancel", null, paperSizeDictionary.Keys.ToArray())]; } await Navigation.PushAsync(new PrinterPage(languageIndex, paperSizeIndex), true); } catch { } })); this.listViewItemCollection2.Add(new ListViewItem("Sample", userInteractionEnabledList[1], async() => { await Navigation.PushAsync(new CashDrawerPage(), true); })); this.listViewItemCollection3.Add(new ListViewItem("Sample", userInteractionEnabledList[2], async() => { try { LocalizeReceipts.PaperSizeIndex paperSizeIndex; StarIoExtEmulation emulation = Configuration.Emulation; if (emulation == StarIoExtEmulation.EscPos) { paperSizeIndex = LocalizeReceipts.PaperSizeIndex.EscPosThreeInch; } else if (emulation == StarIoExtEmulation.StarDotImpact) { paperSizeIndex = LocalizeReceipts.PaperSizeIndex.DotImpactThreeInch; } else { paperSizeIndex = paperSizeDictionary[await DisplayActionSheet("Select paper size.", "Cancel", null, paperSizeDictionary.Keys.ToArray())]; } await Navigation.PushAsync(new ApiPage(paperSizeIndex), true); } catch { } })); this.listViewItemCollection4.Add(new ListViewItem("Sample", userInteractionEnabledList[3], async() => { await Navigation.PushAsync(new DeviceStatusPage(), true); })); this.listViewItemCollection5.Add(new ListViewItem("Library Version", true, async() => { string message = "StarIO version " + Port.StarIOVersion + Environment.NewLine + Extension.StarIoExtVersion; await DisplayAlert("Library Version", message, "OK"); })); }
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)); } }); }
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)); })); }