コード例 #1
0
 public void OpenTables()
 {
     LoadConnectTableParsFromFile();
     ConnectWindow cwWnd = new ConnectWindow();
     cwWnd.InitModel();
     if (cwWnd.model != null)
     {
         foreach (ConnectTableParameters parameter in listPars)
         {
             SelectedPlugin = cwWnd.model.listPlugins.FirstOrDefault(x => x.PluginName == parameter.pluginName);
             if (SelectedPlugin != null)
             {
                 if (SelectedPlugin.OpenTable(parameter.connectionString, parameter.tableName))
                 {
                     ListTablesItem list = new ListTablesItem
                     {
                         tableName = parameter.tableName,
                         serverName = parameter.dataSource,
                         fields = SelectedPlugin.listFields,
                         SelectedPlugin = SelectedPlugin,
                         database = parameter.database, 
                         //sqlConnection = SelectedPlugin.sqlConnection,
                         connectionString = parameter.connectionString
                     };
                     listTables.Add(list);
                     //sqlConnection = SelectedPlugin.sqlConnection;
                     Messenger.Default.Send<ListTablesItem>(list, "AppendTabItem");
                 }
             }
         }
     }
     cwWnd.Close();
 }
コード例 #2
0
        public void OpenTable(object parameter)
        {
            ConnectWindow cwWnd = new ConnectWindow();
            cwWnd.ShowDialog();
            if (cwWnd.model != null)
            {
                SelectedPlugin = cwWnd.model.SelectedPlugin;

                //                cwWnd.model.CreateConnectionString();
                string connectionString = cwWnd.model.CreateConnectionString();
                if (SelectedPlugin.OpenTable(connectionString, cwWnd.model.SelectedTable))
                {
                    ListTablesItem list = new ListTablesItem
                    {
                        tableName = cwWnd.model.SelectedTable,
                        serverName = cwWnd.model.connectPars.serverName,
                        fields = SelectedPlugin.listFields,
                        database = cwWnd.model.SelectedDatabase,
                        SelectedPlugin = SelectedPlugin,
                        //sqlConnection = SelectedPlugin.sqlConnection,
                        connectionString = connectionString
                    };
                    listTables.Add(list);
                    //sqlConnection = SelectedPlugin.sqlConnection;
                    Messenger.Default.Send<ListTablesItem>(list, "AppendTabItem");
                }

            }
        }