Ejemplo n.º 1
0
        public bool LoadConnectionSettings()
        {
            string connstr = (string)ConfigurationManager.AppSettings["connection"];

            if (connstr != null)
            {
                // connect to database through connection string set in the App.config
                try
                {
                    appDB = new AppDBMySQL(connstr);

                    // AppDB = new AppDBDummy(connstr);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                    return(false);
                }
            }
            else
            {
                connstr = (string)ConfigurationManager.AppSettings["connectionsqlite"];
                try
                {
                    appDB = new AppDBSQLite(connstr);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 2
0
        public bool LoadConnectionSettings()
        {
            string connstr = (string)ConfigurationManager.AppSettings["connection"];
            if (connstr != null)
            {
                // connect to database through connection string set in the App.config
                try
                {
                    appDB = new AppDBMySQL(connstr);

                    // AppDB = new AppDBDummy(connstr);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                    return false;
                }
            }
            else
            {
                connstr = (string)ConfigurationManager.AppSettings["connectionsqlite"];
                try
                {
                    appDB = new AppDBSQLite(connstr);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                    return false;
                }
            }

            return true;
        }
        /// <summary>
        /// Initialize some Tab related things to align.
        /// </summary>
        public void Initialize(IAppDBServersAndQueries appDB, long serverId)
        {
            this.appDB = appDB;
            this.connectionId = serverId;

            btnAddQuery.IsEnabled = (appDB is IAppDBEditableQueries);

            var what = Content as Grid;
            what.Margin = new Thickness(0, 0, 0, 0);
            what.HorizontalAlignment = HorizontalAlignment.Stretch;
            what.VerticalAlignment = VerticalAlignment.Stretch;

            Reload();
        }
        /// <summary>
        /// Initialize some Tab related things to align.
        /// </summary>
        public void Initialize(IAppDBServersAndQueries appDB, long serverId)
        {
            this.appDB        = appDB;
            this.connectionId = serverId;

            btnAddQuery.IsEnabled = (appDB is IAppDBEditableQueries);

            var what = Content as Grid;

            what.Margin = new Thickness(0, 0, 0, 0);
            what.HorizontalAlignment = HorizontalAlignment.Stretch;
            what.VerticalAlignment   = VerticalAlignment.Stretch;

            Reload();
        }