private void Main_Load(object sender, EventArgs e) { //launch the splash screen on a seperate thread //The first value passed in disables the timer that automatically closes the form. //The second value passed is the fade constant, which determines the change in form opacity for every interval of //the fadeTimer //The third value is the interval for the fadeTimer in ms int splashTimeout = 0; double fadeConstant = 0.05; int fadeTimer = 35; string initialmsg = "SST Starting, loading settings..."; string licenseString = ResourceReader.ReadFromResource("Lewis.SST.Resources.Legal.License.rtf"); logger.Info(initialmsg); // load settings if (File.Exists(optionsFileName)) { optionsSettings = File.ReadAllText(optionsFileName); } else { optionsSettings = ResourceReader.ReadFromResource("Lewis.SST.Forms.Options.optionsControls.xml"); } object splash = OptionValues.GetValue("ShowSplash", optionsSettings); if (splash != null && (CheckState)splash == CheckState.Checked) { SplashForm.Showasyncsplash(splashTimeout, fadeConstant, fadeTimer); SplashForm.StatusText = initialmsg; } setOptions(optionsSettings); if (File.Exists(configFileName)) { dockPanel.LoadFromXml(configFileName, m_deserializeDockContent); } m_xmlNodeExplorer.Show(dockPanel); m_serverExplorer.Show(dockPanel); m_serverExplorer.SQLConnections = new SQLConnections(); SplashForm.StatusText = "Reading form settings..."; Settings.CtrlSettings cs = Settings.XmlSettings.ReadXml(windowsSettingsFile); if (cs != null && cs.Type != null) { Form f = (Form)this; Settings.XmlSettings.SetSettings(ref f, cs); if (cs.ChildCtrlsToPersist.Length > 0) { foreach (Settings.CtrlSettings cs1 in cs.ChildCtrlsToPersist) { if (typeof(optionsFormProperties).ToString().Equals(cs1.Type)) { if (ofp == null) { ofp = new optionsFormProperties(); } ofp.Location = cs1.Location; ofp.Size = cs1.Size; break; } } } } if (ofp == null) { ofp = new optionsFormProperties(); } // do sanity check for main form if (this.Location.X < 0 && this.Location.Y < 0) { this.Location = new Point(0, 0); } // write out license text if (licenseString != null) { File.WriteAllText("License.txt", licenseString); } //start the splash screen closing System.Threading.Thread.Sleep(2500); SplashForm.closeAsyncSplash(); }
private void optionsToolStripMenuItem_Click(object sender, EventArgs e) { OptionsDialog.OptionsDialog od = new OptionsDialog.OptionsDialog(optionsSettings); if (ofp != null) { od.Location = ofp.Location; od.Size = ofp.Size; } od.ShowDialog(); if (od.DialogResult == DialogResult.OK) { optionsSettings = od.ControlsValues; } ofp = new optionsFormProperties(od); setOptions(optionsSettings); }
public static CtrlSettings GetSettings(optionsFormProperties ofp) { Lewis.SST.Settings.CtrlSettings cs = new Lewis.SST.Settings.CtrlSettings(typeof(optionsFormProperties).ToString()); if (ofp != null) { try { cs.Name = ofp.Name; cs.Location = ofp.Location; cs.Size = ofp.Size; } catch (Exception ex) { logger.Error(SQLSchemaTool.ERRORFORMAT, ex.Message, ex.Source, ex.StackTrace); } } return cs; }