/// <summary> /// 显示检查更新的窗口 /// <paramref name="fromAutoUpdate">更新请求是否是来自于自动更新</paramref> /// </summary> public static void ShowWindow(bool fromAutoUpdate = false) { FromAutoUpdate = fromAutoUpdate; if (Instance == null) { Instance = new UpdateForm(); } if (Instance.Busy) { var mainForm = Application.OpenForms["MainForm"] as MainForm; if (mainForm != null) { mainForm .ShowTip(2000, Instance.resources.GetString("updateIsBusy")); } return; } var size = Util.GetScreenSize(true); Instance.Height = 110; Instance.Top = size.Height - 110; Instance.pnDetail.Hide(); Instance.Left = size.Width; var updateThread = new Thread(Instance.RunCheck) { IsBackground = true }; // 如果不是来自自动更新,就先显示窗口 if (FromAutoUpdate) { updateThread.Start(); return; } // 启动检查更新 Instance.SlideIn(() => { Instance.InvokeMethod(() => { Instance.btnExit.Show(); updateThread.Start(); }); }); }
/// <summary> /// /// </summary> public static void ShowWindow(bool autoClose = false) { AutoClose = autoClose; if (Instance == null) { Instance = new UpdateForm(); FormWidth = Instance.Width; } if (Instance.Busy) { var mainForm = Application.OpenForms["MainForm"] as MainForm; if (mainForm != null) { mainForm .ShowTip(2000, "正在查询更新信息,求你不要再点了..."); } return; } Instance.Height = 110; Instance.Top = Screen.PrimaryScreen.WorkingArea.Height - 110; Instance.pnDetail.Hide(); if (Instance.Width == 0) { Instance.Width = FormWidth; } Instance.Width = 0; Instance.Left = Util.GetScreenSize().Width; Instance.Show(); Instance.BringToFront(); if (!AutoClose) { Instance.SlideIn(); } new Thread(Instance.RunCheck) { IsBackground = true }.Start(); }