Пример #1
0
        /// <summary>
        /// 加载基础信息
        /// </summary>
        private void IniteData()
        {
            //txt文件读取信息
            string actionShowPath = Application.StartupPath + @"\\" + @"ActionShow.txt";//播放方式文件

            if (File.Exists(actionShowPath))
            {
                //播放方式
                DataTable dt = new DataTable();
                dt.Columns.Add("编号");
                dt.Columns.Add("名称");
                DataTable dtAction = PublicClass.GetXMLInfo(actionShowPath, dt, "ActionType", "AcitonId", "ActionName");
                cmbShowType.DataSource    = dtAction;
                cmbShowType.ValueMember   = "编号";
                cmbShowType.DisplayMember = "名称";
                cmbShowType.SelectedIndex = 0;
            }
            //屏幕信息
            dtScreen               = bllScreeenSetting.GetScreenSetting(string.Empty);
            cmbLEDId.ValueMember   = "AddressNum";
            cmbLEDId.DisplayMember = "ScreenID";
            cmbLEDId.DataSource    = dtScreen;
            cmbLEDId.SelectedIndex = 0;
        }
Пример #2
0
        /// <summary>
        /// 添加控制卡参数到配置文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                int carTpe = 0;
                if (cmbControlType.Text.Equals("21-EQ2013"))
                {
                    carTpe = 21;
                }
                else if (cmbControlType.Text.Equals("22-EQ2023"))
                {
                    carTpe = 22;
                }
                else if (cmbControlType.Text.Equals("23-EQ2033"))
                {
                    carTpe = 23;
                }
                else
                {
                    MessageBox.Show("信息不全!");
                    return;
                }
                int colorStyle = 0;
                if (cmbColor.Text.Equals("单色"))
                {
                    colorStyle = 0;
                }
                else if (cmbColor.Text.Equals("双色"))
                {
                    colorStyle = 1;
                }

                ScreenSetting screenSetting = new ScreenSetting();
                screenSetting.ScreenID     = txtLEDid.Text.Trim();
                screenSetting.ScreenWidth  = Convert.ToInt32(txtWidth.Text);
                screenSetting.ScreenHeight = Convert.ToInt32(txtHeight.Text);
                screenSetting.AddressNum   = Convert.ToInt32(cmbCarAdress.Text);
                screenSetting.CarName      = cmbControlType.Text;
                screenSetting.ColorStyle   = cmbColor.Text;
                screenSetting.IpAddress    = IpAddress0.Text + "." + IpAddress1.Text + "." + IpAddress2.Text + "." + IpAddress3.Text;
                screenSetting.FontSize     = Convert.ToInt32(txtFontSize.Text);
                if (id == -1)//判断是  其他为修改   新增-1
                {
                    bllScreeenSetting.InsertScreenSetting(screenSetting);
                }
                else
                {
                    screenSetting.ID = id;
                    bllScreeenSetting.UpdateScreenSetting(screenSetting);
                }


                //保存到EQ诣阔LED动态库指定的文件里
                PublicClass.WritePrivateProfileString(@"地址:" + (Convert.ToInt32(cmbCarAdress.Text) - 1), "CardType", carTpe.ToString(), _EQSetPath);                                      //控制类型
                PublicClass.WritePrivateProfileString(@"地址:" + (Convert.ToInt32(cmbCarAdress.Text) - 1), "CardAddress", (Convert.ToInt32(cmbCarAdress.Text) - 1).ToString(), _EQSetPath); //控制地址
                PublicClass.WritePrivateProfileString(@"地址:" + (Convert.ToInt32(cmbCarAdress.Text) - 1), "CommunicationMode", "1", _EQSetPath);                                           //通讯方式
                PublicClass.WritePrivateProfileString(@"地址:" + (Convert.ToInt32(cmbCarAdress.Text) - 1), "ScreemWidth", txtWidth.Text, _EQSetPath);                                       //显示屏宽度
                PublicClass.WritePrivateProfileString(@"地址:" + (Convert.ToInt32(cmbCarAdress.Text) - 1), "ScreemHeight", txtHeight.Text, _EQSetPath);                                     //显示屏高度
                PublicClass.WritePrivateProfileString(@"地址:" + (Convert.ToInt32(cmbCarAdress.Text) - 1), "SerialBaud", "57600", _EQSetPath);                                              //串口通信波特率
                PublicClass.WritePrivateProfileString(@"地址:" + (Convert.ToInt32(cmbCarAdress.Text) - 1), "SerialNum", "1", _EQSetPath);                                                   //串口通信串口号
                PublicClass.WritePrivateProfileString(@"地址:" + (Convert.ToInt32(cmbCarAdress.Text) - 1), "NetPort", "5005", _EQSetPath);                                                  //网络通信端口号
                PublicClass.WritePrivateProfileString(@"地址:" + (Convert.ToInt32(cmbCarAdress.Text) - 1), "IpAddress0", IpAddress0.Text, _EQSetPath);                                      //IP地址
                PublicClass.WritePrivateProfileString(@"地址:" + (Convert.ToInt32(cmbCarAdress.Text) - 1), "IpAddress1", IpAddress1.Text, _EQSetPath);
                PublicClass.WritePrivateProfileString(@"地址:" + (Convert.ToInt32(cmbCarAdress.Text) - 1), "IpAddress2", IpAddress2.Text, _EQSetPath);
                PublicClass.WritePrivateProfileString(@"地址:" + (Convert.ToInt32(cmbCarAdress.Text) - 1), "IpAddress3", IpAddress3.Text, _EQSetPath);
                PublicClass.WritePrivateProfileString(@"地址:" + (Convert.ToInt32(cmbCarAdress.Text) - 1), "ColorStyle", colorStyle.ToString(), _EQSetPath); //显示屏颜色类型

                MessageBox.Show("保存成功!");
                if (id != -1)
                {
                    this.Close();//修改完关闭窗体
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Пример #3
0
 /// <summary>
 /// 加载本地的所有皮肤
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnOrigal_Click(object sender, EventArgs e)
 {
     PublicClass.WritePrivateProfileString("SkinPath", "SkinPathValue", "", _configPath);
     skinEngine1.Active = false;
     pnlThemes.Visible  = false;
 }
Пример #4
0
        /// <summary>
        /// 列表显示内容
        /// </summary>
        private void ShowBegin()
        {
            try
            {
                //获取设置的显示顺序
                StringBuilder selectOrder = new StringBuilder(255);
                PublicClass.GetPrivateProfileString("SelectOrder", "SelectOrderValue", " ", selectOrder, 255,
                                                    _configPath);
                //获取显示信息
                DataTable dtShow = BllShowInfo.GetShowStateInfo(selectOrder.ToString());
                showContents = new List <ShowContent>();
                for (int i = 0; i < dtShow.Rows.Count; i++)
                {
                    //判断开始结束时间进行显示
                    if (Convert.ToDateTime(dtShow.Rows[i]["BeginTime"]) <= DateTime.Now && Convert.ToDateTime(dtShow.Rows[i]["EndTime"]) >= DateTime.Now)
                    {
                        if (showInfo.ContainsKey(dtShow.Rows[i]["Id"].ToString()))
                        {
                            continue;
                        }
                        string content   = string.Empty;//一个编组序好
                        int    configNum = Convert.ToInt32(dtShow.Rows[i]["ConfigNum"]);

                        //列表
                        Panel panel = new Panel()
                        {
                            Dock = DockStyle.Top, Height = 70
                        };
                        if (Convert.ToInt32(dtShow.Rows[i]["ByOrder"]) == 0)//顺序
                        {
                            for (int j = 0; j < configNum; j++)
                            {
                                content += (j + 1) + ",";
                            }
                            panel.BackColor = Color.FromArgb(224 + i * 3, 224, 224);
                        }
                        else
                        {
                            for (int j = configNum; 0 < j; j--)//倒序
                            {
                                content += j + ",";
                            }
                            panel.BackColor = Color.FromArgb(224, 224 + i * 3, 224 + i * 3);
                        }
                        string order = Convert.ToInt32(dtShow.Rows[i]["ByOrder"]) == 0 ? "正序" : "倒序";
                        Label  label = new Label()
                        {
                            Dock = DockStyle.Bottom, Font = new Font("微软雅黑", 13), Height = 70
                        };
                        label.Text = "区域:" + dtShow.Rows[i]["AreaName"].ToString() + "     配置编号 " + dtShow.Rows[i]["ConfigName"].ToString()
                                     + "    时间段:" + dtShow.Rows[i]["BeginTime"].ToString() + "-" + dtShow.Rows[i]["EndTime"].ToString() + "   编组:"
                                     + configNum + "     开始屏幕:" + dtShow.Rows[i]["ScreenID"].ToString() + "     顺序:" + order + "     序号:" + content.Remove(content.LastIndexOf(","), 1);
                        showInfo.Add(dtShow.Rows[i]["Id"].ToString(), Convert.ToDateTime(dtShow.Rows[i]["BeginTime"]));

                        //已显示的内容临时保存
                        ShowContent showContent = new ShowContent()
                        {
                            ConfigName  = dtShow.Rows[i]["ConfigName"].ToString(),
                            GroupNum    = configNum,
                            BeginTime   = Convert.ToDateTime(dtShow.Rows[i]["BeginTime"]),
                            EndTime     = Convert.ToDateTime(dtShow.Rows[i]["EndTime"]),
                            AllContents = content.Remove(content.LastIndexOf(","), 1),
                            SingleTxt   = dtShow.Rows[i]["SingleTxt"].ToString(),
                            ScreenID    = Convert.ToInt32(dtShow.Rows[i]["ScreenID"]),
                            ByOrder     = Convert.ToInt32(dtShow.Rows[i]["ByOrder"]),
                            AddressNum  = Convert.ToInt32(dtShow.Rows[i]["AddressNum"]),
                        };
                        if (!showContents.Contains(showContent))
                        {
                            showContents.Add(showContent);
                        }
                        panel.Controls.Add(label);
                        panel.Tag = dtShow.Rows[i]["Id"].ToString();
                        pnlContent.Controls.Add(panel);

                        BllShowInfo.UpdateShowState(dtShow.Rows[i]["ID"].ToString(), 1);//已显示更新状态
                    }
                }

                //到结束时间,不显示
                for (int i = 0; i < dtShow.Rows.Count; i++)
                {
                    if (Convert.ToDateTime(dtShow.Rows[i]["EndTime"]) <= DateTime.Now)
                    {
                        foreach (Panel item in pnlContent.Controls)
                        {
                            if (item.Tag.Equals(dtShow.Rows[i]["ID"].ToString()))
                            {
                                pnlContent.Controls.Remove(item);
                                showInfo.Remove(dtShow.Rows[i]["ID"].ToString());
                                BllShowInfo.UpdateShowState(dtShow.Rows[i]["ID"].ToString(), 2);//显示结束更新状态
                            }
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                dtShow.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }