示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //label1.Text = richTextBox1.Text;
            temp = richTextBox1.Text;
            //if (temp.Equals(""))
            //{
            //    if (mf)
            //        MessageBox.Show("Please enter the captions you want to display.!", "Tips");
            //    else
            //        MessageBox.Show("请输入需要显示的字幕!", "提示");
            //    return;
            //}
            spd   = (int)numericUpDown1.Value;
            speed = (int)numericUpDown2.Value;
            double tan = (double)slider1.Value / 100;

            if (checkBox1.Checked)
            {
                ft = new Form_BText(languageFile);
                ft.SetInitText(f, c, bc, spd, temp, speed, tan, true);
                ft.Show();
                formList.Add(ft);
            }
            else
            {
                Form_RunText bf = new Form_RunText(languageFile);
                if (checkBox3.Checked)
                {
                    bf.SetInitText(f, c, bc, spd, temp, speed, tan, false, true);
                }
                else
                {
                    bf.SetInitText(f, c, bc, spd, temp, speed, tan, false, false);
                }
                bf.Show();
            }
            if (temp.Contains("\n"))
            {
                temp = temp.Replace("\n", "*");
            }
            settingFile.WriteString("SUBSET", "TEXTNAME", temp);
            settingFile.WriteInteger("SUBSET", "MOVETIME", spd);
            settingFile.WriteInteger("SUBSET", "MOVESPEED", speed);
            settingFile.WriteInteger("SUBSET", "MOVETANS", slider1.Value);
            settingFile.WriteInteger("SUBSET", "FONTC", colorDropDownList1.SelectedIndex);
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool have = false;

            for (int i = 0; i < 128; i++)
            {
                if (f.address[i] == int.Parse(textBox1.Text))
                {
                    if (i == f.address_backup)
                    {
                        break;
                    }
                    have = true;
                    string       ts = languageFile.ReadString("SERIAL", "T2", "此序列号已存在,是否确认覆盖!");
                    string       tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示");
                    DialogResult t  = MessageBox.Show(ts, tp);

                    /*
                     * if (f.Chinese_English == 1)
                     *  t = MessageBox.Show(" This serial number already exists, whether to confirm the coverage!", " Tips", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                     * else
                     *  t = MessageBox.Show(" 此序列号已存在,是否确认覆盖!", " 提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
                     */
                    if (t == DialogResult.Yes || t == DialogResult.OK)
                    {
                        f.address[i] = 0;
                        f.Address    = int.Parse(textBox1.Text);
                        settingFile.WriteInteger("ADDR", f.address_backup + "Addr:", int.Parse(textBox1.Text));
                    }
                    else
                    {
                        f.Address = f.address[f.address_backup];
                    }
                    break;
                }
            }
            if (!have)
            {
                f.Address = int.Parse(textBox1.Text);
                settingFile.WriteInteger("ADDR", f.address_backup + "Addr:", int.Parse(textBox1.Text));
            }
            //Console.WriteLine(f.Address);
            Save_number(f.Address);
            this.Close();
        }
示例#3
0
 /// <summary>
 /// 开关机延时
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button1_Click(object sender, EventArgs e)
 {
     f.Delay_time1 = (int)numericUpDown1.Value;//(comboBox1.SelectedIndex + 1) * 100;
     if (checkBox1.Checked)
     {
         f.Delay_on = true;
     }
     else
     {
         f.Delay_on = false;
     }
     if (checkBox2.Checked)
     {
         f.Delay_off = true;
     }
     else
     {
         f.Delay_off = false;
     }
     settingFile.WriteInteger("SETTING", "DELAY", f.Delay_time1);
     LogHelper.WriteLog("=====设置延时开关机=====");
 }
        /// <summary>
        /// 确认串口设置信息,并保存至文件中。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bt_confirm_Click(object sender, EventArgs e)
        {
            if (f.TCPCOM)
            {
                if (textBox_IP.Text == "" || textBox_Port.Text == "")
                {
                    string ts = languageFile.ReadString("ONOFFFORM", "T4", "设置的IP地址和端口不能为空!");
                    string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示");
                    MessageBox.Show(ts, tp);
                    return;
                }
                if (checkBox3.Checked)
                {
                    f.PJLink_Pro = true;
                }
                else
                {
                    f.PJLink_Pro = false;
                }
                if (IsIP(textBox_IP.Text))
                {
                    if (combo_netpro.SelectedIndex == 0)
                    {
                        f.TCPServer = new IOCPServer(IPAddress.Parse(textBox_IP.Text), int.Parse(textBox_Port.Text), (int)numericUpDown1.Value);
                    }
                    else if (combo_netpro.SelectedIndex == 1)
                    {
                        f.TCPClient = new client(IPAddress.Parse(textBox_IP.Text), int.Parse(textBox_Port.Text));
                    }
                    else
                    {
                        f.UDPClient = new System.Net.Sockets.UdpClient();
                    }
                    f.IP   = IPAddress.Parse(textBox_IP.Text);
                    f.PORT = int.Parse(textBox_Port.Text);
                }
                else
                {
                    string ts = languageFile.ReadString("ONOFFFORM", "T5", "IP 地址信息不正确!");
                    string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示");
                    MessageBox.Show(ts, tp);
                }
            }
            else
            {
                if (cb_port1.Text.Equals("") || cb_baudRate1.Text.Equals(""))
                {
                    string ts = languageFile.ReadString("ONOFFFORM", "T1", "串口1设置不能为空!");
                    string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示");
                    MessageBox.Show(ts, tp);
                    return;
                }
                //串口设置和打开
                String portName;
                int    baudrate;
                if (cb_multiCom.SelectedIndex == 0)//选的dan串口
                {
                    portName        = cb_port1.Text;
                    baudrate        = int.Parse(cb_baudRate1.Text);
                    f.PortName      = portName;
                    f.BaudRate      = baudrate;
                    f.uMultiComPort = 1;
                }
                else
                {//选的串口2
                    if (cb_port2.Text.Equals("") || cb_baudRate2.Text.Equals(""))
                    {
                        string ts = languageFile.ReadString("ONOFFFORM", "T2", "串口2设置不能为空!");
                        string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示");
                        MessageBox.Show(ts, tp);
                        return;
                    }
                    portName = cb_port1.Text;
                    baudrate = int.Parse(cb_baudRate1.Text);
                    if (cb_port1.Text == cb_port2.Text)
                    {
                        string ts = languageFile.ReadString("ONOFFFORM", "T3", "两个串口设置不能为同一个串口号!");
                        string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示");
                        MessageBox.Show(ts, tp);
                        return;
                    }
                    f.PortName      = portName;
                    f.BaudRate      = baudrate;
                    portName        = cb_port2.Text;
                    baudrate        = int.Parse(cb_baudRate2.Text);
                    f.PortName2     = portName;
                    f.BaudRate2     = baudrate;
                    f.uMultiComPort = 2;
                }
                f.Init_port();
            }
            //SerialPortUtil.setSerialPort(portName, baudrate);
            //SerialPortUtil.openSerialPort();

            //保存配置至ini文件
            settingFile = new IniFiles(Application.StartupPath + "\\setting.ini");
            settingFile.WriteString("Com Set", "port1", cb_port1.Text);
            //Console.WriteLine(cb_port1.Text);
            settingFile.WriteString("Com Set", "baudrate1", cb_baudRate1.Text);
            settingFile.WriteString("Com Set", "port2", cb_port2.Text);
            settingFile.WriteString("Com Set", "baudrate2", cb_baudRate2.Text);
            settingFile.WriteString("Com Set", "timeout", cb_timeout.Text);
            settingFile.WriteInteger("Com Set", "MultiCom", cb_multiCom.SelectedIndex + 1);

            settingFile.WriteString("Com Set", "IP", textBox_IP.Text);
            settingFile.WriteString("Com Set", "Port", textBox_Port.Text);
            settingFile.WriteBool("Com Set", "TCPCOM", f.TCPCOM);
            settingFile.WriteBool("Com Set", "PJLink", checkBox3.Checked);
            settingFile.WriteInteger("Com Set", "TCPP", combo_netpro.SelectedIndex);
            settingFile.WriteInteger("Com Set", "Con", (int)numericUpDown1.Value);
            this.Close();
        }
        /// <summary>
        /// 保存连接设置到文件
        /// </summary>
        private void saveSettingFile()
        {
            //settingFile.WriteString("SETTING", "CurrDirect", tb_sceDirectoryName.Text.Trim());//保存当前连接场景文件夹
            //settingFile.WriteInteger("SETTING", "Row", cb_spliceRows.SelectedIndex + 1);//保存行数
            //settingFile.WriteInteger("SETTING", "Col", cb_spliceCols.SelectedIndex + 1);//保存列数
            //settingFile.WriteInteger("SETTING", "Resolution", tb_sceDirectoryName.Text.Length);//保存分辨率
            if (Row_Col)
            {
                settingFile.WriteInteger("SETTING", "Row", int.Parse(cb_spliceRows.Text)); //保存行数
                settingFile.WriteInteger("SETTING", "Col", int.Parse(cb_spliceCols.Text)); //保存列数
            }

            //保存端口数
            settingFile.WriteInteger("Matrix", "DVICount", Decimal.ToInt32(nud_DVICount.Value));
            settingFile.WriteInteger("Matrix", "VIDEOCount", Decimal.ToInt32(nud_VIDEOCount.Value));
            settingFile.WriteInteger("Matrix", "VGACount", Decimal.ToInt32(nud_VGACount.Value));
            settingFile.WriteInteger("Matrix", "HDMICount", Decimal.ToInt32(nud_HDMICount.Value));
            settingFile.WriteInteger("Matrix", "YPbPrCount", Decimal.ToInt32(nud_YPbPrCount.Value));

            //保存信源地址
            settingFile.WriteInteger("Matrix", "DVIAddress", Decimal.ToInt32(nud_DVIAddress.Value));
            settingFile.WriteInteger("Matrix", "VIDEOAddress", Decimal.ToInt32(nud_VIDEOAddress.Value));
            settingFile.WriteInteger("Matrix", "VGAAddress", Decimal.ToInt32(nud_VGAAddress.Value));
            settingFile.WriteInteger("Matrix", "HDMIAddress", Decimal.ToInt32(nud_HDMIAddress.Value));
            settingFile.WriteInteger("Matrix", "YPbPrAddress", Decimal.ToInt32(nud_YPbPrAddress.Value));

            //保存信源矩阵选用
            settingFile.WriteInteger("Matrix", "DVIMatrix", Decimal.ToInt32(comboBox_dvi.SelectedIndex));
            settingFile.WriteInteger("Matrix", "VIDEOMatrix", Decimal.ToInt32(comboBox_video.SelectedIndex));
            settingFile.WriteInteger("Matrix", "VGAMatrix", Decimal.ToInt32(comboBox_vga.SelectedIndex));
            settingFile.WriteInteger("Matrix", "HDMIMatrix", Decimal.ToInt32(comboBox_hdmi.SelectedIndex));
            settingFile.WriteInteger("Matrix", "YPbPrMatrix", Decimal.ToInt32(nud_YPbPrMatrix.Value));

            settingFile.WriteString("Matrix", "dvi-Matrix", comboBox_dvi.Text);
            settingFile.WriteString("Matrix", "video-Matrix", comboBox_video.Text);
            settingFile.WriteString("Matrix", "vga-Matrix", comboBox_vga.Text);
            settingFile.WriteString("Matrix", "hdmi-Matrix", comboBox_hdmi.Text);
            //settingFile.WriteInteger("SETTING", "YPbPrMatrix", Decimal.ToInt32(nud_YPbPrMatrix.Value));

            //记录主板类型
            if (radioButton4.Checked)
            {
                settingFile.WriteInteger("SETTING", "Motherboard", 0);
                mainForm.Motherboard_type = 0;
                mainForm.Motherboard_flag = 4;
            }
            else if (radioButton5.Checked)
            {
                settingFile.WriteInteger("SETTING", "Motherboard", 1);
                mainForm.Motherboard_type = 1;
                mainForm.Motherboard_flag = 4;
            }
            else if (radioButton7.Checked)
            {
                settingFile.WriteInteger("SETTING", "Motherboard", 4);
                mainForm.Motherboard_type = 4;
                mainForm.Motherboard_flag = 4;
            }
            else if (radioButton6.Checked)
            {
                settingFile.WriteInteger("SETTING", "Motherboard", 2);
                mainForm.Motherboard_type = 2;
                mainForm.Motherboard_flag = 2;
            }
            else if (radioButton3.Checked)
            {
                settingFile.WriteInteger("SETTING", "Motherboard", 3);
                mainForm.Motherboard_type = 3;
                mainForm.Motherboard_flag = 2;
            }
            else
            {
                settingFile.WriteInteger("SETTING", "Motherboard", 0);
                mainForm.Motherboard_type = 0;
                mainForm.Motherboard_flag = 4;
            }
            settingFile.WriteInteger("SETTING", "Matrix_time", comboBox1.SelectedIndex);
            settingFile.WriteInteger("SETTING", "Matrix_flag", Matrix_flag);
            if (Row_Col)
            {
                settingFile.WriteString("SCREEN", "NUM", "");//清除场景记录
            }
            settingFile.WriteString("SCREEN", "NUM_time", "30");
            mainForm.Matrix_time = (int)numericUpDown1.Value;
            mainForm.Matrix_flag = Matrix_flag;
        }