Пример #1
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openfile = new OpenFileDialog();

            openfile.Filter = "图片文件|*.bmp;*.jpg;*.gif;*.png";
            String sourcePath;

            if (openfile.ShowDialog() == DialogResult.OK)
            {
                pictureBox1.ImageLocation = openfile.FileName;
                sourcePath = openfile.FileName;

                string strtype = sourcePath.Substring(sourcePath.Length - 4, 4);
                //Console.WriteLine("strtype:" + strtype);
                string targetPath = filePath + @"\logoshow" + strtype;
                bool   isrewrite  = true; // true=覆盖已存在的同名文件,false则反之
                try
                {
                    System.IO.File.Copy(sourcePath, targetPath, isrewrite);
                }
                catch
                {
                }
                settingFile.WriteString("SETTING", "PictureLogo", "logoshow" + strtype);
            }
            //button3.Enabled = true;
            openfile.Dispose();
        }
Пример #2
0
        private void Form_Auto_FormClosing(object sender, FormClosingEventArgs e)
        {
            settingFile = new IniFiles(Application.StartupPath + "\\setting.ini");
            string s = "";

            for (int i = 0; i < L.Count; i++)
            {
                s += L[i].ToString() + ",";
            }
            settingFile.WriteString("SCREEN", "NUM", s);//保存场景记录
            settingFile.WriteString("SCREEN", "NUM_time", textBox1.Text);
            L.Clear();
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Console.WriteLine("str.name=" + str);
            settingFile = new IniFiles(Application.StartupPath + "\\setting.ini");
            string s = str.Substring(5);

            f.Edit_str = textBox1.Text;
            if (textBox1.Text.Equals(""))
            {
                if (str.Contains("Hdmi"))
                {
                    s = s.Replace("Hdmi", "HDMI");
                    settingFile.WriteString("INPUTNAME", str + "Name", s);
                    //sConsole.WriteLine(s);
                }
                else if (str.Contains("Dvi"))
                {
                    s = s.Replace("Dvi", "DVI");
                    settingFile.WriteString("INPUTNAME", str + "Name", s);
                }
                else if (str.Contains("Vga"))
                {
                    s = s.Replace("Vga", "VGA");
                    settingFile.WriteString("INPUTNAME", str + "Name", s);
                }
                else if (str.Contains("Video"))
                {
                    s = s.Replace("Video", "VIDEO");
                    settingFile.WriteString("INPUTNAME", str + "Name", s);
                }
            }
            else
            {
                if (str.Contains("Hdmi"))
                {
                    s = s.Replace("Hdmi", "HDMI");
                    settingFile.WriteString("INPUTNAME", str + "Name", s + "(" + textBox1.Text + ")");
                }
                else if (str.Contains("Dvi"))
                {
                    s = s.Replace("Dvi", "DVI");
                    settingFile.WriteString("INPUTNAME", str + "Name", s + "(" + textBox1.Text + ")");
                }
                else if (str.Contains("Vga"))
                {
                    s = s.Replace("Vga", "VGA");
                    settingFile.WriteString("INPUTNAME", str + "Name", s + "(" + textBox1.Text + ")");
                }
                else if (str.Contains("Video"))
                {
                    s = s.Replace("Video", "VIDEO");
                    settingFile.WriteString("INPUTNAME", str + "Name", s + "(" + textBox1.Text + ")");
                }
            }
            this.Close();
        }
Пример #4
0
 private void Form_Info59_FormClosing(object sender, FormClosingEventArgs e)
 {
     Str = "";
     settingFile.WriteString("SETTING", "Ver", label1.Text);
     if (serialPort1.IsOpen)
     {
         serialPort1.Close();
     }
 }
Пример #5
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);
        }
Пример #6
0
 /// <summary>
 /// 定时开关机应用
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button2_Click(object sender, EventArgs e)
 {
     if (checkBox3.Checked && checkBox4.Checked)
     {
         if (dateTimePicker1.Value.Subtract(dateTimePicker2.Value).TotalSeconds < 60 && dateTimePicker1.Value.Subtract(dateTimePicker2.Value).TotalSeconds > -60)
         {
             string ts = languageFile.ReadString("ONOFFFORM", "T1", "同时启用定时开机和关机操作时,请设定两个时间差大于一分钟!");
             string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示");
             MessageBox.Show(ts, tp);
             return;
         }
     }
     if (checkBox3.Checked)
     {
         if (dateTimePicker1.Value.Subtract(DateTime.Now).TotalSeconds >= 30)
         {
             f.Timing_on = true;
             f.on        = dateTimePicker1.Value;
             f.timer_On.Start();
             settingFile.WriteString("SETTING", "On_time", dateTimePicker1.Value.ToString());
         }
         else
         {
             string ts = languageFile.ReadString("ONOFFFORM", "T2", "定时开关机的时间设置至少大于系统当前时间30秒!");
             string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示");
             MessageBox.Show(ts, tp);
             return;
         }
         LogHelper.WriteLog("=====启用定时开机=====");
         //Console.WriteLine(f.on);
     }
     else
     {
         f.Timing_on = false;
         f.timer_On.Stop();
     }
     if (checkBox4.Checked)
     {
         if (dateTimePicker2.Value.Subtract(DateTime.Now).TotalSeconds >= 30)
         {
             f.Timing_off = true;
             f.off        = dateTimePicker2.Value;
             f.timer_Off.Start();
             settingFile.WriteString("SETTING", "Off_time", dateTimePicker2.Value.ToString());
         }
         else
         {
             string ts = languageFile.ReadString("ONOFFFORM", "T2", "定时开关机的时间设置至少大于系统当前时间30秒!");
             string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示");
             MessageBox.Show(ts, tp);
             return;
         }
         LogHelper.WriteLog("=====启用定时关机=====");
     }
     else
     {
         f.Timing_off = false;
         f.timer_Off.Stop();
     }
     this.Close();
 }
Пример #7
0
        /// <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();
        }
Пример #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                if (f.Chinese_English == 1)
                {
                    errorProvider1.SetError(textBox1, "Username can not be empty!");
                }
                else
                {
                    errorProvider1.SetError(textBox1, "用户名不能为空!");
                }
                return;
            }
            else
            {
                errorProvider1.Clear();
                str2 = settingFile.ReadString("SETTING", "in", "333");
                if (textBox1.Text == "admin" && str1 == textBox2.Text && comboBox1.SelectedIndex == 0)
                {
                    //this.DialogResult = DialogResult.OK;
                    settingFile.WriteString("SETTING", "Pwd", "0");

                    string ts = languageFile.ReadString("LOGFORM", "T2", "登录成功!");
                    string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示");
                    MessageBox.Show(ts, tp);
                    this.Close();
                }
                else if (textBox1.Text == "admin" && (str2 == textBox2.Text || "111111" == textBox2.Text) && comboBox1.SelectedIndex == 1)
                {
                    //this.DialogResult = DialogResult.OK;
                    settingFile.WriteString("SETTING", "Pwd", "1");
                    string ts = languageFile.ReadString("LOGFORM", "T2", "登录成功!");
                    string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示");
                    MessageBox.Show(ts, tp);
                    this.Close();
                }
                else if (textBox1.Text == "welcome" && "******" == textBox2.Text && comboBox1.SelectedIndex == 1)
                {
                    //this.DialogResult = DialogResult.OK;
                    rk = Registry.LocalMachine.OpenSubKey("SOFTWARE", true);//打开系统的注册表项,Registry.LocalMachine包含本地计算机的配置数据。该字段读取 Windows 注册表基项 HKEY_LOCAL_MACHINE,OpenSubKey("SOFTWARE")表示打开本地计算机配置数据下SOFTWARE子项
                    if (rk.GetValue("Wall_C") != null)
                    {
                        rk.SetValue("Count", 0);
                        rk.DeleteValue("Wall_C", true);
                    }
                    settingFile.WriteString("SETTING", "Pwd", "1");
                    string ts = languageFile.ReadString("LOGFORM", "T2", "登录成功!");
                    string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示");
                    MessageBox.Show(ts, tp);
                    this.Close();
                }
                else
                {
                    string ts = languageFile.ReadString("LOGFORM", "T3", "用户密码输入错误!");
                    string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示");
                    MessageBox.Show(ts, tp, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    textBox2.Text = "";
                }
            }
        }
Пример #9
0
        /// <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;
        }
Пример #10
0
 private void button2_Click(object sender, EventArgs e)
 {
     settingFile.WriteString("SCENE", key, textBox1.Text.Trim());
     this.Close();
 }