Datei: Provider/MySqlConnectorProvider/MySqlConnectorUISupport/MySqlConnectorUIProvider.cs

Last Commit (4b01a93)
1 -- File didn't exist --
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
New Commit (e404055)
1 using NDO.UISupport;
2 using System;
3 using System.Windows.Forms;
4
5 namespace MySqlConnectorUISupport
6 {
7 ····public class MySqlConnectorUIProvider : DbUISupportBase
8 ····{
9 ········public override string Name => "MySqlConnector";
10
11 ········public override NdoDialogResult ShowCreateDbDialog( ref object necessaryData )
12 ········{
13 ············NDOCreateDbParameter par;
14 ············if (necessaryData == null)
15 ················par = new NDOCreateDbParameter( string.Empty, "Data Source=localhost;User Id=root;" );
16 ············else
17 ················par = necessaryData as NDOCreateDbParameter;
18 ············if (par == null)
19 ················throw new ArgumentException( "MySql provider: parameter type " + necessaryData.GetType().FullName + " is wrong.", "necessaryData" );
20 ············if (par.ConnectionString == null || par.ConnectionString == string.Empty)
21 ················par.ConnectionString = "Data Source=localhost;User Id=root";
22 ············ConnectionDialog dlg = new ConnectionDialog( par.ConnectionString, true );
23 ············if (dlg.ShowDialog() == DialogResult.Cancel)
24 ················return NdoDialogResult.Cancel;
25 ············par.ConnectionString = dlg.ConnectionString;
26 ············par.DatabaseName = dlg.Database;
27 ············necessaryData = par;
28 ············return NdoDialogResult.OK;
29 ········}
30
31 ········public override NdoDialogResult ShowConnectionDialog( ref string connectionString )
32 ········{
33 ············ConnectionDialog dlg = new ConnectionDialog( connectionString, false );
34 ············if (dlg.ShowDialog() == DialogResult.Cancel)
35 ················return NdoDialogResult.Cancel;
36 ············connectionString = dlg.ConnectionString;
37 ············return NdoDialogResult.OK;
38 ········}
39
40 ········public override string CreateDatabase( object necessaryData )
41 ········{
42 ············// Don't need to check, if type is OK, since that happens in CreateDatabase
43 ············NDOCreateDbParameter par = necessaryData as NDOCreateDbParameter;
44
45 ············return EnsureProvider().CreateDatabase( par.DatabaseName, par.ConnectionString );
46 ········}
47 ····}
48 }
49