/// <summary> /// Creates a new <see cref="InRegionsBase"/> instance. /// </summary> public InRegionsBase(CreateImageHandler createImage, GetTextHandler getText) { ArgumentGuard.NotNull(createImage, nameof(createImage)); ArgumentGuard.NotNull(getText, nameof(getText)); createImage_ = createImage; getText_ = getText; }
/// <summary> /// Creates a new <see cref="InRegionBase"/> instance. /// </summary> /// <param name="id">Id of the region's image</param> /// <param name="bounds">The bounds of the region within the application's window</param> /// <param name="createImage">Creates a window image and returns its id.</param> /// <param name="getText">Returns the text located in an image region</param> public InRegionBase( string id, Rectangle bounds, CreateImageHandler createImage, GetTextHandler getText) : base(id, createImage) { ArgumentGuard.NotNull(createImage, nameof(createImage)); ArgumentGuard.NotNull(getText, nameof(getText)); Bounds = bounds; getText_ = getText; }
private string GetTextCallback(object data, string part) { if (part == Parts.GenListItem.Text) { return(GetTextHandler?.Invoke(data, part)); } else if (part == Parts.GenListItem.SubText) { return(GetSubTextHandler?.Invoke(data, part)); } return(null); }
/// <summary> /// Print form layout with specified content /// </summary> /// <param name="formType">Form type.</param> /// <param name="copyReceipt">Flag to identify if this is a copy.</param> /// <param name="getPrintTextHandler">Handler that is called to construct text for printing.</param> internal static void Print( FormType formType, bool copyReceipt, bool formInfoTemplateRequired, GetTextHandler getPrintTextHandler) { if (FiscalPrinter.FiscalPrinter.Instance.FiscalPrinterEnabled() && (formType == FormType.GiftCertificate || formType == FormType.TenderDeclaration)) { FiscalPrinter.FiscalPrinter.Instance.PrintReceipt(getPrintTextHandler(null, null)); } FormModulation formMod = new FormModulation(Printing.InternalApplication.Settings.Database.Connection); IList <PrinterAssociation> printerMapping = PrintingActions.GetActivePrinters(formMod, formType, copyReceipt); foreach (PrinterAssociation printerMap in printerMapping) { PrintFormLayout(printerMap, formMod, formType, copyReceipt, formInfoTemplateRequired, getPrintTextHandler); } }
/// <summary> /// Print form layout with specified content. /// </summary> /// <param name="formMod">Form modulation.</param> /// <param name="formInfo">Form info.</param> /// <param name="formType">Form type.</param> /// <param name="copyReceipt">Flag to identify if this is a copy.</param> /// <param name="getPrintTextHandler">Handler that is called to construct text for printing.</param> private static void PrintFormLayout( PrinterAssociation printerMap, FormModulation formMod, FormType formType, bool copyReceipt, bool formInfoTemplateRequired, GetTextHandler getPrintTextHandler) { FormInfo formInfo = printerMap.PrinterFormInfo; // Checking if formType requires template. if (formInfoTemplateRequired && (formInfo.HeaderTemplate == null)) { // 13038: Could not print the receipt because the receipt format could not be found. Printing.InternalApplication.Services.Dialog.ShowMessage(13038, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (PrintingActions.ShouldWePrint(formInfo, formType, copyReceipt, printerMap)) { try { string textToPrint = getPrintTextHandler(formMod, formInfo); if (formInfo.PrintAsSlip) { printerMap.Printer.PrintSlip(textToPrint); } else { printerMap.Printer.PrintReceipt(textToPrint); } } catch (Exception ex) { NetTracer.Warning("Printing [Print] - Exception while printing receipt"); POSFormsManager.ShowPOSErrorDialog(new PosisException(1003, ex)); } } }
public MenuItem(GetTextHandler getTextCallback, MenuItemEventHandler callback, MenuItemType type = MenuItemType.Button, MenuItemAction action = MenuItemAction.None) : this(getTextCallback, type, action) { Clicked += callback; }
public MenuItem(GetTextHandler getTextCallback, MenuItemType type = MenuItemType.Text, MenuItemAction action = MenuItemAction.None) : this(String.Empty, type, action) { this.getTextCallback = getTextCallback; }
string GetTextCallback(IntPtr data, IntPtr obj, IntPtr part) { GenItem item = ItemObject.GetItemById((int)data) as GenItem; return(GetTextHandler?.Invoke(item?.Data, Marshal.PtrToStringAnsi(part))); }
public SafeLabel() : base() { SetText += new SetTextHandler(SafeLabel_SetText); GetText += new GetTextHandler(SafeLabel_GetText); }
private string GetText(Control control) { GetTextHandler del = new GetTextHandler(InvokeGetText); return(this.Invoke(del, control) as string); }