コード例 #1
0
        private void lbSentmail_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.lbSentmailAgain.Show();
            this.lbSentmail.Hide();
            System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
            mail.From = new System.Net.Mail.MailAddress("*****@*****.**");
            if (this.tbEmail.Text == "")
            {
                FError f = new FError("Enter your mail", "Message");
                f.StartPosition = FormStartPosition.CenterScreen;
                f.ShowDialog();
            }
            else
            {
                mail.To.Add(this.tbEmail.Text);
                mail.Subject = "Confirm account";
                code         = random_Digit().ToString();
                mail.Body    = code + " is your confirm code ";
                SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);

                smtp.EnableSsl   = true;
                smtp.Credentials = new NetworkCredential("*****@*****.**", "phiphucthe");

                try
                {
                    smtp.Send(mail);
                }

                catch (SmtpException ex)
                {
                    MessageBox.Show("Can't sent your mail");
                }
            }
        }
コード例 #2
0
        private void btYourFlashCard_Click(object sender, EventArgs e)
        {
            if (Data.CheckForInternetConnection())
            {
                this.pnCheck.Hide();
                this.pnStatistic.Hide();

                this.pnYourFlashCard.Visible = true;
                this.pnYourFlashCard.Dock    = DockStyle.Fill;
                List <List <string> > ls = sql.getOwnFlashCard();
                yFWord = ls[1];
                yFMean = ls[2];
                k      = 0;
                if (yFWord.Count > 0)
                {
                    btFlashCard.Text = yFWord[k];
                    btFlip.Text      = yFMean[k];
                }
                pnYourFlashCard.Show();
            }
            else
            {
                FError f = new FError("Turn on your Internet connection!", "Error");
                f.Show();
            }
        }
コード例 #3
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (Data.CheckForInternetConnection())
     {
         LoginActivity lg = new LoginActivity();
         if (lg.checkUser(tbxUsrname.Text, tbxPassword.Text) == true)
         {
             this.Hide();
             temp.formMenu = new FInterface();
             Data.username = tbxUsrname.Text;
             Data.iduser   = lg.FindID(tbxUsrname.Text).ToString();
             temp.formMenu.ShowDialog();
             this.tbxPassword.Text = "";
             this.tbxUsrname.Text  = "";
             this.Show();
         }
         else
         {
             /* FError f = new FError("Login Failed", "Message");
              * f.ShowDialog();*/
             this.tbxPassword.Text = "";
             this.tbxUsrname.Text  = "";
             this.lblWrong.Visible = true;
             return;
         }
     }
     else
     {
         FError f = new FError("Turn on your Internet connection!", "Error");
         f.Show();
     }
 }
コード例 #4
0
 private void btCheck_Click(object sender, EventArgs e)
 {
     if (Data.CheckForInternetConnection())
     {
         this.pnStatistic.Hide();
         this.pnYourFlashCard.Hide();
         this.pnCheck.Dock    = DockStyle.Fill;
         this.pnCheck.Visible = true;
         List <List <string> > st = sql.getMeanID();
         Eng          = st[0];
         Vie          = st[1];
         LinkPic      = st[2];
         id           = st[3];
         k            = 0;
         btFlip2.Text = Eng[k];
         if (st.Count > 0)
         {
             btFlashCard2.Text = Eng[k];
             pbImage.Image     = null;
             pbImage.LoadAsync(LinkPic[k]);
             this.btFlip2.Text = Eng[k];
         }
         this.pnCheck.Show();
     }
     else
     {
         FError f = new FError("Turn on your Internet connection!", "Error");
         f.Show();
     }
 }
コード例 #5
0
 private void lbForgot_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (Data.CheckForInternetConnection())
     {
         this.pnGmail.Show();
         lbSentmailAgain.Hide();
     }
     else
     {
         FError f = new FError("Turn on your Internet connection!", "Error");
         f.Show();
     }
 }
コード例 #6
0
        public bool Signup(string a, string b, string c)
        {
            if (a.Length < 6 || b.Length < 8)
            {
                FError f = new FError("Password must have more than 7 characters and Username must has more than 5 character", "Message");
                f.StartPosition = FormStartPosition.CenterScreen;
                f.ShowDialog();
                return(false);
            }
            if (findUser(a) == true)
            {
                FError f = new FError("Username were used", "Message");
                f.StartPosition = FormStartPosition.CenterScreen;
                f.ShowDialog();
                return(false);
            }
            if (checkEmail(c) == true)
            {
                FError f = new FError("Email were used", "Message");
                f.StartPosition = FormStartPosition.CenterScreen;
                f.ShowDialog();
                return(false);
            }
            SqlConnection connection = new SqlConnection(connString);

            try
            {
                string statement = "insert into USERINFO(username, hashPass,email) values ("
                                   + "'" + a + "'," + "'" + HashPassword(b) + "','" + c + "')";
                connection.Open();
                SqlCommand command = new SqlCommand(statement, connection);
                command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                FError f = new FError("Connection or data reader failed", "Error");
                f.StartPosition = FormStartPosition.CenterScreen;
                f.ShowDialog();
                return(false);
            }
            finally
            {
                connection.Close();
            }
            return(true);
        }
コード例 #7
0
        private void btnSignUp_Click(object sender, EventArgs e)
        {
            if (Data.CheckForInternetConnection())
            {
                FSignUp f = new FSignUp();
                f.ShowDialog();

                this.tbxPassword.Text = "";
                this.tbxUsrname.Text  = "";
                this.lblWrong.Visible = false;
            }
            else
            {
                FError f = new FError("Turn on your Internet connection!", "Error");
                f.Show();
            }
        }
コード例 #8
0
        private void btnDone_Click(object sender, EventArgs e)
        {
            if (Data.CheckForInternetConnection())
            {
                FPreviewNewWord tabLearnNewWord = new FPreviewNewWord();
                tabLearnNewWord.AutoScroll = true;
                tabLearnNewWord.TopLevel   = false;
                root.Controls.Clear();
                root.Controls.Add(tabLearnNewWord);

                tabLearnNewWord.FormBorderStyle = FormBorderStyle.None;
                tabLearnNewWord.Show();
                root.Visible = true;
            }
            else
            {
                FError f = new FError("Turn on your Internet connection!", "Error");
                f.Show();
            }
        }
コード例 #9
0
 private void btFind1_Click(object sender, EventArgs e)
 {
     if (!Data.CheckForInternetConnection())
     {
         FError f = new FError("Turn on your Internet connection!", "Error");
         f.Show();
     }
     else
     {
         this.rtbMean1.Text = sql.Decription2(this.tbWord1.Text);
         if (this.rtbMean1.Text == "")
         {
             this.rtbMean1.Text = "Không tìm thấy từ được nhập";
         }
         else
         {
             this.btspeaker2.Visible = true;
         }
     }
 }
コード例 #10
0
        //Game giet boss
        private void guna2Button2_Click(object sender, EventArgs e)
        {
            if (Data.CheckForInternetConnection())
            {
                GWordConnection game = new GWordConnection();
                game.AutoScroll = true;
                game.TopLevel   = false;
                pnlLoad.Controls.Clear();
                pnlLoad.Controls.Add(game);

                game.FormBorderStyle = FormBorderStyle.None;
                game.Show();
                pnlLoad.Visible = true;
            }
            else
            {
                FError f = new FError("Turn on your Internet connection!", "Error");
                f.Show();
            }
        }
コード例 #11
0
        private void btFind_Click(object sender, EventArgs e)
        {
            if (!Data.CheckForInternetConnection())
            {
                FError f = new FError("Turn on your Internet connection!", "Error");
                f.Show();
            }
            else
            {
                this.rtbMean.Text = "";
                if (tbWord.Text == "")
                {
                    return;
                }
                this.lbPronuciation.Visible = false;
                this.btSpeaker.Visible      = false;

                string mean;
                if (isEng == true)
                {
                    mean = wa.onlineDict(tbWord.Text);
                }
                else
                {
                    mean = wa.VieToEng(tbWord.Text);
                }
                if (mean == "")
                {
                    this.rtbMean.Text = "Không tìm thấy từ được nhập";
                    return;
                }
                this.btSpeaker.Visible = true;
                this.rtbMean.Text      = mean;
                if (mean.IndexOf("Means: ") == -1)
                {
                    return;
                }
                this.btMakeFlashCard.Visible = true;
                this.btMakeFlashCard.Enabled = true;
            }
        }
コード例 #12
0
 private void btnCategory_Click(object sender, EventArgs e)
 {
     if (Data.CheckForInternetConnection())
     {
         G_RPG game = new G_RPG();
         game.AutoScroll = true;
         game.TopLevel   = false;
         pnlLoad.Controls.Clear();
         pnlLoad.Controls.Add(game);
         pnlLoad.Dock         = DockStyle.Fill;
         game.FormBorderStyle = FormBorderStyle.None;
         game.Show();
         pnlLoad.Visible     = true;
         this.label1.Visible = false;
     }
     else
     {
         FError f = new FError("Turn on your Internet connection!", "Error");
         f.Show();
     }
 }
コード例 #13
0
        private void btnMultipleChoices_Click(object sender, EventArgs e)
        {
            if (Data.CheckForInternetConnection())
            {
                FPreviewNewWord tabPreviewNewWord = new FPreviewNewWord();
                tabPreviewNewWord.AutoScroll = true;
                tabPreviewNewWord.TopLevel   = false;
                pnlLoad.Controls.Clear();
                pnlLoad.Controls.Add(tabPreviewNewWord);

                tabPreviewNewWord.FormBorderStyle = FormBorderStyle.None;
                tabPreviewNewWord.Show();
                pnlLoad.Dock        = DockStyle.Fill;
                pnlLoad.Visible     = true;
                this.label1.Visible = false;
            }
            else
            {
                FError f = new FError("Turn on your Internet connection!", "Error");
                f.Show();
            }
        }
コード例 #14
0
 private void btnSignup_Click(object sender, EventArgs e)
 {
     if (Data.CheckForInternetConnection())
     {
         if (this.tbCode.Text != code)
         {
             FError f = new FError(" Code confirm was wrong", "Message");
             f.StartPosition = FormStartPosition.CenterScreen;
             f.ShowDialog();
         }
         else if (!tbxRepeatPass.Text.Equals(tbxPass.Text))
         {
             FError f = new FError("Password and repeat password are not match ", "Message");
             f.StartPosition = FormStartPosition.CenterScreen;
             f.ShowDialog();
         }
         else if (tbEmail.Text == "" || tbEmail.Text.IndexOf("@gmail.com") == -1)
         {
             FError f = new FError("Email is not valid", "Message");
             f.StartPosition = FormStartPosition.CenterScreen;
             f.ShowDialog();
         }
         else
         {
             LoginActivity lg = new LoginActivity();
             if (lg.Signup(tbxUsername.Text, tbxPass.Text, tbEmail.Text))
             {
                 MessageBox.Show("Sign up succesfully!", "Congratulation!");
                 this.Hide();
                 this.Close();
             }
         }
     }
     else
     {
         FError f = new FError("Turn on your Internet connection!", "Error");
         f.Show();
     }
 }
コード例 #15
0
 private void btRePass_Click(object sender, EventArgs e)
 {
     if (Data.CheckForInternetConnection())
     {
         if (this.tbNewpass.Text == this.tbCNewpass.Text)
         {
             login.ChangePassword(tbCNewpass.Text);
             this.pnGmail.Hide();
             this.pnNewPass.Hide();
             MessageBox.Show("Dat lai mat khau thanh cong!");
         }
         else
         {
             MessageBox.Show("Nhap lai mat khau khong chinh xac!");
         }
     }
     else
     {
         FError f = new FError("Turn on your Internet connection!", "Error");
         f.Show();
     }
 }
コード例 #16
0
        private void btnTestTab_Click(object sender, EventArgs e)
        {
            if (Data.CheckForInternetConnection())
            {
                tabVideo.Close();
                tabMusic.Close();
                videoSelected.Visible = false;
                musicSelected.Visible = false;
                testSelected.Visible  = true;

                tabTest          = new FListingTest();
                tabTest.TopLevel = false;
                pnlLoadForm.Controls.Clear();
                pnlLoadForm.Controls.Add(tabTest);
                tabTest.FormBorderStyle = FormBorderStyle.None;
                tabTest.Show();
            }
            else
            {
                FError f = new FError("Turn on your Internet connection!", "Error");
                f.Show();
            }
        }
コード例 #17
0
        private void btLearnNewWord_Click(object sender, EventArgs e)
        {
            if (Data.CheckForInternetConnection())
            {
                this.pnCheck.Hide();
                this.pnStatistic.Hide();
                pnYourFlashCard.Hide();
                FPreviewNewWord tabLearnNewWord = new FPreviewNewWord();
                tabLearnNewWord.AutoScroll = true;
                tabLearnNewWord.TopLevel   = false;
                pnlLoad.Controls.Clear();
                pnlLoad.Controls.Add(tabLearnNewWord);

                tabLearnNewWord.FormBorderStyle = FormBorderStyle.None;
                tabLearnNewWord.Show();
                pnlLoad.Visible = true;
            }
            else
            {
                FError f = new FError("Turn on your Internet connection!", "Error");
                f.Show();
            }
        }
コード例 #18
0
 private void btConfirm_Click(object sender, EventArgs e)
 {
     if (Data.CheckForInternetConnection())
     {
         if (code == tbCode.Text)
         {
             pnNewPass.Show();
             this.lblUserName.Text = "Hello " + login.CheckUserNameFromMail(tbEmail.Text) + " !";
             Data.username         = login.CheckUserNameFromMail(tbEmail.Text);
         }
         else
         {
             FError f = new FError(" Code confirm was wrong", "Message");
             f.StartPosition = FormStartPosition.CenterScreen;
             f.ShowDialog();
         }
     }
     else
     {
         FError f = new FError("Turn on your Internet connection!", "Error");
         f.Show();
     }
 }
コード例 #19
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            this.btnSend.Enabled = false;
            System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
            mail.From = new System.Net.Mail.MailAddress("*****@*****.**");
            try
            {
                mail.To.Add("*****@*****.**");
                mail.Subject = "Report";

                mail.Body = tbReport.Text + "\n from user: "******"smtp.gmail.com", 587);

                smtp.EnableSsl   = true;
                smtp.Credentials = new NetworkCredential("*****@*****.**", "phiphucthe");

                try
                {
                    smtp.Send(mail);
                }

                catch (SmtpException ex)
                {
                    MessageBox.Show("Can't sent your mail");
                }
            }
            catch
            {
                FError f = new FError("Your gmail was wrong", "Message");
                f.StartPosition = FormStartPosition.CenterScreen;
                f.ShowDialog();
            }
            finally
            {
                this.Close();
            }
        }