Ejemplo n.º 1
0
        /// <summary>
        /// 刷新整个Led屏幕
        /// 由于API不支持更新某个逻辑窗口,因此需要刷新整个屏幕:让未更新的窗口立即显示以前的内容,让其他窗口更新信息(动态效果)
        /// </summary>
        /// <param name="activeWindowId"></param>
        private void RefreshWholeScreen(int activeWindowId)
        {
            return;

            var win  = windows[activeWindowId];
            var wins = windows.Values.Where(x => x.LedIndex == win.LedIndex);

            LedAPI.User_DelAllProgram(win.LedIndex);
            var programId = LedAPI.User_AddProgram(win.LedIndex, true, 0);

            foreach (var w in wins)
            {
                var text = new User_Text();
                text.chContent = w.Text;
                text.FontInfo  = w.Font;
                text.MoveSet   = w.Movement;

                if (w.Id != activeWindowId)
                {
                    text.MoveSet.iActionType = 1;                        // 除了当前窗,其他窗的文字都马上出现
                }
                text.PartInfo = w.Frame;
                LedAPI.User_AddText(win.LedIndex, ref text, programId);
            }
            LedAPI.User_SendToScreen(win.LedIndex);
        }
        //添加文本
        private void button3_Click(object sender, EventArgs e)
        {
            User_Text Text = new User_Text();

            Text.BkColor   = 0;
            Text.chContent = ZoneText.Text.Replace("\\n", "\n");

            Text.PartInfo.FrameColor = 0;
            Text.PartInfo.iFrameMode = 0;
            Text.PartInfo.iHeight    = 32;
            Text.PartInfo.iWidth     = 64;
            Text.PartInfo.iX         = 0;
            Text.PartInfo.iY         = 0;

            Text.FontInfo.bFontBold      = false;
            Text.FontInfo.bFontItaic     = false;
            Text.FontInfo.bFontUnderline = false;
            Text.FontInfo.colorFont      = g_iYellow;
            Text.FontInfo.iFontSize      = 12;
            Text.FontInfo.strFontName    = "宋体";
            Text.FontInfo.iAlignStyle    = 0;
            Text.FontInfo.iVAlignerStyle = 0;
            Text.FontInfo.iRowSpace      = 2;

            Text.MoveSet.bClear           = false;
            Text.MoveSet.iActionSpeed     = 5;
            Text.MoveSet.iActionType      = 0;
            Text.MoveSet.iHoldTime        = 20;
            Text.MoveSet.iClearActionType = 0;
            Text.MoveSet.iClearSpeed      = 4;
            Text.MoveSet.iFrameTime       = 20;

            if (-1 == User_AddText(g_iCardNum, ref Text, g_iProgramIndex))
            {
                MessageBox.Show("添加文本失败!");
            }
            else
            {
                MessageBox.Show("添加文本成功!");
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 添加显示内容
        /// </summary>
        /// <param name="cardNum">控制卡地址码</param>
        /// <param name="iWidth">屏幕宽</param>
        /// <param name="iHeight">屏幕高</param>
        /// <param name="content">显示内容</param>
        /// <param name="g_iProgramIndex">节目顺序</param>
        /// <param name="showType">播放方式</param>
        /// <param name="fontName">字体名称</param>
        /// <param name="fontSize">字体大小</param>
        /// <param name="fontColor">字体颜色</param>
        /// <param name="bFontBold">字体是否加粗</param>
        /// <param name="iAlignStyle">是否左右居中</param>
        /// <returns></returns>
        public static bool AddText(int cardNum, int iWidth, int iHeight, string content, int g_iProgramIndex, int showType, string fontName, int fontSize, int fontColor, bool bFontBold, int iAlignStyle)
        {
            User_Text areaTxt = new User_Text();

            areaTxt.BkColor                  = 0;
            areaTxt.chContent                = content;
            areaTxt.PartInfo.iFrameMode      = 0;
            areaTxt.PartInfo.iHeight         = iHeight;
            areaTxt.PartInfo.iWidth          = iWidth;
            areaTxt.PartInfo.iX              = 0;
            areaTxt.PartInfo.iY              = 0;
            areaTxt.FontInfo.iAlignStyle     = iAlignStyle;
            areaTxt.FontInfo.iVAlignerStyle  = 1;
            areaTxt.FontInfo.bFontBold       = bFontBold;
            areaTxt.FontInfo.bFontItaic      = false;
            areaTxt.FontInfo.bFontUnderline  = false;
            areaTxt.FontInfo.colorFont       = fontColor;
            areaTxt.FontInfo.iFontSize       = fontSize;
            areaTxt.PartInfo.FrameColor      = fontColor;
            areaTxt.FontInfo.strFontName     = fontName;
            areaTxt.MoveSet.bClear           = false;
            areaTxt.MoveSet.iActionSpeed     = Convert.ToInt32(ConfigurationManager.AppSettings["PlaySpeed"]);
            areaTxt.MoveSet.iActionType      = showType;
            areaTxt.MoveSet.iHoldTime        = 0;
            areaTxt.MoveSet.iClearActionType = 0;
            areaTxt.MoveSet.iClearSpeed      = 0;
            areaTxt.MoveSet.iFrameTime       = 20;
            if (-1 == User_AddText(cardNum, ref areaTxt, g_iProgramIndex))
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 4
0
 public static extern int User_AddText(int CardNum, ref User_Text pText, int iProgramIndex);
        private void publishTxt()
        {
            //判断从哪种方式获取天气信息
            int sourceEnum = Convert.ToInt16(this.GetRegistryFolder().GetValue("sourceType"));

            //
            if (0.Equals(sourceEnum))   // 从Url获取天气txt
            {
                this.getTxtFromUrl();
                this.WriteLog("通过Url更新文本:\r\n" + this.publishText);
            }
            else if (1.Equals(sourceEnum))     // 从文件获取天气txt
            {
                this.getTxtFromFile();
                this.WriteLog("通过文件更新文本:\r\n" + this.publishText);
            }
            else     // 从网络天气服务获取
            {
                this.getWeatherFromUrl();
                this.WriteLog("通过Api更新文本:\r\n" + this.publishText);
            }
            //加载屏幕参数
            String iniFilePath = this.GetRegistryFolder().GetValue("iniFile").ToString().Replace(".\\", System.Threading.Thread.GetDomain().BaseDirectory);

            User_ReloadIniFile(iniFilePath);
            this.WriteLog("加载屏幕配置文件:" + iniFilePath);
            this.iCardNum = Convert.ToInt16(this.GetRegistryFolder().GetValue("iCardNum"));
            if (!User_RealtimeConnect(this.iCardNum))
            {
                this.WriteLog("连接控制屏失败 iCardNum:" + iCardNum);
                return;
            }
            this.WriteLog("连接屏幕成功 iCardNum:" + iCardNum);
            if (!User_OpenScreen(this.iCardNum))
            {
                this.WriteLog("打开显示屏失败");
            }
            else
            {
                this.WriteLog("打开显示屏成功");
            }
            if (!User_DelAllProgram(this.iCardNum))
            {
                this.WriteLog("清除原节目失败");
                return;
            }
            this.WriteLog("清除原节目成功");
            this.iProgramIndex = User_AddProgram(this.iCardNum, true, 40);

            User_Text Text = new User_Text();

            Text.BkColor   = Convert.ToInt16(this.GetRegistryFolder().GetValue("BkColor"));
            Text.chContent = this.publishText;

            Text.PartInfo.FrameColor = Convert.ToInt16(this.GetRegistryFolder().CreateSubKey("PartInfo").GetValue("FrameColor"));
            Text.PartInfo.iFrameMode = Convert.ToInt16(this.GetRegistryFolder().CreateSubKey("PartInfo").GetValue("iFrameMode"));
            Text.PartInfo.iHeight    = Convert.ToInt16(this.GetRegistryFolder().CreateSubKey("PartInfo").GetValue("iHeight"));
            Text.PartInfo.iWidth     = Convert.ToInt16(this.GetRegistryFolder().CreateSubKey("PartInfo").GetValue("iWidth"));
            Text.PartInfo.iX         = Convert.ToInt32(this.GetRegistryFolder().CreateSubKey("PartInfo").GetValue("iX"));
            Text.PartInfo.iY         = Convert.ToInt32(this.GetRegistryFolder().CreateSubKey("PartInfo").GetValue("iY"));

            Text.FontInfo.bFontBold      = Convert.ToBoolean(this.GetRegistryFolder().CreateSubKey("FontInfo").GetValue("bFontBold"));
            Text.FontInfo.bFontItaic     = Convert.ToBoolean(this.GetRegistryFolder().CreateSubKey("FontInfo").GetValue("bFontItaic"));
            Text.FontInfo.bFontUnderline = Convert.ToBoolean(this.GetRegistryFolder().CreateSubKey("FontInfo").GetValue("bFontUnderline"));
            Text.FontInfo.colorFont      = Convert.ToInt16(this.GetRegistryFolder().CreateSubKey("FontInfo").GetValue("colorFont"));
            Text.FontInfo.iFontSize      = Convert.ToInt16(this.GetRegistryFolder().CreateSubKey("FontInfo").GetValue("iFontSize"));
            Text.FontInfo.strFontName    = this.GetRegistryFolder().CreateSubKey("FontInfo").GetValue("strFontName").ToString();
            Text.FontInfo.iAlignStyle    = Convert.ToInt16(this.GetRegistryFolder().CreateSubKey("FontInfo").GetValue("iAlignStyle"));
            Text.FontInfo.iVAlignerStyle = Convert.ToInt16(this.GetRegistryFolder().CreateSubKey("FontInfo").GetValue("iVAlignerStyle"));
            Text.FontInfo.iRowSpace      = Convert.ToInt16(this.GetRegistryFolder().CreateSubKey("FontInfo").GetValue("iRowSpace"));

            Text.MoveSet.bClear           = Convert.ToBoolean(this.GetRegistryFolder().CreateSubKey("MoveSet").GetValue("bClear"));
            Text.MoveSet.iActionSpeed     = Convert.ToInt16(this.GetRegistryFolder().CreateSubKey("MoveSet").GetValue("iActionSpeed"));
            Text.MoveSet.iActionType      = Convert.ToInt16(this.GetRegistryFolder().CreateSubKey("MoveSet").GetValue("iActionType"));
            Text.MoveSet.iHoldTime        = Convert.ToInt16(this.GetRegistryFolder().CreateSubKey("MoveSet").GetValue("iHoldTime"));
            Text.MoveSet.iClearActionType = Convert.ToInt16(this.GetRegistryFolder().CreateSubKey("MoveSet").GetValue("iClearActionType"));
            Text.MoveSet.iClearSpeed      = Convert.ToInt16(this.GetRegistryFolder().CreateSubKey("MoveSet").GetValue("iClearSpeed"));
            Text.MoveSet.iFrameTime       = Convert.ToInt16(this.GetRegistryFolder().CreateSubKey("MoveSet").GetValue("iFrameTime"));

            this.WriteLog("节目建立成功");
            if (-1 == User_AddText(this.iCardNum, ref Text, this.iProgramIndex))
            {
                this.WriteLog("添加文本失败");
            }
            else if (!User_SendToScreen(this.iCardNum))
            {
                this.WriteLog("发送到屏幕失败");
            }
            else
            {
                this.WriteLog("发送到屏幕成功");
            }

            if (!User_RealtimeDisConnect(this.iCardNum))
            {
                this.WriteLog("关闭连接失败");
            }
            else
            {
                this.WriteLog("关闭连接成功");
            }
        }
Ejemplo n.º 6
0
        private void TriggerTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            ss = ss + 2;
            if (!inElapsed)
            {
                inElapsed = true;
                try
                {
                    foreach (var item in storeInRequest)
                    {
                        int[] storeInRequest = HttpUtil.HttpRequest <int[]>(item.RequestCode);
                        var   requestData    = this.getRequestData(storeInRequest);
                        //var requestData = new RequestData { Sign=1,PalletBarcode="05011337",WorkPositionNo=1 };
                        var billUrl = "/Api/AssortedBill/GetAssortedBillOfAudited?uniqueId=";
                        if (requestData.PalletBarcode != item.OldPalletcode || requestData.Sign != item.Sign)
                        {
                            if (requestData.Sign == 0)
                            {
                                var delstate = User_RealtimeScreenClear(item.CardNum);
                            }
                            if (requestData.Sign == 1)
                            {
                                var delstate = User_DelAllProgram(item.CardNum);
                                if (delstate == false)
                                {
                                    listLogger.Items.Add("删除节目失败!");
                                    inElapsed = false;
                                    return;
                                }
                                listLogger.Items.Add("清屏成功");
                                var       programIndex = User_AddProgram(item.CardNum, false, 10);
                                User_Text SingleText   = new User_Text();
                                billUrl = billUrl + requestData.PalletBarcode;
                                var billUrlRequest = HttpUtil.HttpRequest <AssortedBillModel>(billUrl);
                                var LEDtest        = "";
                                if (billUrlRequest == null)
                                {
                                    LEDtest = $"唯一码:" + requestData.PalletBarcode + ",不存在已审核的拼盘单据,请核查!";
                                }
                                else
                                {
                                    LEDtest = "托盘条码:" + billUrlRequest.UniqueId + "  配盘名称:" + billUrlRequest.MatchPalletName +
                                              "\n牌号:" + billUrlRequest.BrandNames + " 托盘类型:" + billUrlRequest.PalletTypeName;
                                }

                                SingleText.BkColor                  = 0;
                                SingleText.chContent                = LEDtest;
                                SingleText.PartInfo.iFrameMode      = 0;
                                SingleText.PartInfo.iHeight         = 96;
                                SingleText.PartInfo.iWidth          = 192;
                                SingleText.PartInfo.iX              = 0;
                                SingleText.PartInfo.iY              = 0;
                                SingleText.FontInfo.bFontBold       = false;
                                SingleText.FontInfo.bFontItaic      = false;
                                SingleText.FontInfo.bFontUnderline  = false;
                                SingleText.FontInfo.colorFont       = 0xFF;
                                SingleText.FontInfo.iFontSize       = 9;
                                SingleText.PartInfo.FrameColor      = 0xFF;
                                SingleText.FontInfo.strFontName     = "宋体";
                                SingleText.MoveSet.bClear           = false;
                                SingleText.MoveSet.iActionSpeed     = 6;
                                SingleText.MoveSet.iActionType      = 1;
                                SingleText.MoveSet.iHoldTime        = 20;
                                SingleText.MoveSet.iClearActionType = 0;
                                SingleText.MoveSet.iClearSpeed      = 0;
                                SingleText.MoveSet.iFrameTime       = 20;

                                var addint = User_AddText(item.CardNum, ref SingleText, programIndex);

                                if (-1 == addint)
                                {
                                    listLogger.Items.Add("添加文本失败!");
                                }

                                var sendstate = User_SendToScreen(item.CardNum);
                                if (sendstate == false)
                                {
                                    listLogger.Items.Add("发送节目失败!");
                                }
                                else
                                {
                                    listLogger.Items.Add("发送节目成功!");
                                }
                            }
                            if (requestData.Sign == 2)
                            {
                                billUrl = "/Api/AssortedBill/GetAssortedBillOfAllocated?uniqueId=" + requestData.PalletBarcode;
                                var delstate = User_DelAllProgram(item.CardNum);
                                if (delstate == false)
                                {
                                    listLogger.Items.Add("删除节目失败!");
                                    inElapsed = false;
                                    return;
                                }
                                listLogger.Items.Add("清屏成功");
                                var       programIndex = User_AddProgram(item.CardNum, false, 10);
                                User_Text SingleText   = new User_Text();
                                billUrl = billUrl + requestData.PalletBarcode;
                                var billUrlRequest = HttpUtil.HttpRequest <AssortedBillModel>(billUrl);
                                var LEDtest        = "";
                                if (billUrlRequest == null)
                                {
                                    LEDtest = $"唯一码:" + requestData.PalletBarcode + ",不存在已审核的拼盘单据,请核查!";
                                }
                                else
                                {
                                    LEDtest = "托盘条码:" + billUrlRequest.UniqueId + "  配盘名称:" + billUrlRequest.MatchPalletName +
                                              "\n牌号:" + billUrlRequest.BrandNames + " 托盘类型:" + billUrlRequest.PalletTypeName;
                                }

                                SingleText.BkColor                  = 0;
                                SingleText.chContent                = LEDtest;
                                SingleText.PartInfo.iFrameMode      = 0;
                                SingleText.PartInfo.iHeight         = 96;
                                SingleText.PartInfo.iWidth          = 192;
                                SingleText.PartInfo.iX              = 0;
                                SingleText.PartInfo.iY              = 0;
                                SingleText.FontInfo.bFontBold       = false;
                                SingleText.FontInfo.bFontItaic      = false;
                                SingleText.FontInfo.bFontUnderline  = false;
                                SingleText.FontInfo.colorFont       = 0xFF;
                                SingleText.FontInfo.iFontSize       = 9;
                                SingleText.PartInfo.FrameColor      = 0xFF;
                                SingleText.FontInfo.strFontName     = "宋体";
                                SingleText.MoveSet.bClear           = false;
                                SingleText.MoveSet.iActionSpeed     = 6;
                                SingleText.MoveSet.iActionType      = 1;
                                SingleText.MoveSet.iHoldTime        = 20;
                                SingleText.MoveSet.iClearActionType = 0;
                                SingleText.MoveSet.iClearSpeed      = 0;
                                SingleText.MoveSet.iFrameTime       = 20;

                                var addint = User_AddText(item.CardNum, ref SingleText, programIndex);

                                if (-1 == addint)
                                {
                                    listLogger.Items.Add("添加文本失败!");
                                }

                                var sendstate = User_SendToScreen(item.CardNum);
                                if (sendstate == false)
                                {
                                    listLogger.Items.Add("发送节目失败!");
                                }
                                else
                                {
                                    listLogger.Items.Add("发送节目成功!");
                                }
                            }
                            item.OldPalletcode = requestData.PalletBarcode;
                            item.Sign          = requestData.Sign;
                        }
                    }
                }
                catch (Exception ex)
                {
                    listLogger.Items.Add(ex.Message);
                }

                inElapsed = false;
            }
        }