private void WelcomeForm_Load(object sender, EventArgs e) { if (AppContext.AppConfig.showUpdateNotice.Equals("1")) { MainForm = (Form)this.Parent; String url = AppContext.AppConfig.serverUrl + "sys/clientVersion/getMaxVersion?type=0"; //cmd = new Xr.Common.Controls.OpaqueCommand(AppContext.Session.waitControl); //cmd.ShowOpaqueLayer(0f); this.DoWorkAsync(0, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中) { String data = HttpClass.httpPost(url); return(data); }, null, (data) => //显示结果(此处用于对上面结果的处理,比如显示到界面上) { //cmd.HideOpaqueLayer(); JObject objT = JObject.Parse(data.ToString()); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { ClientVersionEntity cv = objT["result"].ToObject <ClientVersionEntity>(); un = new UpdateNoticeForm(); un.cv = cv; un.TopLevel = false; //这个很重要 this.Controls.Add(un); //找到外面的Form,添加InnerForm un.Show(); //显示InnerForm int x = this.Width - 625; int y = this.Height - 489; un.Location = new Point(x, y); } else { MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MainForm); } }); } }
private void ClientVersionEdit_Load(object sender, EventArgs e) { cmd = new Xr.Common.Controls.OpaqueCommand(this); cmd.ShowOpaqueLayer(225, false); dcClientVersion.DataType = typeof(ClientVersionEntity); String url = AppContext.AppConfig.serverUrl + "sys/sysDict/findByType?type=client_version_type"; this.DoWorkAsync(500, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中) { String data = HttpClass.httpPost(url); return(data); }, null, (r) => //显示结果(此处用于对上面结果的处理,比如显示到界面上) { JObject objT = JObject.Parse(r.ToString()); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { lueType.Properties.DataSource = objT["result"].ToObject <List <DictEntity> >(); lueType.Properties.DisplayMember = "label"; lueType.Properties.ValueMember = "value"; lueType.ItemIndex = 0; if (clientVersion != null) { this.DoWorkAsync(500, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中) { String data = HttpClass.httpPost(AppContext.AppConfig.serverUrl + "sys/clientVersion/get?id=" + clientVersion.id); return(data); }, null, (data2) => //显示结果(此处用于对上面结果的处理,比如显示到界面上) { objT = JObject.Parse(data2.ToString()); if (string.Compare(objT["state"].ToString(), "true", true) == 0) { clientVersion = objT["result"].ToObject <ClientVersionEntity>(); serviceFilePath = clientVersion.updateFilePath; String[] strArr = clientVersion.updateFilePath.Split(new char[] { '/' }); dcClientVersion.SetValue(clientVersion); teFileName.Text = strArr[strArr.Length - 1]; cmd.HideOpaqueLayer(); } else { cmd.HideOpaqueLayer(); MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, this); return; } }); } else { cmd.HideOpaqueLayer(); clientVersion = new ClientVersionEntity(); } } else { cmd.HideOpaqueLayer(); MessageBoxUtils.Show(objT["message"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, this); return; } }); }