void LoadDisplaySettings() { try { TimeSpan delta; DialogResult MBResult = DialogResult.Ignore; EdDisplayConfig locDisplay; var configFile = Path.Combine(m_lDBCon.getIniValue<String>(IBE.IBESettingsView.DB_GROUPNAME, "ProductAppData"), "Graphics" ,"DisplaySettings.xml"); if (!File.Exists(configFile)) { return; } var serializer = new XmlSerializer(typeof(EdDisplayConfig)); do { try { using (var myFileStream = new FileStream(configFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { locDisplay = (EdDisplayConfig)serializer.Deserialize(myFileStream); m_Display = locDisplay; } } catch (Exception ex) { if (m_Display == null) { // ignore this if it was loaded short before delta = DateTime.Now - lastTry_Displaydata; if (delta.TotalMilliseconds > 1000) { if(!Program.SplashScreen.IsDisposed) Program.SplashScreen.TopMost = false; // ignore this if it was asked before MBResult = MessageBox.Show(String.Format("Error while loading ED-Displaysettings from file <{0}>", configFile), "Problem while loading data...", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button3); if(!Program.SplashScreen.IsDisposed) Program.SplashScreen.TopMost = true; if (MBResult == DialogResult.Abort) { CErr.processError(ex, "Error in AppData_Changed()"); } lastTry_Displaydata = DateTime.Now; } } } } while (MBResult == DialogResult.Retry); // this makes problems -> another solution is needed //if (_parent != null) //{ // _parent.setOCRTabsVisibility(); //} } catch (Exception ex) { throw new Exception("Error while loading display settings", ex); } }
void LoadDisplaySettings() { try { TimeSpan delta; DialogResult MBResult = DialogResult.Ignore; EdDisplayConfig locDisplay; var configFile = Path.Combine(m_lDBCon.getIniValue <String>(IBE.IBESettingsView.DB_GROUPNAME, "ProductAppData"), "Graphics", "DisplaySettings.xml"); if (!File.Exists(configFile)) { return; } var serializer = new XmlSerializer(typeof(EdDisplayConfig)); do { try { using (var myFileStream = new FileStream(configFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { locDisplay = (EdDisplayConfig)serializer.Deserialize(myFileStream); m_Display = locDisplay; } } catch (Exception ex) { if (m_Display == null) { // ignore this if it was loaded short before delta = DateTime.UtcNow - lastTry_Displaydata; if (delta.TotalMilliseconds > 1000) { SplashScreenForm.SetTopmost(false); // ignore this if it was asked before MBResult = MessageBox.Show(SplashScreenForm.GetPrimaryGUI(Program.MainForm), String.Format("Error while loading ED-Displaysettings from file <{0}>", configFile), "Problem while loading data...", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button3); SplashScreenForm.SetTopmost(true); if (MBResult == DialogResult.Abort) { CErr.processError(ex, "Error in AppData_Changed()"); } lastTry_Displaydata = DateTime.UtcNow; } } } } while (MBResult == DialogResult.Retry); // this makes problems -> another solution is needed //if (_parent != null) //{ // _parent.setOCRTabsVisibility(); //} } catch (Exception ex) { throw new Exception("Error while loading display settings", ex); } }