[Adapdev-commits] Adapdev/src/Adapdev.Windows.Forms DatabaseSetting.cs,1.4,1.5 DatabaseWizard.cs,1.2
Status: Beta
Brought to you by:
intesar66
From: Trevor L. <tre...@us...> - 2005-04-13 04:24:09
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7596/src/Adapdev.Windows.Forms Modified Files: DatabaseSetting.cs DatabaseWizard.cs DatabaseWizard.resx DatabaseWizardForm.cs Log Message: Index: DatabaseWizardForm.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms/DatabaseWizardForm.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DatabaseWizardForm.cs 10 Apr 2005 09:59:22 -0000 1.2 --- DatabaseWizardForm.cs 13 Apr 2005 04:23:42 -0000 1.3 *************** *** 12,16 **** public class DatabaseWizardForm : System.Windows.Forms.Form { ! private Adapdev.Windows.Forms.DatabaseWizard databaseWizard1; private System.Windows.Forms.Button btnSave; private System.Windows.Forms.Button btnCancel; --- 12,16 ---- public class DatabaseWizardForm : System.Windows.Forms.Form { ! private Adapdev.Windows.Forms.DatabaseWizard databaseWizard; private System.Windows.Forms.Button btnSave; private System.Windows.Forms.Button btnCancel; *************** *** 27,31 **** // InitializeComponent(); ! this.databaseWizard1.SetDatabaseSetting(setting); // --- 27,31 ---- // InitializeComponent(); ! this.databaseWizard.SetDatabaseSetting(setting); // *************** *** 40,54 **** public void SetDatabaseSetting(DatabaseSetting setting) { ! this.databaseWizard1.SetDatabaseSetting(setting); } public DatabaseSetting GetDatabaseSetting() { ! return this.databaseWizard1.GetDatabaseSetting(); } public DatabaseWizard DatabaseWizard { ! get{return this.databaseWizard1;} } --- 40,54 ---- public void SetDatabaseSetting(DatabaseSetting setting) { ! this.databaseWizard.SetDatabaseSetting(setting); } public DatabaseSetting GetDatabaseSetting() { ! return this.databaseWizard.GetDatabaseSetting(); } public DatabaseWizard DatabaseWizard { ! get{return this.databaseWizard;} } *************** *** 75,79 **** private void InitializeComponent() { ! this.databaseWizard1 = new Adapdev.Windows.Forms.DatabaseWizard(); this.btnSave = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); --- 75,79 ---- private void InitializeComponent() { ! this.databaseWizard = new Adapdev.Windows.Forms.DatabaseWizard(); this.btnSave = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); *************** *** 82,94 **** // databaseWizard1 // ! this.databaseWizard1.ConnectionName = ""; ! this.databaseWizard1.DbLocation = ""; ! this.databaseWizard1.DbName = ""; ! this.databaseWizard1.Location = new System.Drawing.Point(0, 0); ! this.databaseWizard1.Name = "databaseWizard1"; ! this.databaseWizard1.Password = ""; ! this.databaseWizard1.Size = new System.Drawing.Size(504, 272); ! this.databaseWizard1.TabIndex = 0; ! this.databaseWizard1.Username = ""; // // btnSave --- 82,94 ---- // databaseWizard1 // ! this.databaseWizard.ConnectionName = ""; ! this.databaseWizard.DbLocation = ""; ! this.databaseWizard.DbName = ""; ! this.databaseWizard.Location = new System.Drawing.Point(0, 0); ! this.databaseWizard.Name = "databaseWizard1"; ! this.databaseWizard.Password = ""; ! this.databaseWizard.Size = new System.Drawing.Size(504, 272); ! this.databaseWizard.TabIndex = 0; ! this.databaseWizard.Username = ""; // // btnSave *************** *** 114,118 **** this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnSave); ! this.Controls.Add(this.databaseWizard1); this.Name = "DatabaseWizardForm"; this.Text = "DatabaseWizard"; --- 114,118 ---- this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnSave); ! this.Controls.Add(this.databaseWizard); this.Name = "DatabaseWizardForm"; this.Text = "DatabaseWizard"; Index: DatabaseWizard.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms/DatabaseWizard.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DatabaseWizard.cs 10 Apr 2005 09:59:22 -0000 1.2 --- DatabaseWizard.cs 13 Apr 2005 04:23:42 -0000 1.3 *************** *** 41,45 **** private readonly int iconSelected = 1; ! private DbConnectionProvider _connectionProvider; private ProviderConfig _providersConfig = new ProviderConfig(); --- 41,45 ---- private readonly int iconSelected = 1; ! private DbConnectionProvider _connectionProvider = null; private ProviderConfig _providersConfig = new ProviderConfig(); *************** *** 47,53 **** // This call is required by the Windows.Forms Form Designer. InitializeComponent(); - this.UseDatabaseServer(); this.BuildConnectionsTree(this.tvConnectionTypes); ! this.SetGUIProperties(_connectionProvider=null); // TODO: Add any initialization after the InitializeComponent call --- 47,52 ---- // This call is required by the Windows.Forms Form Designer. InitializeComponent(); this.BuildConnectionsTree(this.tvConnectionTypes); ! this.SetGUIProperties(DbConnectionTypes.UnknownConnectionType()); // TODO: Add any initialization after the InitializeComponent call *************** *** 366,381 **** #region Form Event Handlers - private void UseDatabaseServer() { - this.lblLocation.Text = "Server"; - this.btnOpenFile.Visible = false; - this.btnOpenFile.Enabled = false; - } - - private void UseDatabaseFile() { - this.lblLocation.Text = "Database File"; - this.btnOpenFile.Visible = true; - this.btnOpenFile.Enabled = true; - } - private void btnOpenFile_Click(object sender, EventArgs e) { if (_connectionProvider != null) { --- 365,368 ---- *************** *** 487,507 **** public string GetConnectionString() { ! return _connectionProvider.ConnectionString(this.tbLocation.Text, this.tbName.Text, this.tbUsername.Text, this.tbPassword.Text); } public string GetInternalProviderConnectionString() { ! return _connectionProvider.InternalProviderString(this.tbLocation.Text, this.tbName.Text, this.tbUsername.Text, this.tbPassword.Text); ! } ! ! public Adapdev.Data.DbProviderType GetInternalProviderProviderType() { ! return _connectionProvider.InternalProvider.ProviderType; ! } ! ! public Adapdev.Data.DbProviderType GetDbConnectionProviderType() { ! return _connectionProvider.ProviderType; ! } ! ! public Adapdev.Data.DbType GetDbConnectionDatabaseType() { ! return _connectionProvider.DbType; } --- 474,482 ---- public string GetConnectionString() { ! return (_connectionProvider == null) ? string.Empty : _connectionProvider.ConnectionString(this.tbLocation.Text, this.tbName.Text, this.tbUsername.Text, this.tbPassword.Text); } public string GetInternalProviderConnectionString() { ! return (_connectionProvider == null) ? string.Empty : _connectionProvider.InternalProviderString(this.tbLocation.Text, this.tbName.Text, this.tbUsername.Text, this.tbPassword.Text); } *************** *** 516,520 **** _connectionProvider = _providersConfig.ConnectionTypes[settings.ConnectionRef].Providers[settings.ProviderRef]; FindConnectionInList(_connectionProvider); ! SetGUIProperties (_connectionProvider); } catch (Exception ex) { MessageBox.Show(this, "Unable to load settings. \nMessage: " + ex.Message, "Failure!", MessageBoxButtons.OK, MessageBoxIcon.Error); --- 491,495 ---- _connectionProvider = _providersConfig.ConnectionTypes[settings.ConnectionRef].Providers[settings.ProviderRef]; FindConnectionInList(_connectionProvider); ! SetGUIProperties (_connectionProvider.Parent); } catch (Exception ex) { MessageBox.Show(this, "Unable to load settings. \nMessage: " + ex.Message, "Failure!", MessageBoxButtons.OK, MessageBoxIcon.Error); *************** *** 565,592 **** /// <param name="treeView">TreeView control to populate</param> public void BuildConnectionsTree ( System.Windows.Forms.TreeView treeView) { ! foreach (DictionaryEntry entryType in this._providersConfig.ConnectionTypes) { ! DbConnectionType dbType = (DbConnectionType)entryType.Value; ! TreeNode parent = new TreeNode(dbType.Name); ! parent.Tag = null; ! parent.ImageIndex = iconDatabase; ! parent.SelectedImageIndex = iconDatabase; ! foreach (DictionaryEntry entryProvider in dbType.Providers) { ! DbConnectionProvider dbProvider = (DbConnectionProvider)entryProvider.Value; ! if (dbProvider.Enabled) { ! TreeNode child = new TreeNode(dbProvider.Name); ! child.Tag = dbProvider; ! child.ImageIndex = iconProvider; ! child.SelectedImageIndex = iconSelected; ! parent.Nodes.Add(child); } } - if (parent.Nodes.Count == 0) { - parent.ImageIndex = iconDisabled; - parent.SelectedImageIndex = iconDisabled; - } - treeView.Nodes.Add(parent); } } --- 540,569 ---- /// <param name="treeView">TreeView control to populate</param> public void BuildConnectionsTree ( System.Windows.Forms.TreeView treeView) { ! if (_providersConfig != null) { ! foreach (DictionaryEntry entryType in this._providersConfig.ConnectionTypes) { ! DbConnectionType dbType = (DbConnectionType)entryType.Value; ! TreeNode parent = new TreeNode(dbType.Name); ! parent.Tag = null; ! parent.ImageIndex = iconDatabase; ! parent.SelectedImageIndex = iconDatabase; ! foreach (DictionaryEntry entryProvider in dbType.Providers) { ! DbConnectionProvider dbProvider = (DbConnectionProvider)entryProvider.Value; ! if (dbProvider.Enabled) { ! TreeNode child = new TreeNode(dbProvider.Name); ! child.Tag = dbProvider; ! child.ImageIndex = iconProvider; ! child.SelectedImageIndex = iconSelected; ! parent.Nodes.Add(child); ! } } + if (parent.Nodes.Count == 0) { + parent.ImageIndex = iconDisabled; + parent.SelectedImageIndex = iconDisabled; + } + treeView.Nodes.Add(parent); } } } *************** *** 601,606 **** } else { _connectionProvider = obj as DbConnectionProvider; } - SetGUIProperties (_connectionProvider); } --- 578,583 ---- } else { _connectionProvider = obj as DbConnectionProvider; + if (_connectionProvider != null) SetGUIProperties (_connectionProvider.Parent); } } *************** *** 608,630 **** /// Depending on the selected Connection/Provider, sets the relevant UI controls enabled/disabled /// </summary> ! /// <param name="provider">A reference to a DbConnectionProvider instance</param> ! private void SetGUIProperties ( DbConnectionProvider provider) { ! if (provider != null) { SetPromptState(true); - if (provider.Parent.SupportsServer == true) { - this.UseDatabaseServer(); - } else { - this.UseDatabaseFile(); - } ! SetPromptLocationState(true); ! SetPromptNameState(provider.Parent.SupportsName); ! SetPromptUsernameState(provider.Parent.SupportsUserID); ! SetPromptPasswordState(provider.Parent.SupportsPassword); this.tbConnectionString.Text = GetConnectionString(); } else { SetPromptState (false); - this.UseDatabaseServer(); this.tbConnectionString.Text = String.Empty; } --- 585,603 ---- /// Depending on the selected Connection/Provider, sets the relevant UI controls enabled/disabled /// </summary> ! /// <param name="connectionType">A reference to a DbConnectionProvider instance</param> ! private void SetGUIProperties ( DbConnectionType connectionType) { ! if (connectionType != null) { ! SetPromptLabels(connectionType); SetPromptState(true); ! SetPromptState(true, this.lblLocation, this.tbLocation); ! SetPromptState(connectionType.SupportsName, this.lblName, this.tbName); ! SetPromptState(connectionType.SupportsUserID, this.lblUsername, this.tbUsername); ! SetPromptState(connectionType.SupportsPassword, this.lblPassword, this.tbPassword); this.tbConnectionString.Text = GetConnectionString(); } else { + SetPromptLabels(DbConnectionTypes.UnknownConnectionType()); SetPromptState (false); this.tbConnectionString.Text = String.Empty; } *************** *** 632,639 **** private void SetPromptState ( bool state ) { ! SetPromptLocationState (state); ! SetPromptNameState (state); ! SetPromptUsernameState (state); ! SetPromptPasswordState (state); this.btnTestConnection.Enabled = state; --- 605,612 ---- private void SetPromptState ( bool state ) { ! SetPromptState (state, this.lblLocation, this.tbLocation); ! SetPromptState (state, this.lblName, this.tbName); ! SetPromptState (state, this.lblUsername, this.tbUsername); ! SetPromptState (state, this.lblPassword, this.tbPassword); this.btnTestConnection.Enabled = state; *************** *** 642,666 **** } ! private void SetPromptLocationState ( bool state ) { ! this.tbLocation.Enabled = state; ! this.lblLocation.Enabled = state; ! } ! ! private void SetPromptNameState ( bool state ) { ! this.tbName.Enabled = state; ! this.lblName.Enabled = state; ! if (!state) this.tbName.Text = ""; ! } ! ! private void SetPromptUsernameState ( bool state ) { ! this.tbUsername.Enabled = state; ! this.lblUsername.Enabled = state; ! if (!state) this.tbUsername.Text = ""; } ! private void SetPromptPasswordState ( bool state ) { ! this.tbPassword.Enabled = state; ! this.lblPassword.Enabled = state; ! if (!state) this.tbPassword.Text = ""; } --- 615,637 ---- } ! private void SetPromptLabels(DbConnectionType connectionType) { ! if (connectionType.SupportsFile) { ! this.lblLocation.Text = connectionType.PromptFile; ! this.btnOpenFile.Visible = true; ! this.btnOpenFile.Enabled = true; ! } else { ! this.lblLocation.Text = connectionType.PromptServer; ! this.btnOpenFile.Visible = false; ! this.btnOpenFile.Enabled = false; ! } ! this.lblName.Text = connectionType.PromptName; ! this.lblUsername.Text = connectionType.PromptUserID; ! this.lblPassword.Text = connectionType.PromptPassword; } ! private void SetPromptState ( bool state, System.Windows.Forms.Label label, System.Windows.Forms.TextBox text ) { ! text.Enabled = state; ! label.Enabled = state; ! if (!state) text.Text = ""; } Index: DatabaseSetting.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms/DatabaseSetting.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DatabaseSetting.cs 12 Apr 2005 10:22:57 -0000 1.4 --- DatabaseSetting.cs 13 Apr 2005 04:23:42 -0000 1.5 *************** *** 17,20 **** --- 17,21 ---- private string refConnection; private string refProvider; + private string filter; private DbType dbType; private DbProviderType dbProviderType; *************** *** 45,48 **** --- 46,54 ---- } + public string Filter { + get { return filter; } + set { filter = value; } + } + public string ConnectionType { get { return connectionType; } Index: DatabaseWizard.resx =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms/DatabaseWizard.resx,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DatabaseWizard.resx 10 Apr 2005 09:59:22 -0000 1.2 --- DatabaseWizard.resx 13 Apr 2005 04:23:42 -0000 1.3 *************** *** 125,128 **** --- 125,131 ---- <value>Private</value> </data> + <data name="btnNewDatabase.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>Private</value> + </data> <data name="btnNewDatabase.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> *************** *** 131,137 **** <value>Private</value> </data> - <data name="btnNewDatabase.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>Private</value> - </data> <data name="btnTestConnection.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> --- 134,137 ---- *************** *** 157,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ws= </value> </data> --- 221,225 ---- AQIAAeABBwHAAQABgAEBAgAB4AEHAcABAAGAAQEBAAEBAeABBwHAAQkBgAEBAQABAwHgAQcBwAEPAYAB AQEAAQcB4AEHAcABDwGAAQEBAAEPAeABBwHAAQ8BgAEBAQABPwHgAQcBwAEPAYABAwEAAT8B4AEHAcAB ! DwGAAX8BAAE/AeABBwHAAQ8BgAF/AYABfwHwAQ8B4AEfAcAB/wHAAf8B+AEfAfABPxYACw== </value> </data> *************** *** 398,401 **** --- 398,404 ---- <value>True</value> </data> + <data name="$this.Name"> + <value>DatabaseWizard</value> + </data> <data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>80</value> *************** *** 410,416 **** <value>Private</value> </data> - <data name="$this.Name"> - <value>DatabaseWizard</value> - </data> <data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>8, 8</value> --- 413,416 ---- |