当前位置: 首页>>代码示例>>C#>>正文


C# MainMenu.ShowDialog方法代码示例

本文整理汇总了C#中MainMenu.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# MainMenu.ShowDialog方法的具体用法?C# MainMenu.ShowDialog怎么用?C# MainMenu.ShowDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MainMenu的用法示例。


在下文中一共展示了MainMenu.ShowDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnLogin_Click

 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (UsuarioBox.Text == null | PassBox.Text == null)
     {
         MessageBox.Show("Por favor llene ambos campos");
     }
     else
     {
         string user;
         string pass;
         user = UsuarioBox.Text;
         pass = PassBox.Text;
         if (ConfirmarLogin(user, pass))
         {
             MainMenu mm = new MainMenu();
             mm.ShowDialog();
             this.Hide();
         }
         else
         {
             MessageBox.Show("Credenciales inválidos");
             UsuarioBox.Focus();
         }
     }
 }
开发者ID:fgortiz,项目名称:unapecbiblios,代码行数:25,代码来源:Login.cs

示例2: button1_Click

 private void button1_Click(object sender, EventArgs e)
 {
     SqlConnection con = new SqlConnection("Data Source=DESKTOP-PDO5AM4\\SQLExpress;Initial Catalog=SoundSystem;Integrated Security=True");
     con.Open();
     SqlCommand cmd = new SqlCommand("Data_Entry", con);
     cmd.CommandType = CommandType.StoredProcedure;
     SqlParameter email = new SqlParameter("@mail", textBox1.Text);
     cmd.Parameters.Add(email);
     SqlParameter pass = new SqlParameter("@pass", textBox2.Text);
     cmd.Parameters.Add(pass);
     SqlDataReader reader = cmd.ExecuteReader();
     if (reader.Read())
     {
         string name = (string)reader[0];
         Globals.email = textBox1.Text;
         MessageBox.Show("Welcome " + name);
         this.Hide();
         MainMenu main = new MainMenu(name,textBox1.Text);
         main.ShowDialog();
         this.Close();
     }
     else
         MessageBox.Show("Invalid email or password!");
     reader.Close();
     con.Close();
 }
开发者ID:BitHashTech,项目名称:IS-Music-System,代码行数:26,代码来源:Login.cs

示例3: LoginButton_Click

 private void LoginButton_Click(object sender, EventArgs e)
 {
     try
     {
         var username = this.UsernameField.Text;
         var password = this.PasswordField.Text;
         Program.infoController.LoginPlayer(username, password);
         this.Hide();
         var mainPage = new MainMenu();
         mainPage.ShowDialog();
     }
     catch (FaultException<InvalidUsernameFault>)
     {
         MessageBox.Show("Invalid username.");
     }
     catch (FaultException<InvalidPasswordFault>)
     {
         MessageBox.Show("Invalid password.");
     }
     catch (CommunicationException)
     {
         MessageBox.Show("Unable to connect to server!\nPlease try again Later.");
     }
     catch (Exception ex)
     {
         MessageBox.Show("Unforseen error!, " + ex.Message);
     }
 }
开发者ID:emactaggart,项目名称:CS476,代码行数:28,代码来源:StartupPage.cs

示例4: Submit_btn_Click

 //submit selection
 private void Submit_btn_Click(object sender, EventArgs e)
 {
     server.regAdvisors(selectedAdvisors.ToArray(), playerId);
     this.Hide();
     MainMenu mainManuForm = new MainMenu(this, server, playerId);
     mainManuForm.ShowDialog();
     this.Close();
 }
开发者ID:MatanShulman,项目名称:TiacTacToe,代码行数:9,代码来源:adviserForm.cs

示例5: ExitGame

 private void ExitGame()
 {
     Dispose();
     UpdateTimer.Enabled = false;
     _state = new BasicObserver<MatchState>();
     _gameOver = false;
     var mainMenu = new MainMenu();
     mainMenu.ShowDialog();
 }
开发者ID:emactaggart,项目名称:CS476,代码行数:9,代码来源:TicTacToePage.cs

示例6: loginBtn_Click

        //When logged in, goes to Main Menu
        private void loginBtn_Click(object sender, EventArgs e)
        {
            MySqlConnection connection = new MySqlConnection(connectionStr);
            try
            {
                String cmdString = "SELECT FirstName, LastName, ClassSection FROM teacherlogin WHERE Username='" + this.userTextBox.Text + "' AND Password='" + this.passTextBox.Text + "'";
                MySqlCommand cmd = new MySqlCommand(cmdString, connection);
                MySqlDataReader reader;
                connection.Open();

                reader = cmd.ExecuteReader();

                int count = 0;

                while(reader.Read())
                {
                    count++;
                }

                if(count == 1)
                {
                    String name = reader.GetString(0) + " " + reader.GetString(1);
                    String classSection = reader.GetString(2);
                    MainMenu main = new MainMenu(name, classSection);
                    this.Hide();
                    main.ShowDialog();
                    //MessageBox.Show(reader.GetString(0) + " " + reader.GetString(1));
                }
                else if(count > 1)
                {
                    MessageBox.Show("Duplicate username/password");
                }
                else
                {
                    MessageBox.Show("Incorrect username/password");
                }
            }
            catch(Exception)
            {
                throw;
            }
            finally
            {
                if(connection.State == ConnectionState.Open)
                {
                    connection.Close();
                }
            }
        }
开发者ID:MegaColorBoy,项目名称:ProjectTaleem---DBManager,代码行数:50,代码来源:LoginForm.cs

示例7: GuestButton_Click

 private void GuestButton_Click(object sender, EventArgs e)
 {
     try {
         Program.infoController.LoginGuest();
         this.Hide();
         var mainPage = new MainMenu();
         mainPage.ShowDialog();
     }
     catch (CommunicationException)
     {
         MessageBox.Show("Unable to connect to server!\nPlease try again Later.");
     }
     catch (Exception ex)
     {
         MessageBox.Show("Unforseen error!, " + ex.Message);
     }
 }
开发者ID:emactaggart,项目名称:CS476,代码行数:17,代码来源:StartupPage.cs

示例8: loginButton_Click_1

        private void loginButton_Click_1(object sender, EventArgs e)
        {
            try
            {
                loginConn.Open();
                string selectString =
                    "Select * from CustomerDetail where LoginID = '" + txtID.Text +
                                                    "' and Password = '" + txtPass.Text + "'";

                OleDbDataAdapter da = new OleDbDataAdapter(selectString, loginConn);
                OleDbCommandBuilder cBuilder = new OleDbCommandBuilder(da);

                DataTable dataTable = new DataTable();
                da.Fill(dataTable);

                if (dataTable.Rows.Count > 0)
                {
                    MessageBox.Show("Welcome! " + txtID.Text);

                    string loginID = dataTable.Rows[0][0].ToString();
                    string password = dataTable.Rows[0][1].ToString();
                    string name = dataTable.Rows[0][2].ToString();
                    string ic = dataTable.Rows[0][3].ToString();
                    string contactNum = dataTable.Rows[0][4].ToString();
                    string customerType = dataTable.Rows[0][5].ToString();

                    Customer customer = new Customer(loginID, password, customerType, name, ic, contactNum);

                    this.Hide();
                    MainMenu mainMenu = new MainMenu(customer);
                    mainMenu.ShowDialog();
                }
                else
                {
                    MessageBox.Show("ID or Password is incorrect! Please try again");

                }
                loginConn.Close();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                loginConn.Close();
            }
        }
开发者ID:mygamelife,项目名称:TicketReservationSystem,代码行数:45,代码来源:Login.cs

示例9: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection("Data Source=DESKTOP-PDO5AM4\\SQLExpress;Initial Catalog=SoundSystem;Integrated Security=True");
            con.Open();
            SqlCommand cmd = new SqlCommand("Mail_Check", con);
            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter mail = new SqlParameter("@mail", textBox2.Text);
            cmd.Parameters.Add(mail);
            SqlDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                MessageBox.Show("This Email already has an account registered!");
                textBox2.Clear();
                reader.Close();
            }
            else
            {
                reader.Close();
                string upd = @"insert into Account(E_mail,Name,Password) values (@mail,@name,@pass)";
                SqlCommand cmd2 = new SqlCommand(upd, con);
                //MessageBox.Show("Registered succeesfully!");
                string user_name = textBox1.Text;
                string user_mail = textBox2.Text;
                string user_pass = textBox3.Text;
                Globals.email = textBox2.Text;
                SqlParameter prm = new SqlParameter("@name", user_name);
                cmd2.Parameters.Add(prm);
                SqlParameter prm1 = new SqlParameter("@mail", user_mail);
                cmd2.Parameters.Add(prm1);
                SqlParameter prm2 = new SqlParameter("@pass", user_pass);
                cmd2.Parameters.Add(prm2);
                //MessageBox.Show("Registered succeesfully!");
                cmd2.ExecuteNonQuery();
                MessageBox.Show("Registered succeesfully!");
                this.Hide();
                MainMenu main = new MainMenu(user_name,user_mail);
                main.ShowDialog();
                this.Close();
            }
            con.Close();
            
        }
开发者ID:BitHashTech,项目名称:IS-Music-System,代码行数:43,代码来源:Signup.cs

示例10: LoginButton_Click

        private void LoginButton_Click(object sender, EventArgs e)
        {
            string _queryLogin = "SELECT * FROM Users WHERE [email protected] and Passwrd [email protected] ";

            string connectionString = "Data Source=(local);Initial Catalog=NLH;" + "Integrated Security=true";
            string txtuser = UserNametextBox.Text;
            string txtpass = PasswordtextBox.Text;

                using (SqlConnection connection = new SqlConnection(connectionString))
                {
                    connection.Open();
                    SqlCommand comm = new SqlCommand(_queryLogin, connection);
                    comm.Parameters.AddWithValue("@User",txtuser);
                    comm.Parameters.AddWithValue("@Pass",txtpass );

                    SqlDataReader dr = comm.ExecuteReader();

                    int count = 0;
                    while (dr.Read())
                    {
                        count += 1;
                    }
                    if (count == 1)
                    {
                        MessageBox.Show("OK");

                        MainMenu mm = new MainMenu();
                        mm.ShowDialog();
                        this.Hide();
                    }
                    else if (count > 0)
                    {
                        MessageBox.Show("Duplicate found");
                    }
                    else
                    {
                        MessageBox.Show("Incorrect username or password");
                    }

                }
        }
开发者ID:jpj09,项目名称:Hospital,代码行数:41,代码来源:Form1.cs

示例11: submit_btn_Click

        //do the login
        private void submit_btn_Click(object sender, EventArgs e)
        {
            if (counter == 0)
            {                
                this.Hide();
                MainMenu mainManuForm = new MainMenu(this,server, playerId);
                mainManuForm.ShowDialog();
                this.Close();
            }
            else
                MessageBox.Show("Please select a player first");


           
        }
开发者ID:MatanShulman,项目名称:TiacTacToe,代码行数:16,代码来源:LogInPlayer.cs

示例12: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            libraryConn.Open();                                         // 4. open the connection to the database
            string loginName = txtLoginName.Text;

            string strSelect = "Select * from Customer where [LibraryID] = @ID";                //5. prepare to select data from database
            OleDbDataAdapter da = new OleDbDataAdapter(strSelect, libraryConn);
            da.SelectCommand.Parameters.AddWithValue("@ID", txtID.Text);
            OleDbCommandBuilder cBuilder = new OleDbCommandBuilder(da);

            DataTable datatable = new DataTable();

            //use the da to fill in the data that retrieve from the table
            da.Fill(datatable);

            if (datatable.Rows.Count > 0)
            {
                this.Hide();
                MainMenu m = new MainMenu();
                m.ShowDialog();
            }
            else
            {
                MessageBox.Show("Login Fail, please try again!");
            }

            libraryConn.Close();                // close the connection to the database
        }
开发者ID:darklord1310,项目名称:Plane-Ticket-Reservation-System,代码行数:28,代码来源:Form1.cs

示例13: finishButton_Click

        private void finishButton_Click(object sender, EventArgs e)
        {
            cmd.Connection = dataBaseConn;
            cmd.CommandText =
                "INSERT INTO ConfirmBooking ([Name], [Origin], [Destination], [Depart], [Arrive], [FlightCode], [TotalPayment])" +
                "VALUES('"  + loginID + "','"
                            + origin + "','"
                            + dest + "','"
                            + departT + "','"
                            + arriveT + "','"
                            + code + "','"
                            + payment + "')";

            try
            {
                dataBaseConn.Open();

                int temp = cmd.ExecuteNonQuery();

                if (temp > 0)
                {
                    MessageBox.Show("Transcation Store Successfully!");
                }
                else
                {
                    MessageBox.Show("Fail to store transcation!");
                }

                dataBaseConn.Close();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                dataBaseConn.Close();
            }

            try
            {
                dataBaseConn.Open();
                string selectString =
                "Select * from TopSales where LoginID = @id";

                OleDbDataAdapter da = new OleDbDataAdapter(selectString, dataBaseConn);
                da.SelectCommand.Parameters.AddWithValue("@id", loginID);
                OleDbCommandBuilder cBuilder = new OleDbCommandBuilder(da);

                DataTable dataTable = new DataTable();
                da.Fill(dataTable);

                if (dataTable.Rows.Count > 0)
                {
                    previousTransaction = Convert.ToDouble(dataTable.Rows[0][1]);
                }

                previousTransaction += Convert.ToDouble(txtPrice.Text);

                cmd.CommandText =
                    "UPDATE TopSales SET [TotalTransaction] = '" + previousTransaction +
                    "' WHERE [LoginID] = '" + reservation.getCustomer().getLoginID() + "'";

                int temp = cmd.ExecuteNonQuery();

                if (temp > 0)
                {
                    MessageBox.Show("Update Customer's Sale Successfully!");
                }
                else
                {
                    MessageBox.Show("Updata failed!");
                }

                dataBaseConn.Close();

                this.Hide();
                MainMenu m = new MainMenu(reservation.getCustomer());
                m.ShowDialog();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                dataBaseConn.Close();
            }
        }
开发者ID:JacksonTeh,项目名称:TicketReservationSystem,代码行数:83,代码来源:ReservationDetail.cs

示例14: btnLogin_Click

 private void btnLogin_Click(object sender, EventArgs e)
 {
     SqlConnection cmsConn = new SqlConnection("server=TCP:192.168.1.3;database=CMS;uid=sa;pwd=Magical9070");
     cmsConn.Open();
     SqlCommand cmsSqlComm = new SqlCommand();
     cmsSqlComm.CommandText = "select * from memb where meno='" + txtUserName.Text + "'";
     cmsSqlComm.Connection = cmsConn;
     SqlDataReader meno = cmsSqlComm.ExecuteReader();
     if (meno.HasRows)
     {
         meno.Close();
         cmsSqlComm.CommandText = "select * from memb where meno='"+txtUserName.Text+"' and p='" + txtPassword.Text + "'";
         SqlDataReader p = cmsSqlComm.ExecuteReader();
         if (p.HasRows)
         {
             p.Read();
             //判斷登入用戶是否有被壓上離職日期
             if (p["quidate"].ToString() != "")
             {
                 MessageBox.Show("您已無登入權限!" + Environment.NewLine + "若有疑問,請洽人事。", "注意", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 p.Close();
                 cmsConn.Close();
                 txtUserName.Text = "";
                 txtPassword.Text = "";
                 return;
             }
             else
             {
                 this.Hide();
                 MainMenu MM = new MainMenu();
                 MM.tslblUserName.Text = p["name"].ToString();
                 p.Close();
                 string SqlComm = "select dpna from memb where name='" + MM.tslblUserName.Text + "'";
                 SqlCommand CommGo = new SqlCommand(SqlComm, cmsConn);
                 SqlDataAdapter ReadAcc = new SqlDataAdapter(CommGo);
                 DataTable DataTable = new DataTable();
                 ReadAcc.Fill(DataTable);
                 string dpna =Convert.ToString(DataTable.Rows[0][0].ToString());
                 string A = "200";
                 string B = "400";
                 if (dpna == A)
                 {
                     MM.派工ToolStripMenuItem.Enabled = true;
                     MM.續約戶查詢ToolStripMenuItem.Enabled = true;
                     MM.未續約查詢ToolStripMenuItem.Enabled = true;
                     MM.復機戶查詢ToolStripMenuItem.Enabled = true;
                     MM.退租戶查詢ToolStripMenuItem.Enabled = true;
                     MM.用戶抽獎ToolStripMenuItem.Enabled = true;
                 }
                 else if(dpna==B)
                 {
                     MM.派工ToolStripMenuItem.Enabled = true;
                     MM.續約戶查詢ToolStripMenuItem.Enabled = true;
                     MM.未續約查詢ToolStripMenuItem.Enabled = true;
                     MM.復機戶查詢ToolStripMenuItem.Enabled = true;
                     MM.退租戶查詢ToolStripMenuItem.Enabled = true;
                     MM.用戶抽獎ToolStripMenuItem.Enabled = false;
                 }
                 else
                 {
                     MM.派工ToolStripMenuItem.Enabled = false;
                     MM.續約戶查詢ToolStripMenuItem.Enabled = false;
                     MM.未續約查詢ToolStripMenuItem.Enabled = false;
                     MM.復機戶查詢ToolStripMenuItem.Enabled = false;
                     MM.退租戶查詢ToolStripMenuItem.Enabled = false;
                     MM.用戶抽獎ToolStripMenuItem.Enabled = false;
                 }
                 cmsConn.Close();
                 if (MM.ShowDialog() == DialogResult.Cancel)
                 {
                     Application.Exit();
                 }
             }
         }
         else
         {
             MessageBox.Show("密碼不正確!" + Environment.NewLine + "請確認.....", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             txtPassword.Text = "";
             cmsConn.Close();
         }
     }
     else
     {
         MessageBox.Show("查無此帳號!", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         txtUserName.Text = "";
         cmsConn.Close();
     }
 }
开发者ID:coreychen71,项目名称:Magical-Management-System,代码行数:88,代码来源:Login.cs

示例15: updateButton_Click

        private void updateButton_Click(object sender, EventArgs e)
        {
            cmd.Connection = profileConn;
            cmd.CommandText =
                "UPDATE CustomerDetail SET [Password] = '" + txtPassword.Text +
                "' ,[Name] = '" + txtName.Text +
                "' ,[IC] = '" + txtIC.Text +
                "' ,[contactNum] = '" + txtContactNum.Text +
                "' WHERE [LoginID] = '" + id + "'";
            try
            {
                profileConn.Open();

                cmd.Parameters.AddWithValue("", txtPassword.Text);
                cmd.Parameters.AddWithValue("", txtName.Text);
                cmd.Parameters.AddWithValue("", txtIC.Text);
                cmd.Parameters.AddWithValue("", txtContactNum.Text);

                /* Update customer class */
                Customer c = new Customer(id, txtPassword.Text, customerType,
                                        txtName.Text, txtIC.Text, txtContactNum.Text);

                int temp = cmd.ExecuteNonQuery();

                if (temp > 0)
                {
                    MessageBox.Show("Update Successfully!");
                }
                else
                {
                    MessageBox.Show("Updata failed!");
                }

                profileConn.Close();

                this.Hide();
                MainMenu m = new MainMenu(c);
                m.ShowDialog();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                profileConn.Close();
            }
        }
开发者ID:JacksonTeh,项目名称:TicketReservationSystem,代码行数:45,代码来源:UserProfile.cs


注:本文中的MainMenu.ShowDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。