コード例 #1
0
 public bool ShowDialog()
 {
     using (var dlg = new WindowsFormsApplication1.Form2()) {
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             // Retrieve properties
             //...
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Ultrasty/Minesweeper
        private void box_MouseDown(object sender, MouseEventArgs e)
        {
            int win = 0;

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    if (x[i, j].Text != "" || x[i, j].BackColor != SystemColors.Control)
                    {
                        win++;
                    }
                }
            }
            if (win == n * n - 1)
            {
                MessageBox.Show("你真六", "温馨提示");
            }
            if (e.Button == MouseButtons.Left)
            {
                int w = (((Label)sender).Left - 20) / 32;
                int h = (((Label)sender).Top - 20) / 32;
                if (bomb[w, h])
                {
                    for (int i = 0; i < n; i++)
                    {
                        for (int j = 0; j < n; j++)
                        {
                            if (bomb[i, j])
                            {
                                x[i, j].BackColor = Color.Red;
                            }
                        }
                    }
                    Form2 frm2 = new Form2();
                    while (cai)
                    {
                        frm2.ShowDialog(this);
                    }
                }
                else
                {
                    ((Label)sender).Text      = num[w + 1, h + 1].ToString();
                    ((Label)sender).Font      = new Font("方正清刻本悦宋", 20);
                    ((Label)sender).ForeColor = Color.Blue;
                }
                for (int o = 1; o <= 18; o++)
                {
                    for (int i = 0; i < n; i++)
                    {
                        for (int j = 0; j < n; j++)
                        {
                            if (x[i, j].Text == "0")
                            {
                                for (int g = i - 1; g <= i + 1; g++)
                                {
                                    for (int q = j - 1; q <= j + 1; q++)
                                    {
                                        try
                                        {
                                            x[g, q].Text = num[g + 1, q + 1].ToString();
                                        }
                                        catch
                                        {
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                //try
                //{
                //    if (int.Parse(x[1, 1].Text) == 0 || int.Parse(x[0, 1].Text) == 0 || int.Parse(x[1, 0].Text) == 0)
                //    {
                //        x[0, 0].Text = "0";
                //        x[0, 0].Font = new Font("方正清刻本悦宋", 20);
                //        x[0, 0].ForeColor = Color.Blue;
                //    }



                //}
                //catch
                //{ }
                //try
                //{
                //    for (int s = 0; s <= 9; s++) { if (x[0, s].Text != "") { if (int.Parse(x[0, s].Text) == 0) x[0, s + 1].Text = num[0 + 1, s + 1 + 1].ToString(); } };//外围也连成一片
                //    for (int s = 0; s <= 9; s++) if (x[s, 10].Text!=""){if (int.Parse(x[s, 10].Text) == 0) x[s + 1, 10].Text = num[s + 1 + 1, 10 + 1].ToString();};
                //    for (int s = 9; s >= 1; s--) if (x[10, s].Text!=""){if (int.Parse(x[10, s].Text) == 0) x[10, s + 1].Text = num[10 + 1, s + 1 + 1].ToString();};
                //    for (int s = 9; s >= 1; s--) if (x[s, 0].Text!=""){if (int.Parse(x[s, 0].Text) == 0) x[s + 1, 0].Text = num[s + 1 + 1, 0 + 1].ToString();};

                //    for (int s = 0; s <= 9; s++) if (x[s, 0].Text!=""){if (int.Parse(x[s, 0].Text) == 0) x[s + 1, 0].Text = num[s + 1 + 1, 0 + 1].ToString();};
                //    for (int s = 0; s <= 9; s++) if (x[10, s].Text!=""){if (int.Parse(x[10, s].Text) == 0) x[10, s + 1].Text = num[10 + 1, s + 1 + 1].ToString();};
                //    for (int s = 9; s >= 1; s--) if (x[s, 10].Text!=""){if (int.Parse(x[s, 10].Text) == 0) x[s + 1, 10].Text = num[s + 1 + 1, 10 + 1].ToString();};
                //    for (int s = 9; s >= 1; s--) if (x[0, s].Text != "") { if (int.Parse(x[0, s].Text) == 0) x[0, s + 1].Text = num[0 + 1, s + 1 + 1].ToString(); };
                //}
                //catch { }



                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < n; j++)
                    {
                        if (x[i, j].Text != "")
                        {
                            x[i, j].Font      = new Font("方正清刻本悦宋", 20);
                            x[i, j].ForeColor = Color.Blue;
                        }
                    }
                }
            }


            if (e.Button == MouseButtons.Right)
            {
                if (((Label)sender).BackColor == SystemColors.Control)
                {
                    int w = (((Label)sender).Left - 20) / 32;
                    int h = (((Label)sender).Top - 20) / 32;
                    x[w, h].BackColor = Color.Green;
                }
                else
                {
                    ((Label)sender).BackColor = SystemColors.Control;
                }
            }
        }
コード例 #3
0
        private void NextForm_Click(object sender, EventArgs e)
        {
            Form2 form2 = new Form2();

            form2.ShowDialog();
        }
コード例 #4
0
        private void frgt_pwd_lbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Form2 frm2 = new Form2();

            frm2.ShowDialog();
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: andyc010/previous-work
        private void btnStartTest_Click(object sender, EventArgs e)
        {
            // start creating the PDF file
            Document docPDFResults = new Document();
            Section  sectionMain   = docPDFResults.AddSection();

            // instantiate data class for dummy data
            ComponentChecklist componentChecklist = new ComponentChecklist();

            try
            {
                int     count            = 0;
                Boolean isTestContinuing = true;
                Form2   form             = new Form2();

                // load values into the form
                txtbxMachine.Text  = componentChecklist.Machine;
                txtbxIDNumber.Text = componentChecklist.IDNum;

                // start creating the PDF document
                Paragraph paragraphTest = sectionMain.AddParagraph();
                paragraphTest.AddText("Test Results: " + txtbxMachine.Text + ", ID Number: " + txtbxIDNumber.Text + "\n" + System.DateTime.Now.ToString() + "\n\n");

                while ((count < componentChecklist.TestsAndDirections.Length / 2) && (isTestContinuing == true))
                {
                    // get test
                    txtbxTest.Text = componentChecklist.TestsAndDirections[count, 0];
                    form.testValue = componentChecklist.TestsAndDirections[count, 0];

                    // get directions
                    txtbxDirection.Text = componentChecklist.TestsAndDirections[count, 1];


                    DialogResult result = form.ShowDialog();


                    if (result == DialogResult.Yes)
                    {
                        // the test result passed...
                        string strPassResult = "PASSED: " + txtbxTest.Text;

                        // result is in the listbox...
                        displayResult(strPassResult);

                        // and in the PDF document
                        MigraDoc.DocumentObjectModel.Color colorGreen = MigraDoc.DocumentObjectModel.Color.FromCmyk(100, 0, 100, 50);

                        addResultToPDF(sectionMain, colorGreen, strPassResult);

                        count++;
                    }
                    else if (result == DialogResult.No)
                    {
                        // the test result failed...
                        string strFailResult = "FAILED: " + txtbxTest.Text;

                        // listbox result
                        displayResult(strFailResult);

                        // PDF document result
                        MigraDoc.DocumentObjectModel.Color colorRed = MigraDoc.DocumentObjectModel.Color.FromCmyk(0, 100, 100, 0);

                        addResultToPDF(sectionMain, colorRed, strFailResult);

                        count++;
                    }
                    else if (result == DialogResult.Ignore)
                    {
                        // this test was skipped...
                        string strSkipResult = "SKIPPED: " + txtbxTest.Text;

                        // listbox result
                        displayResult(strSkipResult);

                        // PDF document result
                        MigraDoc.DocumentObjectModel.Color colorBlack = MigraDoc.DocumentObjectModel.Color.FromCmyk(0, 0, 0, 100);

                        addResultToPDF(sectionMain, colorBlack, strSkipResult);

                        count++;
                    }
                    else if (result == DialogResult.Cancel)
                    {
                        // the entire test suite was canceled
                        string strCancelResult = "CANCELED: " + txtbxTest.Text;

                        // listbox result
                        displayResult(strCancelResult);

                        // PDF document result
                        MigraDoc.DocumentObjectModel.Color colorBlack = MigraDoc.DocumentObjectModel.Color.FromCmyk(0, 0, 0, 100);

                        addResultToPDF(sectionMain, colorBlack, strCancelResult);

                        isTestContinuing = false;
                    }
                }

                disableButtons();

                // finish PDF document
                PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer();

                pdfRenderer.Document = docPDFResults;

                pdfRenderer.RenderDocument();

                string filename = "TestResults.pdf";

                pdfRenderer.PdfDocument.Save(filename);

                Process.Start(filename);
            }
            catch (Exception exception)
            {
                MessageBox.Show("Error: " + exception.ToString());
            }
        }
コード例 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form2 spravk = new Form2();

            spravk.ShowDialog();
        }
コード例 #7
0
ファイル: Form1.cs プロジェクト: chandimsett/memorybooster
        private void pictureBox4_Click(object sender, EventArgs e)
        {
            Form2 f2 = new Form2();

            f2.ShowDialog();
        }
コード例 #8
0
        private void button3_Click(object sender, EventArgs e)
        {
            Form2 frm = new Form2();

            frm.ShowDialog();
        }
コード例 #9
0
        private void next_Click(object sender, EventArgs e)
        {
            #region Field_Data

            //Collecting the user data

            store_data[0]  = f_name1.Text;
            store_data[1]  = l_name1.Text;
            store_data[2]  = m_name1.Text;
            store_data[3]  = fathers_name1.Text;
            store_data[4]  = mothers_name1.Text;
            store_data[5]  = marital_status1.SelectedIndex.ToString();
            store_data[6]  = spouse_name1.Text;
            store_data[7]  = dob1.Text;
            store_data[8]  = "0";
            store_data[9]  = pan_id1.Text;
            store_data[10] = driver_license1.Text;
            store_data[11] = passport_id1.Text;
            store_data[12] = rashion_id1.Text;
            store_data[13] = mobile_number1.Text;
            store_data[14] = landline_number1.Text;

            //Local Varables
            int    x;
            double xx;
            bool   test;
            String message = "";
            //The flag boolean is individual detection for errors from all 15 fields of entries
            bool[] flag = new bool[16] {
                true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true
            };

            #endregion

            #region Code_Checker

            try
            {
                //
                //First Name Checker - 0
                x = store_data[0].Length;
                if (x < 4)
                {
                    flag[0] = false; message += "First Name must be atleast 5 characters long.\n\n";
                }

                //
                //Last Name Checker - 1
                x = store_data[1].Length;
                if (x < 4)
                {
                    flag[1] = false; message += "Last be atleast 5 characters long.\n\n";
                }

                //
                //Middle Name Checker - 2
                x = store_data[2].Length;
                if ((x < 5) && (x != 0))
                {
                    flag[2] = false; message += "Middle must be atleast 5 characters long.\n\n";
                }

                //
                //Fathers Name Checker - 3
                x = store_data[3].Length;
                if (x < 10)
                {
                    flag[3] = false; message += "Fathers Name must be atleast 10 characters long.\n\n";
                }

                //
                //Mothers Name Checker - 4
                x = store_data[4].Length;
                if (x < 10)
                {
                    flag[4] = false; message += "Mothers Name must be atleast 10 characters long.\n\n";
                }

                //
                //Marital Checker - 5
                x = Int32.Parse(store_data[5]);
                if (x == -1)
                {
                    flag[5] = false; message += "Marital Status not entered.\n\n";
                }

                //
                //Spouse Checker - 6
                x = Int32.Parse(store_data[5]);
                if (x == 0)
                {
                    if ((store_data[6] == null) || (store_data[6] == "") || (store_data[6].Length < 10))
                    {
                        flag[6] = false; message += "Spouse Name must be atleast 10 characters long.\n\n";
                    }
                }
                else if (x == 1)
                {
                    if ((store_data[6] != null) || (store_data[6] != ""))
                    {
                        store_data[6] = null;
                    }
                }

                //
                //DOB Checker - 7

                //
                //Gender Checker - 8
                x = Int32.Parse(store_data[8]);
                if (x == -1)
                {
                    flag[8] = false; message += "Gender Status not entered.\n\n";
                }

                //
                //Pan ID Checker - 9 - FORMAT - AAAAADDDDA
                if (store_data[9].Length != 10)
                {
                    flag[9] = false;
                }

                else
                {
                    if (!((store_data[9].ToLower())[4] == (store_data[1].ToLower())[0]))  // The fifth place of PAN ID is the first letter of Surname/Last Name
                    {
                        flag[9] = false;
                    }

                    else if ((store_data[9].ToUpper())[3] != 'P')  // The fourth place of a PAN ID is always P (Person/Individual)
                    {
                        flag[9] = false;
                    }

                    // out is to be passed by reference

                    test = Int32.TryParse(store_data[9].Substring(5, 4), out x);
                    if (!test)   // Checks if the 6 to 9 characters are digits
                    {
                        flag[9] = false;
                    }

                    for (int i = 0; i < 5; ++i)
                    {
                        if (Int32.TryParse((store_data[9].Substring(0, 5)[i].ToString()), out x))  // Checks if the 1 to 5 characters are alphabets
                        {
                            flag[9] = false; break;
                        }
                    }

                    test = Int32.TryParse(store_data[9].Substring(9, 1), out x);
                    if (test)   // Checks if the last character is digit
                    {
                        flag[9] = false;
                    }
                }

                if (!flag[9])
                {
                    message += "PAN ID wrongly entered format is AAAAADDDDA, 10 digits.\n\n";
                }

                //
                //Drivers License - 10 - FORMAT - AA(State Code)-(13digits)
                if (store_data[10].Length != 16)
                {
                    flag[10] = false;
                }

                else
                {
                    for (int i = 0; i < 2; ++i)
                    {
                        if (Int32.TryParse((store_data[10].Substring(0, 2)[i].ToString()), out x))  // Checks if the first two characters are alphabets
                        {
                            flag[10] = false; break;
                        }
                    }

                    if (!(store_data[10][2] == '-'))
                    {
                        flag[10] = false;
                    }

                    test = double.TryParse(store_data[10].Substring(3, 13), out xx);
                    if (!test)   // Checks if the last 13 characters are digits
                    {
                        flag[10] = false;
                    }
                }

                if (!flag[10])
                {
                    message += "Drivers License wrongly entered format is AA(State Code)-(13digits), 16 digits.\n\n";
                }

                //
                //Passport ID - 11 - FORMAT - ADDDDDDD
                if (store_data[11].Length != 8)
                {
                    flag[11] = false;
                }

                else
                {
                    for (int i = 0; i < 1; ++i)
                    {
                        if (Int32.TryParse((store_data[11].Substring(0, 1)[i].ToString()), out x))  // Checks if the first character is a alphabet
                        {
                            flag[11] = false; break;
                        }
                    }

                    test = Int32.TryParse(store_data[11].Substring(1, 7), out x);
                    if (!test)   // Checks if the last 7 characters are digits
                    {
                        flag[11] = false;
                    }
                }

                if (!flag[11])
                {
                    message += "Passport ID wrongly entered format is ADDDDDDD, 8 digits.\n\n";
                }

                //
                //Ration ID - 12 - FORMAT -

                //
                //Mobile Number - 13
                if (store_data[13].Length != 10)
                {
                    flag[13] = false;
                }

                else
                {
                    test = double.TryParse(store_data[13].Substring(0, 10), out xx);
                    if (!test)   // Checks if the 10 characters are digits
                    {
                        flag[13] = false;
                    }
                }

                if (!flag[13])
                {
                    message += "Mobile Number wrongly entered, it is 10 digits number.\n\n";
                }

                //
                //Landline Number - 14
                if ((store_data[14].Length != 11) && (store_data[14].Length != 10))
                {
                    flag[14] = false;
                }

                else
                {
                    test = double.TryParse(store_data[14].Substring(0, (store_data[14].Length - 1)), out xx);
                    if (!test)   // Checks if the 11 characters are digits
                    {
                        flag[14] = false;
                    }
                }

                if (!flag[14])
                {
                    message += "Landline Number wrongly entered, it is 11 digits number.\n\n";
                }

                flag[15] = true;
            }
            catch (Exception ee)
            { MessageBox.Show("Please Fill The Complete Form Page To Proceed Further"); flag[15] = false; }

            #endregion

            #region Form_Jump

            if ((flag[15]) && (message != ""))
            {
                MessageBox.Show(message, "ERROR - Please resolve the below mentioned problems!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                message = "";
                for (int i = 0; i <= 14; ++i) //set all flags false
                {
                    flag[i] = true;
                }
            }
            else
            {
                String       temporary = String.Format("Name : {0} {1} {2}\nFather's Name : {3}\nMother's Name : {4}\nMarital Status : {5}\nSpouse Name : {6}\nDOB : {7}\nGender : {8}\nPAN ID : {9}\nDrivers License : {10}\nPassport ID : {11}\nRation ID : {12}\nMobile Number : {13}\nLandline Number : {14}\n", store_data);
                DialogResult ab        = MessageBox.Show(temporary, "Are You Sure!", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);//Make Sure
                if (ab == DialogResult.Yes)
                {
                    this.Hide();
                    Form2 form2 = new Form2(store_data);
                    form2.ShowDialog();
                    this.Close();
                }
            }

            #endregion
        }
コード例 #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            var form = new Form2();

            form.ShowDialog();
        }
コード例 #11
0
ファイル: Form1.cs プロジェクト: SO-EETAC/Proyecto_Juego
        private void button2_Click(object sender, EventArgs e)
        {
            if (SignUp.Checked)
            {
                Form2 F2 = new Form2();
                F2.ShowDialog();
                nombre     = F2.SetNombre();
                usuario    = F2.SetUsuario();
                contraseña = F2.SetContraseña();
                // Quiero saber si me he podido dar de alta o no
                string mensaje = "1/" + nombre + "/" + usuario + "/" + contraseña;
                // Enviamos al servidor el nombre tecleado

                byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje);
                server.Send(msg);
            }
            else if (LogIn.Checked)
            {
                Form3 F3 = new Form3();

                F3.ShowDialog();
                user_login     = F3.SetUser();
                password_login = F3.SetPassword();
                // Quiere loguearse

                string mensaje = "2/" + user_login + "/" + password_login;
                // Enviamos al servidor el nombre tecleado
                byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje);
                server.Send(msg);
            }
            else if (consulta_fecha.Checked)
            {
                Form4 F4 = new Form4();

                F4.ShowDialog();
                fecha = F4.getFecha();

                string mensaje = "3/" + fecha;
                // Enviamos al servidor el nombre tecleado
                byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje);
                server.Send(msg);
            }
            else if (consulta_duracion.Checked)
            {
                Form5 F5 = new Form5();
                F5.ShowDialog();
                duracion = F5.getDuracion();

                string mensaje = "4/" + duracion;
                // Enviamos al servidor la duracion que nos han pasado por consola
                byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje);
                server.Send(msg);
            }
            else if (consulta_lista.Checked)
            {
                string mensaje = "5/";
                // Enviamos el código pertinente a la solicitud
                byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje);
                server.Send(msg);
            }
            else if (invitar.Checked)
            {
                Form6 F6 = new Form6();
                F6.setListado(conectados);
                F6.ShowDialog();
                string invitados = F6.GetListado();
                string mensaje   = "6/" + usuario + "/" + invitados; //    6/anakilator/1/juanito23
                byte[] msg       = System.Text.Encoding.ASCII.GetBytes(mensaje);
                server.Send(msg);
            }
        }
コード例 #12
0
ファイル: Form1.cs プロジェクト: JeongJiHwan/SeokTaeJi
        private void 프로그램정보ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form2 info = new Form2();

            info.ShowDialog();
        }
コード例 #13
0
    public static bool FilterCommandsToUbiquitiRadio(ref string command)
    {
        //       byte[] msgData = utilHexToBin(text.TrimEnd('\r', '\n', ' '));
        byte[] msgData = utilHexToBin(command);

        switch (msgData[0])
        {
        case (byte)RadioCommands.SET_DATE:                                          //pick date and convert it to the RTC format

            WindowsFormsApplication1.Form2 customForm = new WindowsFormsApplication1.Form2();
            customForm.dateTimePicker1.Format     = DateTimePickerFormat.Long;
            customForm.dateTimePicker1.ShowUpDown = false;
            var fr = customForm.ShowDialog();

            if (DialogResult.Cancel == fr)                                          //data pick was canceled
            {
                customForm.Dispose();
                return(false);
            }
            else
            {
                if (DayOfWeek.Sunday == customForm.dateTimePicker1.Value.DayOfWeek)
                {
                    command = " " + ByteTohexString((byte)RtcDayOfWeek.sun);
                }
                else
                {
                    command = " " + ByteTohexString((byte)customForm.dateTimePicker1.Value.DayOfWeek);
                }
                command += " " + ByteTohexString((byte)customForm.dateTimePicker1.Value.Day);
                command += " " + ByteTohexString((byte)(((customForm.dateTimePicker1.Value.Month / 10) << 4) + customForm.dateTimePicker1.Value.Month % 10));
                command += " " + ByteTohexString((byte)((((customForm.dateTimePicker1.Value.Year - 2000) / 10) << 4) + (customForm.dateTimePicker1.Value.Year - 2000) % 10));
            }

            customForm.Dispose();
            return(true);

        case (byte)RadioCommands.SET_TIME:                                          //pick time and convert it to the RTC format

            WindowsFormsApplication1.Form2 customForm2 = new WindowsFormsApplication1.Form2();
            customForm2.dateTimePicker1.Format     = DateTimePickerFormat.Time;
            customForm2.dateTimePicker1.ShowUpDown = true;
            var fr2 = customForm2.ShowDialog();

            if (DialogResult.Cancel == fr2)                                          //time pick was canceled
            {
                customForm2.Dispose();
                return(false);
            }
            else
            {
                command  = " " + ByteTohexString((byte)(((customForm2.dateTimePicker1.Value.Hour / 10) << 4) + customForm2.dateTimePicker1.Value.Hour % 10));
                command += " " + ByteTohexString((byte)(((customForm2.dateTimePicker1.Value.Minute / 10) << 4) + customForm2.dateTimePicker1.Value.Minute % 10));
                command += " " + ByteTohexString((byte)(((customForm2.dateTimePicker1.Value.Second / 10) << 4) + customForm2.dateTimePicker1.Value.Second % 10));
            }

            customForm2.Dispose();
            return(true);

        case (byte)RadioCommands.SET_ALARM:                                          //pick time and convert it to the RTC format

            WindowsFormsApplication1.Alarm customForm3 = new WindowsFormsApplication1.Alarm();
            var fr3 = customForm3.ShowDialog();

            if (DialogResult.Cancel == fr3)                                          //time pick was canceled
            {
                customForm3.Dispose();
                return(false);
            }
            else
            {
                command  = " " + ByteTohexString((byte)(((customForm3.dateTimePickerTime.Value.Hour / 10) << 4) + customForm3.dateTimePickerTime.Value.Hour % 10));
                command += " " + ByteTohexString((byte)(((customForm3.dateTimePickerTime.Value.Minute / 10) << 4) + customForm3.dateTimePickerTime.Value.Minute % 10));
                command += " " + ByteTohexString((byte)(((customForm3.dateTimePickerTime.Value.Second / 10) << 4) + customForm3.dateTimePickerTime.Value.Second % 10));

                command += " " + ByteTohexString((byte)(customForm3.dateTimePickerDate.Value.Day));
                if (customForm3.checkBoxEveryDay.Checked)
                {
                    command += " 80";
                }
                else
                {
                    command += " 00";
                }
                if (customForm3.checkBoxEveryDay.Checked)
                {
                    command += " 80";
                }
                else
                {
                    command += " 00";
                }
                if (customForm3.checkBoxEveryDay.Checked)
                {
                    command += " 80";
                }
                else
                {
                    command += " 00";
                }
                if (customForm3.checkBoxEveryDay.Checked)
                {
                    command += " 80";
                }
                else
                {
                    command += " 00";
                }
            }

            customForm3.Dispose();
            return(true);

        default:
            break;
        }

        return(false);
    }
コード例 #14
0
 public void Mostrar(string nombre)
 {
     Juego = new Form2(server, nombre);
     Juego.ShowDialog();
 }
コード例 #15
0
        private void button2_Click(object sender, EventArgs e)
        {
            Form2 f2 = new Form2();

            f2.ShowDialog();
        }
コード例 #16
0
        private void aboutMeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form2 f2 = new Form2();

            f2.ShowDialog();
        }
コード例 #17
0
        // Metodo Jogada //

        private void Jogada_Click(object COMPONENTE, EventArgs e)
        {
            // Tabela Emabaralhada //

            ITEM = ((PictureBox)COMPONENTE).Tag.ToString();
            string ITEM_IMG     = TABELA[int.Parse(ITEM)].ToString();
            string ENDERECO_TXT = string.Concat(LOCAL_TXT_FOTOS, ITEM_IMG, EXT_TXT);
            string ENDERECO_IMG = string.Concat(LOCAL_TXT_FOTOS, ITEM_IMG, EXT_IMG);



            // Carregando Imagem e Texto nos componentes //

            ((PictureBox)COMPONENTE).Image   = Bitmap.FromFile(ENDERECO_IMG);
            ((PictureBox)COMPONENTE).Enabled = false;

            pictureBox_Visual.Image = Bitmap.FromFile(ENDERECO_IMG);

            StreamReader ARQUIVO = new StreamReader(ENDERECO_TXT, System.Text.ASCIIEncoding.UTF7);

            while (!ARQUIVO.EndOfStream)
            {
                string ARQ_DICA = ARQUIVO.ReadLine();
                textBox_Principal.Text = ARQ_DICA;
            }


            // Teste de Verificação //

            if (TESTE == 0)
            {
                TESTE++;
                JOGADA      = TABELA[int.Parse(ITEM)];
                ITEM_COMP_1 = ITEM;
            }
            else
            {
                TESTE       = 0;
                ITEM_COMP_2 = ITEM;


                // Pausa Antes da Verificação //


                Refresh();


                Thread.Sleep(1500);



                if (JOGADA == TABELA[int.Parse(ITEM)])
                {
                    foreach (Object COMP in this.Controls)
                    {
                        if (COMP is PictureBox)
                        {
                            if (((PictureBox)COMP).Tag.ToString() == ITEM_COMP_1)
                            {
                                string ENDERECO = string.Concat(LOCAL_IMG_TURING, ITEM_COMP_1, EXT_IMG);
                                ((PictureBox)COMP).Image   = Bitmap.FromFile(ENDERECO);
                                ((PictureBox)COMP).Enabled = false;
                            }

                            if (((PictureBox)COMP).Tag.ToString() == ITEM_COMP_2)
                            {
                                string ENDERECO = string.Concat(LOCAL_IMG_TURING, ITEM_COMP_2, EXT_IMG);
                                ((PictureBox)COMP).Image   = Bitmap.FromFile(ENDERECO);
                                ((PictureBox)COMP).Enabled = false;
                            }
                        }
                    }


                    FIM = 0;

                    foreach (Object COMP in this.Controls)
                    {
                        if (COMP is PictureBox)
                        {
                            if (((PictureBox)COMP).Enabled == true)
                            {
                                FIM = 1;
                            }
                        }
                    }


                    if (FIM == 0)
                    {
                        timer.Dispose();
                        FIM = 0;

                        Form2 cadastro = new Form2(labelClock.Text);
                        cadastro.ShowDialog();

                        string nome  = cadastro.Name.Replace(" ", "_");
                        string tempo = labelClock.Text;

                        if (File.Exists(strPathFile))
                        {
                            using (StreamWriter sw = File.AppendText(strPathFile))
                            {
                                sw.WriteLine("\n" + nome + ";" + tempo);
                            }
                        }

                        Form3 Rank = new Form3();
                        Rank.ShowDialog();
                    }
                }
                else
                {
                    foreach (Object COMP in this.Controls)
                    {
                        if (COMP is PictureBox)
                        {
                            if (((PictureBox)COMP).Tag.ToString() == ITEM_COMP_1)
                            {
                                string ENDERECO = string.Concat(LOCAL_IMG, ITEM_COMP_1, EXT_IMG);
                                ((PictureBox)COMP).Image   = Bitmap.FromFile(ENDERECO);
                                ((PictureBox)COMP).Enabled = true;
                            }

                            if (((PictureBox)COMP).Tag.ToString() == ITEM_COMP_2)
                            {
                                string ENDERECO = string.Concat(LOCAL_IMG, ITEM_COMP_2, EXT_IMG);
                                ((PictureBox)COMP).Image   = Bitmap.FromFile(ENDERECO);
                                ((PictureBox)COMP).Enabled = true;
                            }
                        }
                    }
                }
            }
        }
コード例 #18
0
        private void btnDatos_Click(object sender, EventArgs e)
        {
            Form2 frm2 = new Form2();

            frm2.ShowDialog();
        }
コード例 #19
0
        private void buttonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            Form2 n = new Form2();

            n.ShowDialog();
        }
コード例 #20
0
        private void button3_Click(object sender, EventArgs e)
        {
            Form2 frm = new Form2(3, _opcion, (int)numericUpDownSelectLvl.Value);

            frm.ShowDialog();
        }
コード例 #21
0
        //private void PonConectados(string [] trozos)
        //{
        //    int n = Convert.ToInt32(trozos[1]);
        //    int i = 0;
        //    dataGridView1.Rows.Clear();
        //    dataGridView1.Refresh();

        //    while (i < n)
        //    {
        //        if (i < n - 1)
        //        {
        //            dataGridView1.Rows.Add();
        //        }
        //        dataGridView1.Rows[i].Cells[0].Value = trozos[i + 2];
        //        i++;
        //    }
        //}

        private void AtenderServidor()
        {
            while (true)
            {
                //Recibimos la respuesta del servidor
                byte[] msg2 = new byte[80];
                server.Receive(msg2);

                string [] trozos    = Encoding.ASCII.GetString(msg2).Split('/');
                int       numtrozos = trozos.Length;
                int       codigo    = Convert.ToInt32(trozos[0]);
                string    mensaje;
                int       nForm;
                switch (codigo)
                {
                case 1:     //Registra al nuevo usuario
                    mensaje = trozos[1].Split('\0')[0];
                    Enviar de = new Enviar(PonMensaje);
                    this.Invoke(de, new object[] { mensaje });
                    if (mensaje == "Usuario registrado")
                    {
                        ThreadStart ts = delegate { PonerEnMarchaFormulario4(); };
                        Thread      T  = new Thread(ts);
                        T.Start();
                    }

                    break;

                case 2:     //Inicia sesión
                    mensaje = trozos[1].Split('\0')[0];
                    de      = new Enviar(PonMensaje);
                    this.Invoke(de, new object[] { mensaje });
                    if (mensaje == "Usuario iniciado")
                    {
                        ThreadStart ts = delegate { PonerEnMarchaFormulario4(); };
                        Thread      T  = new Thread(ts);
                        T.Start();
                    }
                    else
                    {
                        MessageBox.Show("Vuelve a intentarlo, los datos son incorrectos");
                    }
                    break;

                case 3:     //Consulta el jugador que ganó en menor tiempo
                    mensaje = trozos[1].Split('\0')[0];
                    nForm   = Convert.ToInt32(trozos[1]);
                    mensaje = trozos[2];
                    formularios[nForm].TomaJugador(mensaje);

                    //de = new Enviar(PonMensaje);
                    //this.Invoke(de, new object[] { mensaje });
                    //MessageBox.Show(mensaje);
                    break;

                case 4:     //Consulta el menor tiempo en ganar del jugador "usuario"
                    mensaje = trozos[1].Split('\0')[0];
                    nForm   = Convert.ToInt32(trozos[1]);
                    mensaje = trozos[2];
                    formularios[nForm].TomaTiempo(mensaje);

                    //de = new Enviar(PonMensaje);
                    //this.Invoke(de, new object[] { mensaje });
                    //MessageBox.Show(mensaje);
                    break;

                case 5:     //Consulta el número de partidas ganadas por el jugador "usuario"
                    mensaje = trozos[1].Split('\0')[0];
                    nForm   = Convert.ToInt32(trozos[1]);
                    mensaje = trozos[2];
                    formularios[nForm].TomaPartidas(mensaje);

                    //de = new Enviar(PonMensaje);
                    //this.Invoke(de, new object[] { mensaje });
                    //MessageBox.Show(mensaje);
                    break;

                case 6:     //Notificación lista conectados
                    //EnviarTrozos de1 = new EnviarTrozos(PonConectados);
                    //this.Invoke(de1, new object[] { trozos });
                    mensaje = trozos[2].Split('\0')[0];
                    if (mensaje != "0")
                    {
                        nForm = Convert.ToInt32(trozos[1]);
                        int i = 3;
                        while (i < trozos.Length)
                        {
                            mensaje = mensaje + "/" + trozos[i];
                            i++;
                        }
                        formularios[nForm].TomaConectados(mensaje);
                    }
                    break;

                case 7:     //Recibe invitación del invitador
                    string invitador = trozos[3].Split('\0')[0];
                    nForm = Convert.ToInt32(trozos[1]);
                    string letra = trozos[2];
                    Form2  f2    = new Form2();
                    f2.enviado      += new Form2.Enviar(Ejecutar);
                    f2.textBox1.Text = invitador;
                    f2.textBox2.Text = letra;
                    f2.ShowDialog();
                    if (textBox3.Text == "Rechazada")
                    {
                        string mensaje2 = "7/" + nForm + "/Rechazada/" + invitador;
                        // Enviamos al servidor
                        byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje2);
                        server.Send(msg);
                    }
                    else
                    {
                        string mensaje2 = "7/" + nForm + "/Aceptada/" + letra + "/" + invitador;
                        //Enviamos al servidor
                        byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje2);
                        server.Send(msg);
                    }
                    break;

                case 8:     //Recibe contestación del invitado
                    mensaje = trozos[3].Split('\0')[0];
                    nForm   = Convert.ToInt32(trozos[1]);
                    if (trozos[2] == "Rechazada")
                    {
                        string invitado = trozos[3];
                        MessageBox.Show(": ha finalizado la partida", invitado);
                    }
                    else
                    {
                        string invitado = trozos[4];
                        letra = trozos[3];
                        Form3 f3 = new Form3();
                        f3.enviado      += new Form3.Enviar(Ejecutar);
                        f3.textBox1.Text = invitado;
                        f3.label8.Text   = letra;
                        f3.ShowDialog();
                        if (textBox3.Text == "Rechazada")
                        {
                            string mensaje2 = "8/" + nForm + "/Rechazada/" + invitado;
                            // Enviamos al servidor
                            byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje2);
                            server.Send(msg);
                        }
                        else
                        {
                            string mensaje2 = "8/" + nForm + "/Aceptada/" + letra + "/" + f3.textBox2.Text + "/" + f3.textBox3.Text + "/" + f3.textBox4.Text + "/" + f3.textBox5.Text + "/" + f3.textBox6.Text + "/" + invitado;
                            //Enviamos al servidor
                            byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje2);
                            server.Send(msg);
                        }
                    }
                    break;

                case 9:     //recibe contestación del invitador
                    mensaje = trozos[2].Split('\0')[0];
                    nForm   = Convert.ToInt32(trozos[1]);
                    if (trozos[2] == "Rechazada")
                    {
                        string invitador2 = trozos[3];
                        MessageBox.Show(": ha finalizado la partida", invitador2);
                    }
                    else
                    {
                        string invitador2 = trozos[9];
                        letra = trozos[3];
                        Form3 f3 = new Form3();
                        f3.enviado      += new Form3.Enviar(Ejecutar);
                        f3.textBox1.Text = invitador2;
                        f3.label8.Text   = letra;
                        f3.textBox2.Text = trozos[4];
                        f3.textBox3.Text = trozos[5];
                        f3.textBox4.Text = trozos[6];
                        f3.textBox5.Text = trozos[7];
                        f3.textBox6.Text = trozos[8];
                        f3.ShowDialog();
                        if (textBox3.Text == "Rechazada")
                        {
                            string mensaje2 = "8/" + nForm + "/Rechazada/" + invitador2;
                            // Enviamos al servidor
                            byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje2);
                            server.Send(msg);
                        }
                        else
                        {
                            string mensaje2 = "8/" + nForm + "/Aceptada/" + letra + "/" + f3.textBox2.Text + "/" + f3.textBox3.Text + "/" + f3.textBox4.Text + "/" + f3.textBox5.Text + "/" + f3.textBox6.Text + "/" + invitador2;
                            //Enviamos al servidor
                            byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje2);
                            server.Send(msg);
                        }
                    }
                    break;

                    //case 10: //Elimina al usuario
                    //    mensaje = trozos[1].Split('\0')[0];
                    //    de = new Enviar(PonMensaje);
                    //    this.Invoke(de, new object[] { mensaje });
                    //    break;
                }
            }
        }