示例#1
0
        private void Form_TipsText_Load(object sender, EventArgs e)
        {
            var    cct = new ColorConverter();
            string s   = settingFile.ReadString("SUBSET", "TEXTNAME", "");

            //Console.WriteLine("=======" + s);
            if (s.Contains("*"))
            {
                s = s.Replace("*", "\n");
            }
            richTextBox1.Text = s;
            string s_name = settingFile.ReadString("SUBSET", "FONTNAME", f.Name);
            string s_size = settingFile.ReadString("SUBSET", "FONTSIZE", f.Size.ToString());

            slider1.Value = settingFile.ReadInteger("SUBSET", "MOVETANS", 100);
            colorDropDownList1.SelectedIndex = settingFile.ReadInteger("SUBSET", "FONTC", 0);
            f = new Font(s_name, float.Parse(s_size));
            //f = (Font)fc.ConvertFromString(s);
            //Console.WriteLine("=======" + s);
            //s = settingFile.ReadString("SUBSET", "FONTCOLOR", (c.ToArgb().ToString("X8")));
            //Console.WriteLine("=======" + s);
            //c = (Color)cct.ConvertFromString("#" + s);
            c  = colorDropDownList1.SelectColor;
            s  = settingFile.ReadString("SUBSET", "BCCOLOR", (bc.ToArgb().ToString("X8")));
            bc = ColorTranslator.FromHtml("#" + s);
            //Console.WriteLine("=======");
            int k = settingFile.ReadInteger("SUBSET", "MOVETIME", spd);

            numericUpDown1.Value = (decimal)k;
            k = settingFile.ReadInteger("SUBSET", "MOVESPEED", speed);
            numericUpDown2.Value = (decimal)k;

            if (!System.IO.Directory.Exists(filePath))
            {
                // 目录不存在,建立目录
                System.IO.Directory.CreateDirectory(filePath);
            }
            string s1 = settingFile.ReadString("SETTING", "PictureLogo", "");

            if (!s1.Equals(""))
            {
                s1 = s1.Substring(s1.Length - 4, 4);
                s1 = Application.StartupPath + @"\pic\logoshow" + s1;
                pictureBox1.Image = null;
                pictureBox1.Image = Image.FromFile(s1);
            }

            myThread = new Thread(new ThreadStart(delegate()
            {
                WeatherThread();
            })); //开线程
            myThread.IsBackground = true;
            myThread.Start();
            //timer1.Start();
            //Console.WriteLine("==1111==");
        }
示例#2
0
 /// <summary>
 /// 语言设置加载
 /// </summary>
 private void Init_FormString()
 {
     this.Text                 = languageFile.ReadString("ONOFFFORM", "TITLE", "开关机设置");
     this.label3.Text          = languageFile.ReadString("ONOFFFORM", "OFF_D", "定时关机:");
     this.label1.Text          = languageFile.ReadString("ONOFFFORM", "TIME1", "延时间隔(ms):");
     this.label2.Text          = languageFile.ReadString("ONOFFFORM", "ON_D", "定时开机:");
     this.groupBox1.Text       = languageFile.ReadString("ONOFFFORM", "ONOFFTIME", "延时开关机");
     this.groupBox2.Text       = languageFile.ReadString("ONOFFFORM", "TIME2", "定时开关机");
     this.button2.Text         = languageFile.ReadString("ONOFFFORM", "EMPLOY", "应用");
     this.button1.Text         = languageFile.ReadString("ONOFFFORM", "EMPLOY", "应用");
     this.checkBox1.Text       = languageFile.ReadString("ONOFFFORM", "ON_T", "开机");
     this.checkBox2.Text       = languageFile.ReadString("ONOFFFORM", "OFF_T", "关机");
     this.checkBox3.Text       = languageFile.ReadString("ONOFFFORM", "TURN_ON", "启用");
     this.checkBox4.Text       = languageFile.ReadString("ONOFFFORM", "TURN_ON", "启用");
     this.numericUpDown1.Value = settingFile.ReadInteger("SETTING", "DELAY", 0);
     this.label4.Text          = languageFile.ReadString("ONOFFFORM", "T1", "同时启用定时开机和关机操作时,请设定两个时间差大于一分钟!");
     this.label5.Text          = languageFile.ReadString("ONOFFFORM", "T2", "定时开关机的时间设置至少大于系统当前时间30秒!");
 }
示例#3
0
        public Form_Start()
        {
            settingFile = new IniFiles(Application.StartupPath + "\\setting.ini");
            InitializeComponent();

            int s_M = settingFile.ReadInteger("SETTING", "Motherboard", 0);

            if (s_M == 0)
            {
                comboBox1.SelectedIndex = 0;
            }
            else if (s_M == 1)
            {
                comboBox1.SelectedIndex = 1;
            }
            else if (s_M == 4)
            {
                comboBox1.SelectedIndex = 2;
            }
            else if (s_M == 2)
            {
                comboBox1.SelectedIndex = 3;
            }
            else
            {
                comboBox1.SelectedIndex = 4;
            }
            string s2 = settingFile.ReadString("SETTING", "CH-US", "1");

            if (s2.Equals("0"))
            {
                comboBox2.SelectedIndex = 1;
            }
            else if (s2.Equals("1"))
            {
                comboBox2.SelectedIndex = 0;
            }
            else
            {
                comboBox2.SelectedIndex = 2;
            }
        }
        /// <summary>
        /// 初始化串口
        /// </summary>
        public void initSerialPort()
        {
            settingFile = new IniFiles(Application.StartupPath + "\\setting.ini");
            String readPort1 = settingFile.ReadString("Com Set", "port1", "COM1"); //串口1
            String readPort2 = settingFile.ReadString("Com Set", "port2", "COM1"); //串口2

            String[] serialPorts = System.IO.Ports.SerialPort.GetPortNames();
            cb_port1.Items.Clear();
            cb_port2.Items.Clear();
            for (int i = 0; i < serialPorts.Length; i++) //找出所有串口,并选择文件中的
            {
                cb_port1.Items.Add(serialPorts[i]);      //初始化串口1
                if (readPort1.Equals(serialPorts[i]))
                {
                    cb_port1.SelectedIndex = i;
                }
                cb_port2.Items.Add(serialPorts[i]);//初始化串口2
                if (readPort2.Equals(serialPorts[i]))
                {
                    cb_port2.SelectedIndex = i;
                }

                //Console.WriteLine(serialPorts[i]);
            }
            if (cb_port1.Items.Count > 0 && cb_port1.SelectedIndex < 0)//如果文件读出来的串口名没有,则默认第一个。
            {
                cb_port1.SelectedIndex = 0;
            }
            if (cb_port2.Items.Count > 0 && cb_port2.SelectedIndex < 0)//如果文件读出来的串口名没有,则默认第一个。串口2
            {
                cb_port2.SelectedIndex = 0;
            }

            cb_baudRate1.Text = settingFile.ReadString("Com Set", "baudrate1", "9600");        //串口1
            cb_baudRate2.Text = settingFile.ReadString("Com Set", "baudrate2", "9600");        //串口1
            cb_timeout.Text   = settingFile.ReadString("Com Set", "timeout", "10");            //延时

            cb_multiCom.SelectedIndex = settingFile.ReadInteger("Com Set", "MultiCom", 1) - 1; //多串口选择
            if (cb_serialSelect.Items.Count > 0)
            {
                cb_serialSelect.SelectedIndex = 0;//串口选择,默认为串口1
            }
            combo_netpro.SelectedIndex = settingFile.ReadInteger("Com Set", "TCPP", 0);
            textBox_IP.Text            = settingFile.ReadString("Com Set", "IP", "127.0.01");
            textBox_Port.Text          = settingFile.ReadString("Com Set", "Port", "8234");
            numericUpDown1.Value       = (decimal)settingFile.ReadInteger("Com Set", "Con", 16);
            if (f.TCPCOM)
            {
                checkBox2.Checked = true;
                groupBox1.Enabled = false;
                groupBox2.Enabled = true;
            }
            else
            {
                checkBox1.Checked = true;
                groupBox1.Enabled = true;
                groupBox2.Enabled = false;
            }
            if (f.PJLink_Pro)
            {
                checkBox3.Checked = true;
            }
            else
            {
                checkBox3.Checked = false;
            }
        }
        /// <summary>
        /// 从文件中读取初始化连接界面的内容
        /// </summary>
        private void initFromFile()
        {
            Init_Load();
            cb_spliceRows.SelectedIndex = settingFile.ReadInteger("SETTING", "Row", 2) - 1; //设置下拉,行
            cb_spliceCols.SelectedIndex = settingFile.ReadInteger("SETTING", "Col", 2) - 1; //设置下拉,列
            //tb_sceDirectoryName.Text = settingFile.ReadString("SETTING", "CurrDirect", Application.StartupPath + "\\myWall");//当前连接场景文件夹
            //int k = settingFile.ReadInteger("SETTING", "Resolution", tb_sceDirectoryName.Text.Length);//分辨率
            //tb_sceDirectoryName.Text = tb_sceDirectoryName.Text.Substring(0, k);
            //端口数
            nud_DVICount.Value   = settingFile.ReadInteger("Matrix", "DVICount", 0);
            nud_VIDEOCount.Value = settingFile.ReadInteger("Matrix", "VIDEOCount", 0);
            nud_VGACount.Value   = settingFile.ReadInteger("Matrix", "VGACount", 0);
            nud_HDMICount.Value  = settingFile.ReadInteger("Matrix", "HDMICount", 0);
            nud_YPbPrCount.Value = settingFile.ReadInteger("Matrix", "YPbPrCount", 0);

            //信源地址
            nud_DVIAddress.Value   = settingFile.ReadInteger("Matrix", "DVIAddress", 0);
            nud_VIDEOAddress.Value = settingFile.ReadInteger("Matrix", "VIDEOAddress", 0);
            nud_VGAAddress.Value   = settingFile.ReadInteger("Matrix", "VGAAddress", 0);
            nud_HDMIAddress.Value  = settingFile.ReadInteger("Matrix", "HDMIAddress", 0);
            nud_YPbPrAddress.Value = settingFile.ReadInteger("Matrix", "YPbPrAddress", 0);

            //信源矩阵选用
            comboBox_dvi.SelectedIndex   = settingFile.ReadInteger("Matrix", "DVIMatrix", 0);
            comboBox_video.SelectedIndex = settingFile.ReadInteger("Matrix", "VIDEOMatrix", 0);
            comboBox_vga.SelectedIndex   = settingFile.ReadInteger("Matrix", "VGAMatrix", 0);
            comboBox_hdmi.SelectedIndex  = settingFile.ReadInteger("Matrix", "HDMIMatrix", 0);
            nud_YPbPrMatrix.Value        = settingFile.ReadInteger("Matrix", "YPbPrMatrix", 0);

            //numericUpDown1.Value = settingFile.ReadInteger("SETTING", "Matrix_time", 200);
            comboBox1.SelectedIndex = settingFile.ReadInteger("SETTING", "Matrix_time", 1);
            string s1 = settingFile.ReadString("SETTING", "Pwd", "0");

            if (s1 == "0")
            {
                button2.Enabled       = false;
                button3.Enabled       = false;
                textBox2.Enabled      = false;
                groupBox6.Enabled     = false;
                button_AddPro.Enabled = false;
            }
            else
            {
                button2.Enabled       = true;
                button3.Enabled       = true;
                textBox2.Enabled      = true;
                groupBox6.Enabled     = true;
                button_AddPro.Enabled = true;
            }
            int s_M = settingFile.ReadInteger("SETTING", "Motherboard", 0);

            if (s_M == 0)
            {
                radioButton4.Checked = true;
                groupBox2.Enabled    = false;
                groupBox3.Enabled    = false;
                groupBox4.Enabled    = false;
            }
            else if (s_M == 1)
            {
                radioButton5.Checked = true;
                groupBox3.Enabled    = false;
                groupBox4.Enabled    = false;
            }
            else if (s_M == 4)
            {
                radioButton7.Checked = true;
                groupBox3.Enabled    = false;
                groupBox4.Enabled    = false;
            }
            else if (s_M == 2)
            {
                radioButton6.Checked = true;
                groupBox3.Enabled    = true;
                groupBox4.Enabled    = false;
            }
            else
            {
                radioButton3.Checked = true;
                groupBox3.Enabled    = false;
                groupBox4.Enabled    = false;
            }
            int n = settingFile.ReadInteger("SETTING", "Matrix_flag", 0);

            if (n == 1)
            {
                radioButton2.Checked = true;
            }
            else
            {
                radioButton1.Checked = true;
            }
            string s = settingFile.ReadString("SETTING", "PicturePath", "");

            //Console.WriteLine("s ====" + s);
            if (!s.Equals(""))
            {
                s = s.Substring(s.Length - 4, 4);
                s = Application.StartupPath + @"\pic\logo" + s;
                pictureBox1.Image.Dispose();
                pictureBox1.Load(s);
            }
            textBox1.Text = s;
            bool PN = settingFile.ReadBool("SETTING", "NameFlag", false);

            if (PN)
            {
                textBox2.Text = settingFile.ReadString("SETTING", "NamePath", "液晶拼接控制系统");
            }
        }