Пример #1
0
        private void InformationConnection(bool value)  //проверка подключения к базе данных
        {
            try
            {
                Action action = () =>
                {
                    switch (value)
                    {
                    case (true):
                        lbsstConnection.Text = Registry_Class.DataSource + "\\" + Registry_Class.DSServerName + " - " + Registry_Class.InitialCatalog;
                        AuthorizationForm authorizationForm = new AuthorizationForm();
                        authorizationForm.Show();
                        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
            {
                threadConnection.Abort();
            }
        }
Пример #2
0
        private void settingConnectionForm_Click(object sender, EventArgs e)
        {
            ConnectionForm connectionFormOpen = new ConnectionForm();

            connectionFormOpen.Show(this);
        }