コード例 #1
0
        public MainWindow()
        {

            InitializeComponent();
            Label labelStar = base.GetTemplateChild("PART_Label") as Label;

            connectionString = ConfigurationManager.AppSettings["DefaultDBConn"]; //System.Configuration.ConfigurationSettings.AppSettings["FastDBConn"];
            CurrentDatabaseName = ConfigurationManager.AppSettings["DefaultDatabase"];

            connectionString = connectionString + "Database=" + CurrentDatabaseName + ";";
            InitializeComponent();
            this.WindowState = WindowState.Maximized;
            //add handler for CloseTabItem closeTabEvent
            this.AddHandler(CloseableTabItem.CloseTabEvent, new RoutedEventHandler(this.CloseTab));
            //binding Left side panel The tree view for all table

            try
            {
                List<Schema> schemas = MySQLData.DataAccess.ADODataBridge.getSchemaTree(connectionString, CurrentDatabaseName, ConfigurationManager.AppSettings["DerivedTablesPath"]);//DataAccess.GetDatabases();
                MainViewModel viewModel = new MainViewModel(schemas);
                this.MainTreeView.DataContext = viewModel;
                //binding customequery From tab
                //listOfTable = MySQLData.DataAccess.ADODataBridge.getTableStructure(connectionString, CurrentDatabaseName);
                listOfTable = new List<MySQLData.Table>();
                foreach (Schema schema in schemas)
                {
                    listOfTable.AddRange(schema.tables);
                }
                if (listOfTable != null)
                {
                    //this.FromTabUC.cmbFromTable.ItemsSource = Common.ConvertTablesToStringList(listOfTable);//svm.Children;   //zahed

                }

            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                if (isErrorLoggingOn)
                {
                    LogError.Log_Err("MainWindow Constructor", ex);
                    DisplayErrorMessage();
                }
            }
            catch (Exception ex)
            {
                if (isErrorLoggingOn)
                {
                    LogError.Log_Err("MainWindow Constructor", ex);
                    DisplayErrorMessage();
                }
            }
            var collView = CollectionViewSource.GetDefaultView(this.tabControlCustomQuery.Items);

            collView.CurrentChanging += this.OnTabItemSelecting;
        }
コード例 #2
0
ファイル: Window1.xaml.cs プロジェクト: mukeshdepani/ParaRD
        public Window1(Control.ResultViewControl resultControl)
        {
            resultControlInit = resultControl;
            InitializeComponent();
            CenterWindowOnScreen();
            connectionString = ConfigurationManager.AppSettings["DefaultDBConn"]; //System.Configuration.ConfigurationSettings.AppSettings["FastDBConn"];
            CurrentDatabaseName = ConfigurationManager.AppSettings["DefaultDatabase"];

            connectionString = connectionString + "Database=" + CurrentDatabaseName + ";";
            MainWindow m = new MainWindow();
            try
            {
                List<Schema> schemas = MySQLData.DataAccess.ADODataBridge.getSchemaTree(connectionString, CurrentDatabaseName, ConfigurationManager.AppSettings["DerivedTablesPath"]);//DataAccess.GetDatabases();
                MainViewModel viewModel = new MainViewModel(schemas);
                
                m.MainTreeView.DataContext = viewModel;
                listOfTable = new List<MySQLData.Table>();
                foreach (Schema schema in schemas)
                {
                    listOfTable.AddRange(schema.tables);
                }
                if (listOfTable != null)
                {

                }

            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                if (isErrorLoggingOn)
                {
                    LogError.Log_Err("MainWindow Constructor", ex);
                    DisplayErrorMessage();
                }
            }
            catch (Exception ex)
            {
                if (isErrorLoggingOn)
                {
                    LogError.Log_Err("MainWindow Constructor", ex);
                    DisplayErrorMessage();
                }
            }
            var collView = CollectionViewSource.GetDefaultView(m.tabControlCustomQuery.Items);
            collView.CurrentChanging +=  this.OnTabItemSelecting;

        }