Esempio n. 1
0
        void LoadDisplaySettings()
        {
            TimeSpan        delta;
            DialogResult    MBResult = DialogResult.Ignore;
            EdDisplayConfig locDisplay;

            var configFile = Path.Combine(Form1.RegulatedNoiseSettings.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);
                        Display    = locDisplay;
                    }
                }
                catch (Exception ex)
                {
                    if (Display == null)
                    {
                        // ignore this if it was loaded short before
                        delta = DateTime.Now - lastTry_Displaydata;
                        if (delta.TotalMilliseconds > 1000)
                        {
                            // 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 (MBResult == DialogResult.Abort)
                            {
                                cErr.processError(ex, "Error in AppData_Changed()", true);
                            }
                            lastTry_Displaydata = DateTime.Now;
                        }
                    }
                }
            } while (MBResult == DialogResult.Retry);

            if (_parent != null)
            {
                _parent.setOCRCalibrationTabVisibility();
            }
        }
Esempio n. 2
0
        void LoadDisplaySettings()
        {
            var configFile = Path.Combine(Form1.RegulatedNoiseSettings.ProductAppData, "Graphics", "DisplaySettings.xml");

            if (!File.Exists(configFile))
            {
                return;
            }
            var serializer = new XmlSerializer(typeof(EdDisplayConfig));

            using (var myFileStream = new FileStream(configFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                Display = (EdDisplayConfig)serializer.Deserialize(myFileStream);
            }
        }
        void LoadDisplaySettings()
        {
            
            TimeSpan delta;
            DialogResult MBResult = DialogResult.Ignore;
            EdDisplayConfig locDisplay;

            var configFile = Path.Combine(Form1.RegulatedNoiseSettings.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);
                        Display = locDisplay;
                    }
                }
                catch (Exception ex)
                {
                    if (Display == null)
                    {
                        // ignore this if it was loaded short before
                        delta = DateTime.Now - lastTry_Displaydata;
                        if (delta.TotalMilliseconds > 1000)
                        {
                            // 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 (MBResult == DialogResult.Abort)
                            {
                                cErr.processError(ex, "Error in AppData_Changed()", true);
                            }
                            lastTry_Displaydata = DateTime.Now;
                        }
                    }
                }
            } while (MBResult == DialogResult.Retry);

            if (_parent != null)
            {
                _parent.setOCRCalibrationTabVisibility();
            }
        }