Ejemplo n.º 1
0
        private void InformationConnection(bool value)  //проверка подключения к базе данных
        {
            try
            {
                Action action = () =>
                {
                    switch (value)
                    {
                    case (true):
                        lbsstConnection.Text = RegistryData.DataSourceIP + "\\" + RegistryData.DataSourceServerName + " - " + RegistryData.InitialCatalog;
                        AuthorizationForm authorizationForm = new AuthorizationForm();
                        authorizationForm.Show(this);
                        break;

                    case (false):
                        lbsstConnection.Text = MessageUser.NoConnection;

                        foreach (Form f in Application.OpenForms)
                        {
                            if (f.Name == "ConnectionForm")
                            {
                                return;
                            }
                        }

                        ConnectionForm connectionForm = new ConnectionForm();
                        connectionForm.Show(this);
                        break;
                    }
                };
                Invoke(action);
            }
            catch
            {
                threadCheckConnection.Abort();
            }
        }
Ejemplo n.º 2
0
        private void miSettingConnection_Click(object sender, EventArgs e)  //открытие окна настройки подключения к БД
        {
            ConnectionForm connectionFormOpen = new ConnectionForm();

            connectionFormOpen.Show(this);
        }