Exemplo n.º 1
0
        private void Confirm_But_Click(object sender, EventArgs e)
        {
            // Проверка валидности
            if (IsValid(Login_TextBox.Text, Password_MTextBox.Text) == false) return;

            // Открытие главной формы
            MainForm mainForm = new MainForm();
            mainForm.Show();
            this.Close();
        }
Exemplo n.º 2
0
        // Подтверждение регистрации
        private void button1_Click(object sender, EventArgs e)
        {
            // Проверка валидности
            if (IsValid(Login_TextBox.Text, Name_TextBox.Text, Surname_TextBox.Text, Email_TextBox.Text, Password_MTextBox.Text, PasswordConfirm_MTextBox.Text) == false) return;
            // Обнуление id пользователя
            MainData.userID = -1;
            // Запись данных о пользователе в БД
            using (SqlConnection con = new SqlConnection("Data Source=192.168.1.65,1433;Initial Catalog=Test;User ID=Ragen; Password=utg1df25fu"))
            {
                con.Open();
                using (SqlCommand com = con.CreateCommand())
                {

                    var login = Login_TextBox.Text;
                    var name = Name_TextBox.Text;
                    var surname = Surname_TextBox.Text;
                    name = Capitalize(name);
                    surname = Capitalize(surname);
                    var email = Email_TextBox.Text;
                    var password = Password_MTextBox.Text;
                    com.CommandText = string.Format("INSERT INTO Accounts(Login, Name, Surname, Email, Password, IncMessagesInd, SentMessagesInd) VALUES('{0}', '{1}', '{2}', '{3}', '{4}', 0, 0)",
                                                    login, name, surname, email, password);
                    com.CommandType = CommandType.Text;
                    com.ExecuteNonQuery();
                    // Выборка id пользователя
                    com.CommandText = string.Format("SELECT ID FROM Accounts WHERE Login = '******'",
                                                    login);
                    com.CommandType = CommandType.Text;
                    SqlDataReader reader = com.ExecuteReader();
                    while (reader.Read())
                    {
                        MainData.userID = reader.GetInt32(0);
                    }
                    reader.Close();
                    com.ExecuteNonQuery();
                }
                con.Close();
            }
            // Открытие MainForm
            MainForm mainForm = new MainForm();
            this.Hide();
            mainForm.Show();
        }
Exemplo n.º 3
0
        static void Main()
        {
            Application.ThreadException += applicationThreadException;
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            AppDomain.CurrentDomain.UnhandledException += currentDomainUnhandledException;

            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                var form = new MainForm();

                WinHook.OnDoubleCick = form.OnMouseDblClick;
                WinHook.Init();

                Application.Run(form);
            }
            catch (Exception e)
            {
                doHandleException(e);
            }
        }
Exemplo n.º 4
0
 public MainForm()
 {
     classMainForm = this;
     InitializeComponent();
 }