Beispiel #1
0
        private void showForm(Form sms)
        {
            sms.TopLevel        = false;
            sms.AutoScroll      = true;
            sms.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            sms.WindowState     = FormWindowState.Maximized;
            sms_dashboard_v2 dash = new sms_dashboard_v2();

            //dash.panelFrom.Controls.Clear();
            //dash.panelFrom.Controls.Add(sms);
            sms.Show();
        }
Beispiel #2
0
        private void btnlogin_Click(object sender, EventArgs e)
        {
            //Checks if the user exist 'username' + '.txt'
            if (!File.Exists(@"C:\SMS\" + txtusername.Text + ".ini"))
            {
                //If not exists the set a error
                //NOTE: err = errorprovider
                errorProvider1.SetError(txtusername, "User does not exist"); //sets the error
            }
            // If it exists
            else
            {
                //Clear the errors
                errorProvider1.SetError(txtusername, "");
                errorProvider1.SetError(txtpassword, "");

                //Read the text file
                TextReader tr = new StreamReader(@"C:\SMS\" + txtusername.Text + ".ini");

                //Read the password wich is stored on the first line
                string pass = tr.ReadLine();

                //CHecks if the password equal to the password in the textbox
                if (pass == txtpassword.Text)
                {
                    //If so the show the app and hide this one
                    Settings.Default.StaffName = txtusername.Text;
                    Settings.Default.Position  = txtpassword.Text;
                    Settings.Default.Save();
                    sms_dashboard_v2 sms = new sms_dashboard_v2();
                    sms.Show();
                    this.Hide();
                }
                //Else
                else
                {
                    //Show error
                    errorProvider1.SetError(txtpassword, "Incorrect password");
                }
            }
        }