コード例 #1
0
 public LogInForm(ProfileForm PForm)
 {
     InitializeComponent();
     this.PForm     = PForm;
     con            = new SqlCeConnection(@"Data Source=App_Data\Database.sdf");
     picture        = new SqlCeParameter("@picture", SqlDbType.Image);
     cmd.Connection = con;
     happy.PlayLooping();
 }
コード例 #2
0
        private void lblMenu_Click(object sender, EventArgs e)
        {
            ProfileForm pf = new ProfileForm(null, this);

            pf.MdiParent = MForm.MdiParent;
            pf.Show();
            pf.Location = new Point(0, 0);
            MForm.Close();
        }
コード例 #3
0
        /// <summary>
        /// логирање доколку играчот има постоечки акаунт + база на податоци.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLogIn_Click(object sender, EventArgs e)
        {
            string userName = tbUsername.Text;

            Username = tbUsername.Text;
            string password = tbPass.Text;

            if (tbUsername.Text == "" && tbPass.Text == "")
            {
                MessageBox.Show("Enter username or password");
                flag = true;
            }
            else
            {
                string query = "SELECT * FROM PlayerTable WHERE username = '******'";
                cmd = new SqlCeCommand(query, con);

                con.Open();
                try
                {
                    rdr = cmd.ExecuteReader();
                    rdr.Read();


                    string probaUser = rdr[0].ToString().Trim();
                    string probaPass = rdr[1].ToString().Trim();

                    con.Close();
                    //погрешна лозинка
                    if (userName.Equals(probaUser.ToString()) && !password.Equals(probaPass.ToString()))
                    {
                        MessageBox.Show("The password is incorrect.");
                        tbPass.Select(0, tbPass.Text.Length);
                    }

                    // се е во ред.
                    else
                    {
                        ProfileForm PF = new ProfileForm(this, null);
                        PF.MdiParent = this.MdiParent;
                        PF.Show();
                        PF.Location = new Point(0, 0);
                    }
                }
                catch
                {
                    if (!flag)
                    {
                        MessageBox.Show("The user name or password is incorrect.");
                    }
                    tbUsername.Select(0, tbUsername.Text.Length);
                }
            }
        }
コード例 #4
0
 public LevelChooserForm(ProfileForm PForm, MainForm MForm)
 {
     InitializeComponent();
     this.PForm = PForm;
     this.MForm = MForm;
 }