/// <summary> /// 检查是否更新 /// </summary> /// <param name="model"></param> public void RequestISUpdata(ControlReflex.PassModel model) { JObject obj = JObject.Parse(model.JsonData); string date = null; try { //程序名称 string name = obj["SerialNumber"].ToString(); //版本号 string versionNumber = obj["VersionNumber"].ToString(); //根目录 string url = obj["RootDirectory"].ToString(); DataTable data = ControlSQLMethod.QueryIsVMAndPro(name, versionNumber); date = data.Rows.Count.Equals(0) ? "true" : "false"; new Task(() => { UpdateStart(data, model.Socket, url, versionNumber); }).Start(); } catch (Exception ex) { Log.WriteLine(string.Format("时间:{0}\r\n异常信息:{1}", DateTime.Now, ex.Message)); } SendMessage.SendIsUpdate(model.Socket, date is null ? "false" : date); }
private void 除ToolStripMenuItem_Click(object sender, EventArgs e) { if (!(listBoxItem.Equals(""))) { System.Diagnostics.Process.Start("explorer.exe", ControlSQLMethod.QuertTest(listBoxItem)); } }
private void Server_Load(object sender, EventArgs e) { //string[] ad = File.ReadAllLines("Config.txt", Encoding.GetEncoding("GB2312")); //创建一个ToolStripMenuItem菜单,可以文本和图片一并添加 ToolStripMenuItem tsmi = new ToolStripMenuItem("管理程序"); foreach (DataRow item in ControlSQLMethod.QueryConfig().Rows) { ToolStripMenuItem tsmi2 = new ToolStripMenuItem(item["Name"].ToString()); tsmi2.MouseUp += (object s, MouseEventArgs d) => { listBox1.Items.Clear(); ToolStripMenuItem test = new ToolStripMenuItem(); foreach (DataRow ite in ControlSQLMethod.QueryVM(item["ID"].ToString()).Rows) { //添加子项 listBox1.Items.Add(item["Name"].ToString() + "-" + ite["Nuber"].ToString()); } }; //listBox1.Items.Add(tsmi2); tsmi.DropDownItems.Add(tsmi2); } ToolStripMenuItem t = new ToolStripMenuItem("管理程序"); t.MouseUp += (object s, MouseEventArgs d) => { //点击按钮发生的事件 }; //listBox1.Items.Add(tsmi2); tsmi.DropDownItems.Add(t); menuStrip1.Items.Add(tsmi); }
/// <summary> /// 路径设置按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void 路径设置ToolStripMenuItem_Click(object sender, EventArgs e) { if (!(listBoxItem.Equals(""))) { MessageBox.Show("现在地址" + ControlSQLMethod.QuertTest(listBoxItem)); } //var c = ((System.Windows.Forms.ListBox)sender).SelectedItem; }
/// <summary> /// 选中双击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e) { var c = ((System.Windows.Forms.ListBox)sender).SelectedItem; if (!(c is null))//判断是否选中 然后打开相应文件夹 { System.Diagnostics.Process.Start("explorer.exe", ControlSQLMethod.QuertTest(listBoxItem)); } }