Esempio n. 1
0
        /// <summary>
        /// 设备上报页码识别事件
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="strDeviceMac"></param>
        /// <param name="nNoteId"></param>
        /// <param name="nPageId"></param>
        private static void deviceShowPageNew(IntPtr ctx, IntPtr strDeviceMac, int nNoteId, int nPageId, int nPageInfo)
        {
            GCHandle thisHandle = GCHandle.FromIntPtr(ctx);
            RbtNet   rbtNetThis = (RbtNet)thisHandle.Target;

            if (rbtNetThis != null)
            {
                if (rbtNetThis.deviceShowPageNewEvt_ != null)
                {
                    rbtNetThis.deviceShowPageNewEvt_(ctx, strDeviceMac, nNoteId, nPageId, nPageInfo);
                }
                else if (rbtNetThis.deviceShowPageEvt_ != null)
                {
                    rbtNetThis.deviceShowPageEvt_(ctx, strDeviceMac, nNoteId, nPageId);
                }
            }
        }
        /// <summary>
        /// 设备上报页码识别事件
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="strDeviceMac"></param>
        /// <param name="nNoteId"></param>
        /// <param name="nPageId"></param>
        private static void deviceShowPageNew(IntPtr ctx, IntPtr strDeviceMac, int nNoteId, int nPageId, int nPageInfo)
        {
            GCHandle thisHandle = GCHandle.FromIntPtr(ctx);
            RbtNet   rbtNetThis = (RbtNet)thisHandle.Target;

            if (rbtNetThis != null)
            {
                int _nPageInfo = 0;
                if (nPageInfo != 0)
                {
                    string d    = System.Convert.ToString(nPageInfo, 2);
                    int    dlen = d.Length;
                    for (int j = 0; j < 17 - dlen; j++)
                    {
                        d = "0" + d;
                    }
                    switch (rbtNetThis.pt)
                    {
                    case PrintType.Base:
                    default:
                        _nPageInfo = nPageInfo;
                        break;

                    case PrintType.Fault_tolerance:
                        string code = "" + d[1] + d[6] + d[9] + d[12] + d[15];
                        _nPageInfo = Convert.ToInt32(code, 2);
                        break;

                    case PrintType.Fault_tolerance2:
                        string code2 = "" + d[0] + d[2] + d[5] + d[7] + d[9] + d[11] + d[13] + d[15];
                        _nPageInfo = Convert.ToInt32(code2, 2);
                        break;
                    }
                }

                if (rbtNetThis.deviceShowPageNewEvt_ != null)
                {
                    rbtNetThis.deviceShowPageNewEvt_(ctx, strDeviceMac, nNoteId, nPageId, _nPageInfo);
                }
                else if (rbtNetThis.deviceShowPageEvt_ != null)
                {
                    rbtNetThis.deviceShowPageEvt_(ctx, strDeviceMac, nNoteId, nPageId);
                }
            }
        }