Esempio n. 1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            bool layoutLoadedSuccessfully = true;

            //AppSettings.Default.MySqlConnection = new MySqlConnection();
            //AppSettings.Default.MySqlConnection.OnConnectionStateChangedEvent += MySqlConn__OnConnectionStateChangedEvent;
            //AppSettings.Default.MySqlConnection.OnInfoMessage += mySqlConn__OnInfoMessage;

            Assembly        assembly = Assembly.GetExecutingAssembly();
            FileVersionInfo fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);

            this.Text = string.Format("{0} - {1}", this.Text, fvi.FileVersion);

            // Docking Windows

            this.DatabaseBrowserDockForm     = new DatabaseBrowserDockForm(ref mySqlServer1);
            this.SqlServerPropertiesDockForm = new SqlServerPropertiesDockForm(ref mySqlServer1);
            this.PropertiesDockForm          = new PropertiesDockForm();
            this.ChildrenSummaryDockForm     = new ChildrenSummaryDockForm();
            this.DataPreviewDockForm         = new DataPreviewDockForm(ref mySqlServer1);
            this.ObjectDefinitionDockForm    = new ObjectDefinitionDockForm(ref mySqlServer1);
            this.OutputDockForm     = new OutputDockForm();
            this.TopObjectsDockForm = new TopObjectsDockForm(ref mySqlServer1);


            var mf = this;

            this.StartDockForm = new StartDockForm(ref mf);

            try
            {
                // Load saved layout
                var xml = TempFolder.GetPath("DockPanelLayout", "xml", false);
                DeserializeDockContent ddc = GetContentFromPersistString;
                this.dockPanel.LoadFromXml(xml, ddc);
            }
            catch { layoutLoadedSuccessfully = false; }

            if (!this.dockPanel.Contains(this.DatabaseBrowserDockForm))
            {
                this.DatabaseBrowserDockForm.Show(this.dockPanel, DockState.DockLeft);
            }

            if (!this.dockPanel.Contains(this.SqlServerPropertiesDockForm))
            {
                this.SqlServerPropertiesDockForm.Show(this.dockPanel, DockState.DockRight);
            }

            if (!this.dockPanel.Contains(this.PropertiesDockForm))
            {
                this.PropertiesDockForm.Show(this.dockPanel, DockState.DockRight);
            }

            if (!this.dockPanel.Contains(this.ChildrenSummaryDockForm))
            {
                this.ChildrenSummaryDockForm.Show(this.dockPanel, DockState.DockRight);
            }

            if (!this.dockPanel.Contains(this.DataPreviewDockForm))
            {
                this.DataPreviewDockForm.Show(this.dockPanel, DockState.DockRight);
            }

            if (!this.dockPanel.Contains(this.ObjectDefinitionDockForm))
            {
                this.ObjectDefinitionDockForm.Show(this.dockPanel, DockState.DockBottom);
            }

            if (!this.dockPanel.Contains(this.OutputDockForm))
            {
                this.OutputDockForm.Show(this.dockPanel, DockState.DockBottom);
            }

            if (!this.dockPanel.Contains(this.TopObjectsDockForm))
            {
                this.TopObjectsDockForm.Show(this.dockPanel, DockState.DockBottom);
            }


            this.StartDockForm.Show(this.dockPanel, DockState.Document);

            if (!layoutLoadedSuccessfully)
            {
                PropertiesDockForm.Show();
                OutputDockForm.Show();
            }

            MyOutput.Initialize(ref this.OutputDockForm);
            MyOutput.NewMessage(EOutputMessageType.INFORMATION, "Application started.");
        }
 public static void Initialize(ref OutputDockForm outputDockForm)
 {
     _outputDockForm = outputDockForm;
     _isInitialized  = true;
 }