コード例 #1
0
ファイル: ServiceOptions.cs プロジェクト: rabchev/ErpNet.FP
        public void ReconfigurePrinterConstants(DeviceInfo info)
        {
            RWLock.EnterReadLock();
            if (!PrintersProperties.TryGetValue(info.SerialNumber, out PrinterProperties? printerProperties))
            {
                printerProperties = new PrinterProperties();
                PrintersProperties.Add(info.SerialNumber, printerProperties);
            }
            if (printerProperties.PrinterConstants.TryGetValue("commentTextMaxLength", out string commentTextMaxLength))
            {
                if (int.TryParse(commentTextMaxLength, out int value))
                {
                    if (value > 0)
                    {
                        info.CommentTextMaxLength = value;
                    }
                }
            }
            if (printerProperties.PrinterConstants.TryGetValue("itemTextMaxLength", out string itemTextMaxLength))
            {
                if (int.TryParse(itemTextMaxLength, out int value))
                {
                    if (value > 0)
                    {
                        info.ItemTextMaxLength = value;
                    }
                }
            }

            RWLock.ExitReadLock();
        }
コード例 #2
0
ファイル: ServiceOptions.cs プロジェクト: rabchev/ErpNet.FP
        public void ReconfigurePrinterOptions(DeviceInfo info)
        {
            RWLock.EnterReadLock();
            try
            {
                if (!PrintersProperties.TryGetValue(info.SerialNumber, out PrinterProperties? printerProperties))
                {
                    printerProperties = new PrinterProperties();
                    PrintersProperties.Add(info.SerialNumber, printerProperties);
                }

                if (printerProperties.PrinterOptions.TryGetValue("supportPaymentTerminal", out string supportPaymentTerminal))
                {
                    if (bool.TryParse(supportPaymentTerminal, out bool value))
                    {
                        info.SupportPaymentTerminal = value;
                    }
                }
                else
                {
                    printerProperties.PrinterOptions["supportPaymentTerminal"] = info.SupportPaymentTerminal.ToString();
                }
                if (printerProperties.PrinterOptions.TryGetValue("usePaymentTerminal", out string usePaymentTerminal))
                {
                    if (bool.TryParse(usePaymentTerminal, out bool value))
                    {
                        info.UsePaymentTerminal = value;
                    }
                }
                else
                {
                    printerProperties.PrinterOptions["usePaymentTerminal"] = info.UsePaymentTerminal.ToString();
                }
            }
            finally
            {
                RWLock.ExitReadLock();
            }
        }