コード例 #1
0
        /// <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;
        }
コード例 #2
0
        /// <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);
        }
コード例 #4
0
        /// <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);
            }
        }
コード例 #5
0
        /// <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));
                }
            }
        }
コード例 #6
0
ファイル: MenuItem.cs プロジェクト: OlegPalchyk/imBMW
 public MenuItem(GetTextHandler getTextCallback, MenuItemEventHandler callback, MenuItemType type = MenuItemType.Button, MenuItemAction action = MenuItemAction.None)
     : this(getTextCallback, type, action)
 {
     Clicked += callback;
 }
コード例 #7
0
ファイル: MenuItem.cs プロジェクト: OlegPalchyk/imBMW
 public MenuItem(GetTextHandler getTextCallback, MenuItemType type = MenuItemType.Text, MenuItemAction action = MenuItemAction.None)
     : this(String.Empty, type, action)
 {
     this.getTextCallback = getTextCallback;
 }
コード例 #8
0
ファイル: GenItemClass.cs プロジェクト: yunmiha/TizenFX
        string GetTextCallback(IntPtr data, IntPtr obj, IntPtr part)
        {
            GenItem item = ItemObject.GetItemById((int)data) as GenItem;

            return(GetTextHandler?.Invoke(item?.Data, Marshal.PtrToStringAnsi(part)));
        }
コード例 #9
0
		public SafeLabel() : base()
		{
            SetText += new SetTextHandler(SafeLabel_SetText);
            GetText += new GetTextHandler(SafeLabel_GetText);
		}
コード例 #10
0
ファイル: SafeLabel.cs プロジェクト: dasca/WinShooter-Legacy
 public SafeLabel() : base()
 {
     SetText += new SetTextHandler(SafeLabel_SetText);
     GetText += new GetTextHandler(SafeLabel_GetText);
 }
コード例 #11
0
        private string GetText(Control control)
        {
            GetTextHandler del = new GetTextHandler(InvokeGetText);

            return(this.Invoke(del, control) as string);
        }
コード例 #12
0
ファイル: MenuItem.cs プロジェクト: temur03/imBMW
 public MenuItem(GetTextHandler getTextCallback, MenuItemEventHandler callback, MenuItemType type = MenuItemType.Button, MenuItemAction action = MenuItemAction.None)
     : this(getTextCallback, type, action)
 {
     Clicked += callback;
 }
コード例 #13
0
ファイル: MenuItem.cs プロジェクト: temur03/imBMW
 public MenuItem(GetTextHandler getTextCallback, MenuItemType type = MenuItemType.Text, MenuItemAction action = MenuItemAction.None)
     : this(String.Empty, type, action)
 {
     this.getTextCallback = getTextCallback;
 }