private void WDSFrameWindow_Load(object sender, EventArgs e) { try { foreach (Control control in base.Controls) if (control is MdiClient) { ((MdiClient)control).GetType() .GetMethod("SetStyle", BindingFlags.NonPublic | BindingFlags.Instance) .Invoke((MdiClient)control, new object[] { ControlStyles.OptimizedDoubleBuffer, true }); } RegisterNotification(); _infoDlg = new Dlg_GlobalInfo(); _infoDlg.FormClosed += new FormClosedEventHandler(infoDlg_FormClosed); _infoDlg.MdiParent = this; _infoDlg.Show(); if (File.Exists(GlobalServices.WDSSysXMLFilePathName)) { string path = Path.ChangeExtension(GlobalServices.WDSSysXMLFilePathName, "OLD.swc"); if (File.Exists(path)) File.Delete(path); File.Move(GlobalServices.WDSSysXMLFilePathName, path); FileSecurity accessControl = File.GetAccessControl(path); accessControl.ResetAccessRule(new FileSystemAccessRule("Users", FileSystemRights.FullControl, AccessControlType.Allow)); File.SetAccessControl(path, accessControl); _wdsSysXmlDoc = new XmlDocument(); Stream stream = new FileStream(path, FileMode.Open); MemoryStream stream2 = new MemoryStream(); TextWriter writer = new StreamWriter(stream2); TextReader reader = new StreamReader(stream); writer.Write(Code.EncryptDecrypt(reader.ReadToEnd())); writer.Flush(); stream2.Seek(0L, SeekOrigin.Begin); _wdsSysXmlDoc.Load(stream2); _adtNode = _wdsSysXmlDoc.FirstChild.NextSibling.SelectSingleNode("ADT"); _applicationsNode = _wdsSysXmlDoc.FirstChild.NextSibling.SelectSingleNode("Applications"); _preferencesNode = _wdsSysXmlDoc.FirstChild.NextSibling.SelectSingleNode("Preferences"); LoadPreferences(_preferencesNode); _childAppsNode = _applicationsNode.ChildNodes; _adtRecsNode = _adtNode.ChildNodes; } bool flag = false; if (GlobalPreferences.instance().swUpdate.AutoUpdate) { double num = 0.0; switch (GlobalPreferences.instance().swUpdate.UpdatePeriod) { case PrefSofwareUpdate.UpdatePeriodList.OnStartup: num = 0.0; flag = true; break; case PrefSofwareUpdate.UpdatePeriodList.Daily: num = 1.0; break; case PrefSofwareUpdate.UpdatePeriodList.Weekly: num = 7.0; break; case PrefSofwareUpdate.UpdatePeriodList.Monthly: num = 30.0; break; } DateTime time = GlobalPreferences.instance().swUpdate.LastUpdate.AddDays(num); if (DateTime.Now > time) flag = true; } if (flag) { Dlg_SoftwareUpdate update = new Dlg_SoftwareUpdate(true, new Point(0, 205)); if (update.ShowDialog(this) == DialogResult.No) { base.Close(); return; } } timerFrameWin.Enabled = true; enableDevicePolling(); } catch { enableDevicePolling(); } }
private void btnUpdateNow_Click(object sender, EventArgs e) { this.btnUpdateNow.Enabled = false; Dlg_SoftwareUpdate update = new Dlg_SoftwareUpdate(false, new Point(0, 0x41)); if (update.ShowDialog() == DialogResult.No) { try { this._shutdownRequest = true; this.btnCancel_Click(null, null); } catch (Exception exception) { _log.Warn(exception.Message); } } this.btnUpdateNow.Enabled = true; }