private void Application_Startup(object sender, StartupEventArgs e) { System.AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; settingsFile = System.IO.Path.Combine(System.Environment.CurrentDirectory, "settings.bin"); settings = Settings.load(settingsFile); if (settings == null) settings = new Settings(); bool deploy = false; foreach (var item in e.Args) { if (item == "deploy") deploy = true; } if (settings.firstStart || deploy) new wpf.ConfigurationWizard.Wizard( settings.clone(), SaveSettings).Show(); else new wpf.MainWindow(settings).Show(); }
public static void Save(string file ,Settings s) { FileStream fs = new FileStream(file, FileMode.Create); BinaryFormatter formatter = new BinaryFormatter(); try { formatter.Serialize(fs, s); fs.Flush(); } catch (Exception) { throw; } finally { fs.Close(); } }
public Settings clone() { Settings back = new Settings(); back.firstStart = firstStart; back.SqlConString = SqlConString; return back; }
public AddUser(Settings settings) : this() { this.settings = settings; }
void SaveSettings(object s, EventArgs e) { wpf.ConfigurationWizard.Wizard w = s as wpf.ConfigurationWizard.Wizard; w.settings.firstStart = false; Settings.Save(settingsFile, w.settings); settings = w.settings; new wpf.MainWindow(settings).Show(); }