public DownloadCompleteFunc(WindowsUpdateDialog mainForm) { this.form1 = mainForm; }
// Implementation of state interface... public UpdateSearcher_state(WindowsUpdateDialog mainForm) { this.form1 = mainForm; // form1.setTextBox2Notification("State: Search Started..."); }
public DownloadProgressChangedFunc(WindowsUpdateDialog mainForm) { this.form1 = mainForm; }
private void SearchUpdateComplete(WindowsUpdateDialog mainform) { WindowsUpdateDialog formRef = mainform; // Declare a new UpdateCollection and populate the result... _updateCollection = new UpdateCollection(); _updateSearchResult = _updateSearcher.EndSearch(_searchJob); _searchJob = null; //Count = NewUpdatesSearchResult.Updates.Count; //formRef.Invoke(formRef.sendNotification); // Accept Eula code for each update for (int i = 0; i < _updateSearchResult.Updates.Count; i++) { IUpdate iUpdate = _updateSearchResult.Updates[i]; if (iUpdate.EulaAccepted == false) { iUpdate.AcceptEula(); } _updateCollection.Add(iUpdate); } if (_updateSearchResult.Updates.Count > 0) { { this.AppendString("\r\n发现 " + _updateSearchResult.Updates.Count + " 个更新:\r\n"); int i = 0; foreach (IUpdate update in _updateSearchResult.Updates) { this.AppendString((i + 1).ToString() + ") " + update.Title + "\r\n"); // textBox1.AppendText(update.Title + Environment.NewLine); i++; } this.AppendString("\r\n"); } #if NO DialogResult result = MessageBox.Show(this, "要下载这 " + _updateSearchResult.Updates.Count + " 个更新么?", "WindowsUpdateDialog", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result == System.Windows.Forms.DialogResult.No) { OnAllComplete(); return; } #endif BeginDownloadUpdate(); } else { this.AppendString("当前没有发现任何更新"); // 全部结束 OnAllComplete(); } }
public SearchCompleteFunc(WindowsUpdateDialog mainForm) { this.form1 = mainForm; }
public InstallCompletedFunc(WindowsUpdateDialog mainForm) { this.form1 = mainForm; }
// Implementation of state interface... public UpdateInstaller_state(WindowsUpdateDialog mainForm) { this.form1 = mainForm; // form1.setTextBox2Notification("State: Installation Started..."); }
// Implementation of state interface... public UpdateDownloader_state(WindowsUpdateDialog mainForm) { this.form1 = mainForm; // form1.setTextBox2Notification("State: Download Started..."); }
public InstallationProgressChangedFunc(WindowsUpdateDialog mainForm) { this.form1 = mainForm; }
// 程序启动时候需要执行的初始化操作 // 这些操作只需要执行一次。也就是说,和登录和连接的服务器无关。如果有关,则要放在 InitialProperties() 中 // FormLoad() 中的许多操作应当移动到这里来,以便尽早显示出框架窗口 void FirstInitial() { #if NO if (DetectIE() == false) { MessageBox.Show(this, "IE 浏览器故障,无法启动 dp2circulation。请联系数字平台"); Application.Exit(); return; } #endif this.SetBevel(false); #if NO if (!API.DwmIsCompositionEnabled()) { //MessageBox.Show("This demo requires Vista, with Aero enabled."); //Application.Exit(); } else { SetGlassRegion(); } #endif if (Program.IsDevelopMode() == false) { this.MenuItem_separator_function2.Visible = false; this.MenuItem_chatForm.Visible = false; this.MenuItem_messageForm.Visible = false; this.MenuItem_openReservationListForm.Visible = false; // this.MenuItem_inventory.Visible = false; } // 获得MdiClient窗口 { Type t = typeof(Form); PropertyInfo pi = t.GetProperty("MdiClient", BindingFlags.Instance | BindingFlags.NonPublic); this.MdiClient = (MdiClient)pi.GetValue(this, null); this.MdiClient.SizeChanged += new EventHandler(MdiClient_SizeChanged); m_backgroundForm = new BackgroundForm(); m_backgroundForm.MdiParent = this; m_backgroundForm.Show(); } if (ApplicationDeployment.IsNetworkDeployed == true) { // MessageBox.Show(this, "network"); DataDir = Application.LocalUserAppDataPath; } else { // MessageBox.Show(this, "no network"); // DataDir = Environment.CurrentDirectory; // 2015/8/5 this.DataDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); } string strError = ""; int nRet = 0; { // 2013/6/16 this.UserDir = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "dp2Circulation_v2"); PathUtil.CreateDirIfNeed(this.UserDir); this.UserTempDir = Path.Combine(this.UserDir, "temp"); PathUtil.CreateDirIfNeed(this.UserTempDir); // 2015/7/8 this.UserLogDir = Path.Combine(this.UserDir, "log"); PathUtil.CreateDirIfNeed(this.UserLogDir); // 启动时在日志中记载当前 dp2circulation 版本号 this.WriteErrorLog(Assembly.GetAssembly(this.GetType()).FullName); // 检查 KB???? /* 操作类型 crashReport -- 异常报告 主题 dp2circulation 发送者 xxx 媒体类型 text 内容 发生未捕获的异常: Type: System.AggregateException Message: 未通过等待任务或访问任务的 Exception 属性观察到任务的异常。因此,终结器线程重新引发了未观察到的异常。 Stack: 在 System.Threading.Tasks.TaskExceptionHolder.Finalize() Type: System.IO.FileLoadException Message: 未能加载文件或程序集“System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes”或它的某一个依赖项。给定程序集名称或基本代码无效。 (异常来自 HRESULT:0x80131047) Stack: 在 DigitalPlatform.MessageClient.MessageConnection.Login(String userName, String password, String libraryUID, String libraryName, String propertyList) 在 dp2Circulation.MessageHub.Login() 在 DigitalPlatform.MessageClient.MessageConnection.<>c__DisplayClass5.<ConnectAsync>b__3(Task antecendent) 在 System.Threading.Tasks.Task.<>c__DisplayClassb.<ContinueWith>b__a(Object obj) 在 System.Threading.Tasks.Task.InnerInvoke() 在 System.Threading.Tasks.Task.Execute() dp2Circulation 版本: dp2Circulation, Version=2.4.5712.38964, Culture=neutral, PublicKeyToken=null 操作系统:Microsoft Windows NT 6.0.6001 Service Pack 1 操作时间 2015/8/24 16:21:11 (Mon, 24 Aug 2015 16:21:11 +0800) 前端地址 xxx 经由 http://dp2003.com/dp2library * */ // https://support.microsoft.com/zh-cn/kb/2468871 string strKbName = "KB2468871"; if (Global.IsKbInstalled(strKbName) == false) { Application.DoEvents(); this.WriteErrorLog("dp2circulation 启动时,发现本机尚未安装 .NET Framework 4 更新 KB2468871"); #if NO DialogResult result = MessageBox.Show(this, "为顺利运行 dp2Circulation, 请先安装 .NET Framework 4 更新 (" + strKbName + ")" + "\r\n\r\n是否继续运行?", "dp2Circulation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result == System.Windows.Forms.DialogResult.No) { try { System.Diagnostics.Process.Start("iexplore", "https://support.microsoft.com/zh-cn/kb/2468871"); } catch (System.ComponentModel.Win32Exception) { // 可能是 ie 没有安装? } Application.Exit(); return; } #endif MessageBox.Show(this, "为顺利运行 dp2Circulation, 请先安装 .NET Framework 4 更新 (" + strKbName + ")"); if (Control.ModifierKeys != Keys.Control) { #if NO try { System.Diagnostics.Process.Start("iexplore", "https://support.microsoft.com/zh-cn/kb/2468871"); } catch (System.ComponentModel.Win32Exception) { // 可能是 ie 没有安装? } #endif WindowsUpdateDialog dlg = new WindowsUpdateDialog(); MainForm.SetControlFont(dlg, this.DefaultFont); dlg.ShowDialog(this); Application.Exit(); return; } } // 删除一些以前的目录 string strDir = PathUtil.MergePath(this.DataDir, "operlogcache"); if (Directory.Exists(strDir) == true) { nRet = Global.DeleteDataDir( this, strDir, out strError); if (nRet == -1) { MessageBox.Show(this, "删除以前遗留的文件目录时发生错误: " + strError); } } strDir = PathUtil.MergePath(this.DataDir, "fingerprintcache"); if (Directory.Exists(strDir) == true) { nRet = Global.DeleteDataDir( this, strDir, out strError); if (nRet == -1) { MessageBox.Show(this, "删除以前遗留的文件目录时发生错误: " + strError); } } } { string strCssUrl = PathUtil.MergePath(this.DataDir, "background.css"); string strLink = "<link href='" + strCssUrl + "' type='text/css' rel='stylesheet' />"; try { Global.WriteHtml(m_backgroundForm.WebBrowser, "<html><head>" + strLink + "</head><body>"); } catch(Exception ex) { MessageBox.Show(this, "dp2circulation 所需的 IE 浏览器控件出现异常: " + ExceptionUtil.GetDebugText(ex)); Application.Exit(); } } // 设置窗口尺寸状态 if (AppInfo != null) { // 首次运行,尽量利用“微软雅黑”字体 if (this.IsFirstRun == true) { SetFirstDefaultFont(); } MainForm.SetControlFont(this, this.DefaultFont); AppInfo.LoadFormStates(this, "mainformstate", FormWindowState.Maximized); // 程序一启动就把这些参数设置为初始状态 this.DisplayScriptErrorDialog = false; } InitialFixedPanel(); stopManager.Initial(this.toolButton_stop, (object)this.toolStripStatusLabel_main, (object)this.toolStripProgressBar_main); stopManager.OnDisplayMessage += new DisplayMessageEventHandler(stopManager_OnDisplayMessage); this.SetMenuItemState(); // cfgcache nRet = cfgCache.Load(Path.Combine(this.DataDir, "cfgcache.xml"), out strError); if (nRet == -1) { if (IsFirstRun == false) MessageBox.Show(strError); } cfgCache.TempDir = Path.Combine(this.DataDir, "cfgcache"); cfgCache.InstantSave = true; // 2013/4/12 // 清除以前残余的文件 cfgCache.Upgrade(); // 消除上次程序意外终止时遗留的短期保存密码 bool bSavePasswordLong = AppInfo.GetBoolean( "default_account", "savepassword_long", false); if (bSavePasswordLong == false) { AppInfo.SetString( "default_account", "password", ""); } StartPrepareNames(true, true); this.MdiClient.ClientSizeChanged += new EventHandler(MdiClient_ClientSizeChanged); // GuiUtil.RegisterIE9DocMode(); #region 脚本支持 ScriptManager.applicationInfo = this.AppInfo; ScriptManager.CfgFilePath = Path.Combine(this.DataDir, "mainform_statis_projects.xml"); ScriptManager.DataDir = this.DataDir; ScriptManager.CreateDefaultContent -= new CreateDefaultContentEventHandler(scriptManager_CreateDefaultContent); ScriptManager.CreateDefaultContent += new CreateDefaultContentEventHandler(scriptManager_CreateDefaultContent); try { ScriptManager.Load(); } catch (FileNotFoundException) { // 不必报错 2009/2/4 } catch (Exception ex) { MessageBox.Show(this, ex.Message); } #endregion this.qrRecognitionControl1.Catched += new DigitalPlatform.Drawing.CatchedEventHandler(qrRecognitionControl1_Catched); this.qrRecognitionControl1.CurrentCamera = AppInfo.GetString( "mainform", "current_camera", ""); this.qrRecognitionControl1.EndCatch(); // 一开始的时候并不打开摄像头 2013/5/25 this.m_strPinyinGcatID = this.AppInfo.GetString("entity_form", "gcat_pinyin_api_id", ""); this.m_bSavePinyinGcatID = this.AppInfo.GetBoolean("entity_form", "gcat_pinyin_api_saveid", false); #if NO // 2015/5/24 MouseLButtonMessageFilter filter = new MouseLButtonMessageFilter(); filter.MainForm = this; Application.AddMessageFilter(filter); #endif #if NO // 2015/7/19 // 复制 datadir default_objectrights.xml --> userdir objectrights.xml { string strTargetFileName = Path.Combine(this.UserDir, "objectrights.xml"); if (File.Exists(strTargetFileName) == false) { string strSourceFileName = Path.Combine(this.DataDir, "default_objectrights.xml"); if (File.Exists(strSourceFileName) == false) { MessageBox.Show(this, "配置文件 '" + strSourceFileName + "' 不存在,无法复制到用户目录。\r\n\r\n建议尽量直接从 dp2003.com 以 ClickOnce 方式安装 dp2circulation,以避免绿色安装时复制配置文件不全带来的麻烦"); Application.Exit(); } else File.Copy(strSourceFileName, strTargetFileName, false); } } #endif if (CopyDefaultCfgFiles() == false) { Application.Exit(); return; } }
private void button_openWindowsUpdateDialog_Click(object sender, EventArgs e) { WindowsUpdateDialog dlg = new WindowsUpdateDialog(); dlg.ShowDialog(this); }