/// <summary> /// 首界面读取 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_Load(object sender, EventArgs e) { #region 序多次打开检测 if (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length > 1) { MessageBox.Show("程序已打开,无法多个打开!"); this.Close(); } AutoUpdater.Start("http://124.70.203.134:8080/YouliData/update.xml"); #endregion Version ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; linkLabel1.Text = "软件版本号:" + ver.ToString(); string filePath = @"\\YL_SERVER\Youli_Server\Youli_date_bin\sys.ini"; #region 创建INI文件 // File.Create(filePath); #endregion string vss = INIHelper.Read("version", "1", "0", filePath); string vss_from1 = linkLabel1.Text; label5.Text = "检查到新版本:" + vss + "\r\n为了更好的体验,请重新打开进行自动更新。"; if (vss == vss_from1) { label5.Visible = false; } else { label5.Visible = false; //MessageBox.Show("当前为" + vss_from1 + "\r\n请重新打开软件更新至"+vss,"更新提醒:"); // Application.ExitThread(); } }
private void Login_Load(object sender, EventArgs e) { INIHelper.CheckPath(loginPath); string loginName = INIHelper.Read("LoginName", "1", "001", loginPath); string loginPwd = INIHelper.Read("LoginName", "2", "", loginPath); txtName.Text = loginName; if (checkBox1.Checked) { txtPwd.Text = loginPwd; } }
/// <summary> /// 界面加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Sign_Load(object sender, EventArgs e) { try { string Value = this.textBox1.Text; string inipath = @"\\YL_SERVER\Youli_Server\工程问题资料汇总\data\Problems.ini"; string content1 = INIHelper.Read(Value, "1", "0", inipath); string content2 = INIHelper.Read(Value, "2", "0", inipath); string content3 = INIHelper.Read(Value, "3", "0", inipath); string readtext1 = content1.Replace(" ", "\r\n"); string readtext2 = content2.Replace(" ", "\r\n"); string readtext3 = content3.Replace(" ", "\r\n"); this.textBox2.Text = readtext1; this.textBox3.Text = readtext2; this.textBox4.Text = readtext3; //图片加载 string pic1 = INIHelper.Read(this.textBox1.Text, "pic1", "0", inipath); string pic2 = INIHelper.Read(this.textBox1.Text, "pic2", "0", inipath); string pic3 = INIHelper.Read(this.textBox1.Text, "pic3", "0", inipath); string pic4 = INIHelper.Read(this.textBox1.Text, "pic4", "0", inipath); string pic5 = INIHelper.Read(this.textBox1.Text, "pic5", "0", inipath); string pic6 = INIHelper.Read(this.textBox1.Text, "pic6", "0", inipath); if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "01" + ".bmp")) { this.pictureBox1.Load(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "01" + ".bmp"); } else { this.pictureBox1.Image = null; } if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "02" + ".bmp")) { this.pictureBox2.Load(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "02" + ".bmp"); } else { this.pictureBox2.Image = null; } if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "03" + ".bmp")) { this.pictureBox3.Load(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "03" + ".bmp"); } else { this.pictureBox3.Image = null; } if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "04" + ".bmp")) { this.pictureBox4.Load(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "04" + ".bmp"); } else { this.pictureBox4.Image = null; } if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "05" + ".bmp")) { this.pictureBox5.Load(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "05" + ".bmp"); } else { this.pictureBox5.Image = null; } if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "06" + ".bmp")) { this.pictureBox6.Load(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "06" + ".bmp"); } else { this.pictureBox6.Image = null; } } catch { } }
/// <summary> /// 查会计 内部检查情况 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button4_Click(object sender, EventArgs e)//窗口5:内部检查 { try { string filePath1 = @"\\YL_SERVER\Youli_Server\Youli_date_bin\sys.ini"; string win1 = INIHelper.Read("window", "1", "0", filePath1); //严经理窗口 string win2 = INIHelper.Read("window", "2", "0", filePath1); //王庆青窗口 string win3 = INIHelper.Read("window", "3", "0", filePath1); //叶磊窗口 string win4 = INIHelper.Read("window", "4", "0", filePath1); //QC窗口 string win5 = INIHelper.Read("window", "5", "0", filePath1); //查会计窗口 notifyIcon1.ShowBalloonTip(1000, "提示", "正在Link...", ToolTipIcon.Info); #region 测试ping int index = win5.IndexOf("\\", 3); string ipStr = win5.Substring(2, index - 2); //string ipStr = "LENOVO-PC"; Ping pingSender = new Ping(); string data = "ping test data"; byte[] buf = Encoding.ASCII.GetBytes(data); int timeout = 1000; try { PingReply reply = pingSender.Send(ipStr, timeout, buf); if (reply.Status == IPStatus.Success) { } } catch { MessageBox.Show("别拿鼠标戳我了,对方关机或者断网了"); return; } #endregion var fileContent = string.Empty; var filePath = string.Empty; var filename = string.Empty; try { System.Diagnostics.Process.Start(win5); } catch { MessageBox.Show("路径错误"); } } catch { MessageBox.Show("未读到路径信息!"); return; } //using (OpenFileDialog openFileDialog = new OpenFileDialog()) //{ // openFileDialog.InitialDirectory = @win5; // openFileDialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; // openFileDialog.FilterIndex = 2; // openFileDialog.RestoreDirectory = true; // if (openFileDialog.ShowDialog() == DialogResult.OK) // { // //Get the path of specified file // filePath = openFileDialog.FileName; // // MessageBox.Show(filePath, filename); // Process m_Process = null; // m_Process = new Process(); // m_Process.StartInfo.FileName = @filePath; // m_Process.Start(); // } //} }