public Form_Modify(MainForm f) { this.f = f; InitializeComponent(); languageFile = new IniFiles(Application.StartupPath + "\\LanguagePack" + f.package); this.Text = languageFile.ReadString("MODIFYFORM", "TITLE", "权限限制"); this.label1.Text = languageFile.ReadString("MODIFYFORM", "PASSWORD", "密码:"); this.button1.Text = languageFile.ReadString("MODIFYFORM", "OK", "确认"); this.button2.Text = languageFile.ReadString("MODIFYFORM", "CANCEL", "取消"); if (f.Chinese_English == 1) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); ApplyResource(); } else if (f.Chinese_English == 0) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHS"); ApplyResource(); } else { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHT"); ApplyResource(); } }
//private uint addr; public Form_Addr(MainForm f) { InitializeComponent(); this.f = f; settingFile = new IniFiles(Application.StartupPath + "\\setting.ini"); languageFile = new IniFiles(Application.StartupPath + "\\LanguagePack" + f.package); //numericUpDown1.Value = f.address[f.address_backup]; System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHS"); ApplyResource(); this.Text = languageFile.ReadString("SERIAL", "TITLE", "拼接设置"); this.label2.Text = languageFile.ReadString("SERIAL", "TIPS", "提示:在进行设备的序列号进行设置时,请确保串口线环接在断开状态;序列号设置只能单台设备进行设置!"); this.label1.Text = languageFile.ReadString("SERIAL", "T1", "设备序列号设置:"); this.button1.Text = languageFile.ReadString("SERIAL", "OK", "确认"); this.button2.Text = languageFile.ReadString("SERIAL", "CANCEL", "取消"); /* * if (f.Chinese_English == 1) * { * System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); * ApplyResource(); * } * else * { * System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHS"); * ApplyResource(); * } */ textBox1.Text = f.address[f.address_backup].ToString(); }
private void Init(byte A) { //for (int i = 0; i < 256; i++) { //if (f.select_address[i] != 0) { byte[] array = new byte[5]; array[0] = 0xE5; array[1] = (byte)num;//f.select_address[i]; array[2] = 0x20; array[3] = A; array[4] = (byte)(0xFF - (0xFF & array[0] + array[1] + array[2] + array[3])); try { if (serialPort1.IsOpen) { SerialPortUtil.serialPortSendData(serialPort1, array, 0, 5, 100, 2); f.richTextBox2.AppendText(MainForm.ToHexString(array, 5)); f.richTextBox2.SelectionStart = f.richTextBox2.Text.Length; f.richTextBox2.ScrollToCaret(); } } catch { string ts = languageFile.ReadString("MESSAGEBOX", "M1", "串口出错!"); string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示"); MessageBox.Show(ts, tp); } } } }
private void button1_Click(object sender, EventArgs e) { int n = L.Count; if (n <= 0) { string ts = languageFile.ReadString("AUTOFORM", "T1", "没有可轮巡的场景预案!"); string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示"); MessageBox.Show(ts, tp); return; } int t = int.Parse(textBox1.Text); if (t < 30 || t > 86400) { string ts = languageFile.ReadString("AUTOFORM", "T2", "请填写正确的间隔时间(30/s ~ 24/h)!"); string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示"); MessageBox.Show(ts, tp); textBox1.Text = "30"; return; } L.Sort(); //对选中的场景排序 b = f.Select_bt(); //获取当前在那个场景中 Form_WaitRun f1 = new Form_WaitRun(f, L, t, b); f1.ShowDialog(); LogHelper.WriteLog("======开始自动进行场景轮巡======"); }
//private Thread myThread = null; //private int num_k = 1; //private int receiveFlag = -1;//参数接受的标志,0表示完成,1表示接受COLOR_BALANCE:部分,2表示COLOR_DATA:,3表示CAPTURE DATA: //AutoSizeFormClass asc = new AutoSizeFormClass(); public Form_Color_59(MainForm f, bool mf) { InitializeComponent(); this.f = f; this.flag = mf; serialPort1.PortName = f.PortName; serialPort1.BaudRate = f.BaudRate; //Console.WriteLine("====="+flag); languageFile = new IniFiles(Application.StartupPath + "\\LanguagePack" + f.package); try { serialPort1.Open(); port_flag = true; } catch { serialPort1.Close(); string ts = languageFile.ReadString("MESSAGEBOX", "M1", "串口出错!"); string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示"); MessageBox.Show(ts, tp); port_flag = false; } Init_FormString(); if (f.Chinese_English == 1) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); ApplyResource(); } else if (f.Chinese_English == 0) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHS"); ApplyResource(); } else { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHT"); ApplyResource(); } for (int i = 0; i < 128; i++) { if (f.select_address[i] != 0) { //comboBox1.Text = f.select_address[i].ToString(); comboBox1.Items.Add(f.select_address[i]); } } comboBox1.SelectedIndex = 0; if (!flag) { label26.Visible = false; comboBox1.Visible = false; } Init_Data1(); //Thread.Sleep(100); //Init_Data2(); }
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=="); }
/// <summary> /// 语言设置加载 /// </summary> private void Init_FormString() { this.Text = languageFile.ReadString("UARTRFORM", "TITLE", "遥控"); this.label10.Text = languageFile.ReadString("UARTRFORM", "P", "电源"); this.label3.Text = languageFile.ReadString("UARTRFORM", "M", "静音"); this.label4.Text = languageFile.ReadString("UARTRFORM", "MENU", "菜单"); this.label11.Text = languageFile.ReadString("UARTRFORM", "S", "信源"); this.label14.Text = languageFile.ReadString("UARTRFORM", "ID", "ID 设定"); this.label15.Text = languageFile.ReadString("UARTRFORM", "E", "退出"); this.button22.Text = languageFile.ReadString("UARTRFORM", "OK", "OK"); }
public Form_Scename(MainForm f, int k) { InitializeComponent(); this.key = "S" + k.ToString(); settingFile = new IniFiles(Application.StartupPath + "\\setting.ini"); languageFile = new IniFiles(Application.StartupPath + "\\LanguagePack" + f.package); if (f.Chinese_English == 1) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); ApplyResource(); } else if (f.Chinese_English == 0) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHS"); ApplyResource(); } else { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHT"); ApplyResource(); } textBox1.Text = settingFile.ReadString("SCENE", key, "Scene - " + k.ToString()); }
private void Init(byte A) { for (int i = 0; i < 128; i++) { if (f.select_address[i] != 0) { byte[] array = new byte[5]; array[0] = 0xE5; array[1] = f.select_address[i]; array[2] = 0x20; array[3] = A; array[4] = (byte)(0xFF - (0xFF & array[0] + array[1] + array[2] + array[3])); try { if (f.Rs232Con) { if (f.TCPCOM) { f.TcpSendMessage(array, 0, 5); } else { SerialPortUtil.serialPortSendData(f.serialPort1, array, 0, 5, 100, 2); } f.richTextBox2.AppendText(MainForm.ToHexString(array, 5)); f.richTextBox2.SelectionStart = f.richTextBox2.Text.Length; f.richTextBox2.ScrollToCaret(); } /* * this.BeginInvoke(new MethodInvoker(delegate() * { * f.richTextBox2.AppendText(MainForm.ToHexString(array, 5)); * })); */ } catch { string ts = languageFile.ReadString("MESSAGEBOX", "M1", "串口出错!"); string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示"); MessageBox.Show(ts, tp); } } } }
/// <summary> /// 语言设置加载 /// </summary> private void Init_FormString() { string sl = languageFile.ReadString("WALLSETFORM", "MATRIX", "矩阵"); if (sl.Contains("\0")) { sl = sl.Replace("\0", ""); } this.Text = sl + languageFile.ReadString("WALLSETFORM", "COMMAP", "端口映射"); this.tabPage1.Text = sl + "HDMI"; this.tabPage2.Text = sl + "DVI"; this.tabPage3.Text = sl + "VIDEO"; this.tabPage4.Text = sl + "VGA"; this.button1.Text = languageFile.ReadString("WALLSETFORM", "OK", "确认"); this.button1.Text = languageFile.ReadString("WALLSETFORM", "CLOSE", "关闭"); }
public Form_Tips(MainForm f, bool b) { InitializeComponent(); this.f = f; languageFile = new IniFiles(Application.StartupPath + "\\LanguagePack" + f.package); //Init_FormString(); this.label1.Text = languageFile.ReadString("TIPSFORM", "TIPS", "定时开关机提示:"); this.button1.Text = languageFile.ReadString("TIPSFORM", "OK", "确认"); this.button2.Text = languageFile.ReadString("TIPSFORM", "CANCEL", "取消"); if (b) { label1.Text = languageFile.ReadString("TIPSFORM", "TIPS1", "定时开机提示:"); } else { label1.Text = languageFile.ReadString("TIPSFORM", "TIPS2", "定时关机提示:"); } /* * if (f.Chinese_English) * { * System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); * ApplyResource(); * if (b) * label1.Text = "Regular boot tips:"; * else * label1.Text = "Timed shutdown tips:"; * } * else * { * System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHS"); * ApplyResource(); * if (b) * label1.Text = "定时开机提示:"; * else * label1.Text = "定时关机提示:"; * * } */ t = 30;//提示倒计时 label2.Text = "30"; timer1.Interval = 1000; timer1.Start(); }
/// <summary> /// 语言设置加载 /// </summary> private void Init_FormString() { this.subTextToolStripMenuItem.Text = languageFile.ReadString("TEXTFORM", "FONTSET", "字幕字体设置"); this.subColorToolStripMenuItem.Text = languageFile.ReadString("TEXTFORM", "BACKCOLOR", "背景颜色设置"); this.subTanstoolStripMenuItem1.Text = languageFile.ReadString("TEXTFORM", "TRANSPARENCY", "背景透明度"); this.RighttoolStripMenuItem1.Text = languageFile.ReadString("TEXTFORM", "TL", "向右滚动"); this.LefttoolStripMenuItem2.Text = languageFile.ReadString("TEXTFORM", "TR", "向左滚动"); this.subStopToolStripMenuItem.Text = languageFile.ReadString("TEXTFORM", "ST", "停止滚动"); this.subStartToolStripMenuItem.Text = languageFile.ReadString("TEXTFORM", "SR", "开始滚动"); this.subCloseToolStripMenuItem.Text = languageFile.ReadString("TEXTFORM", "CT", "关闭字幕"); }
//AutoSizeFormClass asc = new AutoSizeFormClass(); public Form_about(MainForm f) { InitializeComponent(); System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHS"); ApplyResource(); languageFile = new IniFiles(Application.StartupPath + "\\LanguagePack" + f.package); this.Text = languageFile.ReadString("ABOUTFORM", "TITLE", "关于软件"); this.label1.Text = languageFile.ReadString("ABOUTFORM", "T1", "拼接控制系统"); this.label2.Text = languageFile.ReadString("ABOUTFORM", "T2", "版本 : V 3.0.5"); this.label3.Text = languageFile.ReadString("ABOUTFORM", "T3", "LCD splicing control system"); this.button1.Text = languageFile.ReadString("ABOUTFORM", "T_OK", "确认"); if (f.Chinese_English == 1) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); ApplyResource(); } else if (f.Chinese_English == 0) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHS"); ApplyResource(); } else { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHT"); ApplyResource(); } this.label2.Text = languageFile.ReadString("ABOUTFORM", "T2", "版本 : V 3.0.5"); }
public Form_Edit(MainForm f, string str, string text) { InitializeComponent(); this.f = f; this.str = str; this.t = text; languageFile = new IniFiles(Application.StartupPath + "\\LanguagePack" + f.package); this.Text = languageFile.ReadString("EDITFORM", "TITLE", "信号通道编辑"); this.label1.Text = languageFile.ReadString("EDITFORM", "EI", "编辑输入:"); this.button1.Text = languageFile.ReadString("EDITFORM", "OK", "确认"); this.button2.Text = languageFile.ReadString("EDITFORM", "CANCEL ", "取消"); if (f.Chinese_English == 1) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); ApplyResource(); } else if (f.Chinese_English == 0) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHS"); ApplyResource(); } else { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHT"); ApplyResource(); } if (t.Contains("(")) { t = t.Split('(')[1].Split(')')[0]; textBox1.Text = t; } else { textBox1.Text = ""; } }
public Form_Info59(MainForm f, int num) { this.f = f; this.num = num; InitializeComponent(); serialPort1.PortName = f.PortName; serialPort1.BaudRate = f.BaudRate; settingFile = new IniFiles(Application.StartupPath + "\\setting.ini"); languageFile = new IniFiles(Application.StartupPath + "\\LanguagePack" + f.package); try { serialPort1.Open(); } catch { serialPort1.Close(); string ts = languageFile.ReadString("MESSAGEBOX", "M1", "串口出错!"); string tp = languageFile.ReadString("MESSAGEBOX", "TP", "提示"); MessageBox.Show(ts, tp); return; } this.Text = languageFile.ReadString("INFOFORM", "TITLE", "版本信息"); this.groupBox1.Text = languageFile.ReadString("INFOFORM", "INFO", "信息"); this.label2.Text = languageFile.ReadString("INFOFORM", "SV", "版本信息"); this.button1.Text = languageFile.ReadString("INFOFORM", "UD", "更新显示"); if (f.Chinese_English == 1) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); ApplyResource(); } else if (f.Chinese_English == 0) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHS"); ApplyResource(); } else { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHT"); ApplyResource(); } string s1 = settingFile.ReadString("SETTING", "Ver", ""); if (s1.Length != 0) { label1.Text = s1; } }
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(); }
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; } }
private void Form_Logo_Load(object sender, EventArgs e) { if (!System.IO.Directory.Exists(filePath)) { // 目录不存在,建立目录 System.IO.Directory.CreateDirectory(filePath); } string s = settingFile.ReadString("SETTING", "PictureLogo", ""); //Console.WriteLine("s ====" + s); if (!s.Equals("")) { s = s.Substring(s.Length - 4, 4); s = Application.StartupPath + @"\pic\logoshow" + s; pictureBox1.Image.Dispose(); pictureBox1.Load(s); } //timer1.Enabled = true; //timer1.Stop(); //ShowCursor(0); }
/// <summary> /// 语言设置加载 /// </summary> private void Init_FormString() { this.button1.Text = languageFile.ReadString("RUNFORM", "STOP", "停止轮巡"); this.label1.Text = languageFile.ReadString("RUNFORM", "TIPS ", "预案场景轮巡期间禁止其他操作!"); this.label3.Text = languageFile.ReadString("RUNFORM", "TIME", "轮巡时间(S):"); }
/// <summary> /// 语言设置加载 /// </summary> private void Init_FormString() { this.Text = languageFile.ReadString("COLORFORM", "TITLE", "屏幕参数调整"); this.groupBox1.Text = languageFile.ReadString("COLORFORM", "PARAMRTER", "用户色彩(1~100)"); this.label3.Text = languageFile.ReadString("COLORFORM", "SAT", "亮度:"); this.label1.Text = languageFile.ReadString("COLORFORM", "BRI", "对比度:"); this.label2.Text = languageFile.ReadString("COLORFORM", "CON", "饱和度:"); this.label21.Text = languageFile.ReadString("COLORFORM", "BAC", "背光:"); this.label22.Text = languageFile.ReadString("COLORFORM", "CLA", "清晰度:"); this.groupBox1.Text = languageFile.ReadString("COLORFORM", "WHITE", "白平衡"); this.label6.Text = languageFile.ReadString("COLORFORM", "R", "红:"); this.label7.Text = languageFile.ReadString("COLORFORM", "G", "绿:"); this.label8.Text = languageFile.ReadString("COLORFORM", "B", "蓝:"); this.groupBox1.Text = languageFile.ReadString("COLORFORM", "DARK", "暗平衡"); this.label9.Text = languageFile.ReadString("COLORFORM", "B", "蓝:"); this.label10.Text = languageFile.ReadString("COLORFORM", "G", "绿:"); this.label11.Text = languageFile.ReadString("COLORFORM", "R", "红:"); this.label26.Text = languageFile.ReadString("COLORFORM", "UINT", "屏幕单元"); this.radioButton1.Text = languageFile.ReadString("COLORFORM", "SINGLE", "单个单元"); this.radioButton2.Text = languageFile.ReadString("COLORFORM", "SPLICE", "拼接单元"); this.button1.Text = languageFile.ReadString("COLORFORM", "CLOSE", "关闭"); this.button2.Text = languageFile.ReadString("COLORFORM", "REST", "色彩复位"); }
/// <summary> /// 语言设置加载 /// </summary> private void Init_FormString() { this.Text = languageFile.ReadString("TEXTFORM", "TITLE", "字幕设置"); this.label3.Text = languageFile.ReadString("TEXTFORM", "TEXT_T", "字幕文本"); this.label6.Text = languageFile.ReadString("TEXTFORM", "BACKGROUND", "背景/Logo图片"); this.label5.Text = languageFile.ReadString("TEXTFORM", "COLOR", "字体显示颜色"); this.label1.Text = languageFile.ReadString("TEXTFORM", "INTERVAL", "时间间隔"); this.label2.Text = languageFile.ReadString("TEXTFORM", "SPEED", "滚动速度"); this.label4.Text = languageFile.ReadString("TEXTFORM", "CITY_TEXT", "城市气象字幕"); this.button_font.Text = languageFile.ReadString("TEXTFORM", "FONT", "字体设置"); this.button2.Text = languageFile.ReadString("TEXTFORM", "BACKCOLOR", "背景颜色设置"); this.button1.Text = languageFile.ReadString("TEXTFORM", "SHOW", "应用显示"); this.button3.Text = languageFile.ReadString("TEXTFORM", "DISPLAY", "显示天气"); this.buttonX1.Text = languageFile.ReadString("TEXTFORM", "PIC_SELECT", "图片选择"); this.checkBox2.Text = languageFile.ReadString("TEXTFORM", "CROSS", "鼠标穿透"); this.checkBox1.Text = languageFile.ReadString("TEXTFORM", "TRANSPARENCY", "背景透明度"); this.checkBox3.Text = languageFile.ReadString("TEXTFORM", "SHOW_PIC", "显示背景图片"); }
public Form_Log(MainForm f) { InitializeComponent(); this.f = f; settingFile = new IniFiles(Application.StartupPath + "\\setting.ini"); //comboBox1.SelectedIndex = 0; languageFile = new IniFiles(Application.StartupPath + "\\LanguagePack" + f.package); this.Text = languageFile.ReadString("LOGFORM", "TITLE", "权限登录"); this.label1.Text = languageFile.ReadString("LOGFORM", "USER", "用户名:"); this.label2.Text = languageFile.ReadString("LOGFORM", "PASSWORD", "密码:"); this.label3.Text = languageFile.ReadString("LOGFORM", "PPERMISION", "用户权限:"); this.button1.Text = languageFile.ReadString("LOGFORM", "LOG", "登录"); this.button2.Text = languageFile.ReadString("LOGFORM", "CLOSE", "关闭"); this.button3.Text = languageFile.ReadString("LOGFORM", "EXIT", "退出"); this.button4.Text = languageFile.ReadString("LOGFORM", "CHANGE", "密码修改"); string sg = languageFile.ReadString("LOGFORM", "USER1", "普通用户"); string sa = languageFile.ReadString("LOGFORM", "USER2", "管理员用户"); comboBox1.Items.Clear(); comboBox1.Items.Add(sg); comboBox1.Items.Add(sa); string s1 = settingFile.ReadString("SETTING", "Pwd", "0"); //Console.WriteLine(s1); if (s1 == "0") { button4.Visible = false; button3.Visible = false; button1.Visible = true; button2.Visible = true; comboBox1.SelectedIndex = 0; } else if (s1 == "1") { button1.Visible = false; button2.Visible = false; button4.Visible = true; button3.Visible = true; comboBox1.SelectedIndex = 1; comboBox1.Enabled = false; } else { button4.Visible = false; button3.Visible = false; button1.Visible = true; button2.Visible = true; comboBox1.SelectedIndex = 0; } if (f.Chinese_English == 1) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); ApplyResource(); } else if (f.Chinese_English == 0) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHS"); ApplyResource(); } else { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHT"); ApplyResource(); } }
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 = ""; } } }
/// <summary> /// 语言设置加载 /// </summary> private void Init_FormString() { this.Text = languageFile.ReadString("SERIALSETFORM", "TITLE", "串口设置"); //this.label1.Text = languageFile.ReadString("[SERIALSETFORM]", "TITLE", "串口设置"); this.groupBox1.Text = languageFile.ReadString("SERIALSETFORM", "SET", "设定"); this.label20.Text = languageFile.ReadString("SERIALSETFORM", "MULTICOM", "多串口"); this.label2.Text = languageFile.ReadString("SERIALSETFORM", "COMSELCT", "串口选择"); this.lb_port.Text = languageFile.ReadString("SERIALSETFORM", "COM1", "串口号1"); this.lb_baudRate.Text = languageFile.ReadString("SERIALSETFORM", "BPS1 ", "波特率1"); this.bt_confirm.Text = languageFile.ReadString("SERIALSETFORM", "OK", "确认"); this.bt_cancel.Text = languageFile.ReadString("SERIALSETFORM", "CANCEL ", "取消"); this.bt_confirm.TextAlign = ContentAlignment.MiddleCenter; this.bt_cancel.TextAlign = ContentAlignment.MiddleCenter; port1 = languageFile.ReadString("SERIALSETFORM", "SELECT1", "串口1"); port2 = languageFile.ReadString("SERIALSETFORM", "SELECT2", "串口2(矩阵)"); com1 = languageFile.ReadString("SERIALSETFORM", "MULTI1", "单串口"); com2 = languageFile.ReadString("SERIALSETFORM", "MULTI2", "多串口"); cb_multiCom.Items.Clear(); cb_multiCom.Items.Add(com1); cb_multiCom.Items.Add(com2); }
/// <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; } }
private void Form_RunText_Load(object sender, EventArgs e) { { label_text.Font = f; label_text.ForeColor = c; //Console.WriteLine("===" + c); //this.BackColor = bc; label_text.Text = text; if (text.Equals("")) { label_text.Visible = false; //contextMenuStrip1.Enabled = false; subTextToolStripMenuItem.Enabled = false; AutotoolStripMenuItem1.Enabled = false; } timer1.Interval = Interval; Lable_Resize(); label_text.BackColor = Color.Transparent; if (tans_Flag) { this.TopMost = true; timer2.Enabled = true; } else { if (image_Flag) { string s = settingFile.ReadString("SETTING", "PictureLogo", ""); //Console.WriteLine("s ====" + s); if (!s.Equals("")) { s = s.Substring(s.Length - 4, 4); s = Application.StartupPath + @"\pic\logoshow" + s; if (this.BackgroundImage != null) { this.BackgroundImage.Dispose(); } Image im = Image.FromFile(s); this.BackgroundImage = new Bitmap(im); this.BackgroundImageLayout = ImageLayout.Stretch; } else { if (this.BackgroundImage != null) { this.BackgroundImage.Dispose(); } //this.BackgroundImage = global::WallControl.Properties.Resources.上位机_英文版_MTC_New_Logo; this.BackgroundImageLayout = ImageLayout.Stretch; } timer1.Enabled = false; //AutoAdjustShow(); label_text.TextAlign = ContentAlignment.MiddleCenter; subStopToolStripMenuItem.Checked = true; AutotoolStripMenuItem1.Enabled = true; subStartToolStripMenuItem.CheckState = CheckState.Unchecked; subStartToolStripMenuItem.Enabled = false; subColorToolStripMenuItem.Enabled = false; //int h = label_text.Size.Height; this.Height = (this.Size.Width * 9) / 16; //label_text.Location = new Point(w, (this.Size.Height - h) / 2); } } //if (tans_Flag) { if (Interval > 0 && !text.Equals("")) { /* * Thread t = new Thread(new ThreadStart(StartRunText)); * t.IsBackground = true; * t.Start(); */ if (direction) { label_text.Left = this.Width; } else { label_text.Left = -label_text.Width; } if (!image_Flag) { timer1.Enabled = true; timer1.Start(); } } else { timer1.Enabled = false; //AutoAdjustShow(); label_text.TextAlign = ContentAlignment.MiddleCenter; subStartToolStripMenuItem.CheckState = CheckState.Unchecked; subStopToolStripMenuItem.CheckState = CheckState.Checked; AutotoolStripMenuItem1.Enabled = true; subStartToolStripMenuItem.Enabled = false; //int h = label_text.Size.Height; //int w = (this.Size.Width - label_text.Size.Width) / 2; //label_text.Location = new Point(w, (this.Size.Height - h) / 2); } this.Activate(); } } Lable_Resize(); //IntPtr hDeskTop = FindWindow(null, "Form_RunText"); //SetParent(this.Handle, hDeskTop); this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); TopMostWindow.SetTopomost(this.Handle); }
//AutoSizeFormClass asc = new AutoSizeFormClass(); public Form_Auto(MainForm f, int count) { this.f = f; this.count = count; InitializeComponent(); settingFile = new IniFiles(Application.StartupPath + "\\setting.ini"); languageFile = new IniFiles(Application.StartupPath + "\\LanguagePack" + f.package); this.Text = languageFile.ReadString("AUTOFORM", "TITLE", "预案场景"); this.label1.Text = languageFile.ReadString("AUTOFORM", "T_I", "间隔时间(30s~24h)"); this.button1.Text = languageFile.ReadString("AUTOFORM", "START", "开始"); string sl = languageFile.ReadString("AUTOFORM", "SCENES", "场景"); if (f.Chinese_English == 1) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); ApplyResource(); } else if (f.Chinese_English == 0) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHS"); ApplyResource(); } else { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHT"); ApplyResource(); } foreach (Control var in this.Controls) { if (var is System.Windows.Forms.CheckBox) { //如果是CheckBox //Console.WriteLine(var.Name); var.Text = var.Name.Replace("checkBox", sl); string s = var.Name; //if (f.Chinese_English) { if (int.Parse(s.Substring(8, s.Length - 8)) > count) { var.Enabled = false; } } } } string str = settingFile.ReadString("SCREEN", "NUM", ""); if (str != "") { string[] s; s = str.Split(new char[] { ',' }); int k = s.Length; if (k > 0) { for (int i = 0; i < k; i++) { //Console.WriteLine(s[i]); switch (s[i]) { case "1": checkBox1.Checked = true; continue; case "2": checkBox2.Checked = true; continue; case "3": checkBox3.Checked = true; continue; case "4": checkBox4.Checked = true; continue; case "5": checkBox5.Checked = true; continue; case "6": checkBox6.Checked = true; continue; case "7": checkBox7.Checked = true; continue; case "8": checkBox8.Checked = true; continue; case "9": checkBox9.Checked = true; continue; case "10": checkBox10.Checked = true; continue; case "11": checkBox11.Checked = true; continue; case "12": checkBox12.Checked = true; continue; default: continue; } } } } textBox1.Text = settingFile.ReadString("SCREEN", "NUM_time", "30"); }
/// <summary> /// 语言设置加载 /// </summary> private void Init_FormString() { this.Text = languageFile.ReadString("UARTRFORM", "TITLE", "遥控"); this.label10.Text = languageFile.ReadString("UARTRFORM", "P", "电源"); this.label3.Text = languageFile.ReadString("UARTRFORM", "M", "静音"); this.label1.Text = languageFile.ReadString("UARTRFORM", "V1", "音量-"); this.label2.Text = languageFile.ReadString("UARTRFORM", "V2", "音量+"); this.label4.Text = languageFile.ReadString("UARTRFORM", "MENU", "菜单"); this.label11.Text = languageFile.ReadString("UARTRFORM", "S", "信源"); this.label7.Text = languageFile.ReadString("UARTRFORM", "PLAY", "播放"); this.label5.Text = languageFile.ReadString("UARTRFORM", "PAUSE", "停止"); this.label6.Text = languageFile.ReadString("UARTRFORM", "STOP", "暂停"); this.label8.Text = languageFile.ReadString("UARTRFORM", "R", "快退"); this.button22.Text = languageFile.ReadString("UARTRFORM", "OK", "OK"); //this.label12.Text = languageFile.ReadString("UARTRFORM", "N", "下一首"); this.label9.Text = languageFile.ReadString("UARTRFORM", "F", "快进"); }
public Form_OnOff(MainForm f) { InitializeComponent(); this.f = f; settingFile = new IniFiles(Application.StartupPath + "\\setting.ini"); dateTimePicker1.Format = DateTimePickerFormat.Custom; dateTimePicker1.CustomFormat = "yyyy-MM-dd HH:mm:ss"; dateTimePicker2.Format = DateTimePickerFormat.Custom; dateTimePicker2.CustomFormat = "yyyy-MM-dd HH:mm:ss"; languageFile = new IniFiles(Application.StartupPath + "\\LanguagePack" + f.package); Init_FormString(); if (f.Chinese_English == 1) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); ApplyResource(); } else if (f.Chinese_English == 0) { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHS"); ApplyResource(); } else { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHT"); ApplyResource(); } if (f.Delay_on) { checkBox1.Checked = true; } else { checkBox1.Checked = false; } if (f.Delay_off) { checkBox2.Checked = true; } else { checkBox2.Checked = false; } if (f.Timing_on) { checkBox3.Checked = true; dateTimePicker1.Value = f.on; } else { checkBox3.Checked = false; } if (f.Timing_off) { checkBox4.Checked = true; dateTimePicker2.Value = f.off; } else { checkBox4.Checked = false; } //if (f.Delay_on || f.Delay_off) comboBox1.SelectedIndex = f.Delay_time1 / 100 - 1; string s = settingFile.ReadString("SETTING", "On_time", DateTime.Now.ToString()); dateTimePicker1.Value = DateTime.Parse(s); s = settingFile.ReadString("SETTING", "Off_time", DateTime.Now.ToString()); dateTimePicker2.Value = DateTime.Parse(s); }
/// <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秒!"); }