Esempio n. 1
0
        private async void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string key = System.IO.File.ReadAllText("docs\\key.txt");
                user = user_comboBox.Text;

                user_global = user_comboBox.Text;

                if (key == "yoq")
                {
                    timer1.Stop();
                    sql.myReader = sql.return_MySqlCommand("select password from users where user = '******' ").ExecuteReader();
                    while (sql.myReader.Read())
                    {
                        if (pasword_textBox.Text.ToString().Equals(sql.myReader.GetString("password")))
                        {
                            this.Hide();
                            splashForm = new ZagruzkaPage();
                            ////splashForm.WindowState = FormWindowState.Maximized;
                            splashForm.Show();
                            ////Thread thread = new Thread(CreateLoading);
                            ////thread.Start();
                            await Task.Run(() =>
                            {
                                main = new Main(user);
                            });

                            splashForm.Close();
                            splashForm.Dispose();
                            splashForm = null;

                            //thread.Abort();
                            main.ShowDialog();
                        }
                    }
                    sql.myReader.Close();
                    this.Show();
                }
                else if (key == "bor")
                {
                    ManagementObjectSearcher theSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_PnPEntity WHERE caption='eKalit'");
                    if (theSearcher.Get().Count > 0)
                    {
                    }
                    else
                    {
                        errorLabel.Text = "Калит мавжут эмас!!!";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Кириш " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }
Esempio n. 2
0
        static void CloseSplashScreen()
        {
            try
            {
                if (splashForm == null)
                {
                    return;
                }

                splashForm.Invoke(new Action(splashForm.Close));
                splashForm.Dispose();
                splashForm = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Program 2: " + ex.Message);
            }
        }