private void mnuTitle_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { int it = mnuTitle.Items.IndexOf(e.ClickedItem); switch (it) { case 0: //转到首页 { string url = MyApp.getInstance().getFormUrl("WebDefault"); pageControl.browser.Url = new Uri(url); break; } case 1: //close { if (titles.Index == 0) { break; } int index = titles.Index; titles.Remove(index); pageControl.Delete(index); pageControl.Index = index - 1; titles.Index = index - 1; Control last = titles.getItem(titles.Count - 1); btnNew.Left = last.Left + last.Width + 10; break; } default: break; } }
private void btnOk_Click(object sender, EventArgs e) { //打开指定的浏览器 string url = String.Format("install?appcode={0:G}&operate={1:G}", MyApp.AppCode, "update"); System.Diagnostics.Process.Start(MyApp.getInstance().getFormUrl(url)); }
private void btnOk_Click(object sender, EventArgs e) { //打开指定的浏览器 string url = String.Format("install.update?appCode={0:G}&curVersion={1:G}", MyApp.AppCode, myApp.getCurrentVersion()); System.Diagnostics.Process.Start(MyApp.getInstance().getFormUrl(url)); }
public static MyApp getInstance() { if (instance == null) { instance = new MyApp(); } return(instance); }
private void pictureBox1_Click(object sender, EventArgs e) { timer1.Enabled = false; ThreadStart thread = () => { string formCode = String.Format("install.client?appcode={0:G}", MyApp.AppCode); string url = MyApp.getInstance().getFormUrl(formCode); var client = new WebClient(); client.Encoding = System.Text.Encoding.GetEncoding("utf-8"); string resp = client.DownloadString(url); HttpOnResponse httpResp = httpOnResponse; this.Invoke(httpResp, client, resp); }; new Thread(thread).Start(); }
public void httpOnResponse(WebClient client, string resp) { try { var json = JObject.Parse(resp); MyApp myApp = MyApp.getInstance(); myApp.loadConfig(json); var oldVersion = myApp.getCurrentVersion(); if (oldVersion == myApp.AppVersion) { startMainForm(); return; } JArray readme = (JArray)json["appUpdateReadme"]; string str = ""; foreach (var line in readme) { str += (string)line + "\n"; } lblReadme.Text = str; appUpdateReset = (bool)json["appUpdateReset"]; if (appUpdateReset) { btnCancel.Text = "退出"; } llDialog.Left = (this.Width - llDialog.Width) / 2; llDialog.Visible = true;; } catch (Exception e1) { lblTitle.Text = "启动出现错误!"; lblReadme.Text = e1.Message; btnOk.Visible = false; appUpdateReset = true; btnCancel.Text = "稍后再试"; llDialog.Visible = true; } }
private void newPageClick(object sender, EventArgs e) { createWindow(MyApp.getInstance().getFormUrl("WebDefault")); }