private void PopulateConnections() { connectionsSettings = ConnectionsSettings.Load(); cboConnection.DataSource = connectionsSettings.Connections; cboConnection.DisplayMember = "Name"; }
public static ConnectionsSettings Load() { ConnectionsSettings connectionsSettings = new ConnectionsSettings(); if (File.Exists(pathFile)) { using (var fileStream = new FileStream(pathFile, FileMode.Open)) { connectionsSettings = (ConnectionsSettings) new BinaryFormatter().Deserialize(fileStream); } } return(connectionsSettings); }
public ConnectionDialog() { InitializeComponent(); connectionsSettings = ConnectionsSettings.Load(); PopulateConnections(); PopulateServerTypes(); serverTypeComboBox.SelectedIndexChanged += OnServerTypeSelectedIndexChanged; Load += OnConnectionDialogLoad; }
public static ConnectionsSettings Load() { ConnectionsSettings connectionsSettings = new ConnectionsSettings(); var xmlSerializer = new XmlSerializer(typeof(ConnectionsSettings)); var fi = new FileInfo(Application.StartupPath + @"\Connections\connections.xml"); if (fi.Exists) { using (FileStream fileStream = fi.OpenRead()) { connectionsSettings = (ConnectionsSettings)xmlSerializer.Deserialize(fileStream); } } return(connectionsSettings); }
public ConnectionDialog() { InitializeComponent(); connectionsSettings = ConnectionsSettings.Load(); PopulateConnections(); PopulateServerTypes(); serverTypeComboBox.SelectedIndexChanged += OnServerTypeSelectedIndexChanged; chkNHibernateMapping.Checked = CodeGenerator.Settings.Default.GenerateNHibernateMapping; cboDefaultIdGenerator.DataSource = Enum.GetValues(typeof(CodeGenerator.IdentityGeneratorType)); cboDefaultIdGenerator.SelectedItem = CodeGenerator.Settings.Default.DefaultIdentityGenerator; chkDefaultFetching.Checked = CodeGenerator.Settings.Default.DefaultLazyFetching; chkUseUnderscoreAndLowercaseInDB.Checked = CodeGenerator.Settings.Default.UseUnderscoreAndLowercaseInDB; Load += OnConnectionDialogLoad; }