Example #1
0
        private void ok_click(object sender, RoutedEventArgs e)
        {
            BL.Class1.ResetIo();
            if (part == 1)//תרגול
            {
                switch (type)
                {
                case "mg":
                {
                    if (size == 0)
                    {
                        MessageBox.Show("אנא בחר מספר כניסות לרכיב");
                    }

                    //   (int size, int hc, int c1a, int c1b, int c1c, int c1d, int c2a, int c2b, int c2c, int c2d)

                    if (size == 2)
                    {
                        newpractice newpractice = new newpractice();
                        newpractice.Show();
                        newpractice.addmg(2, 20, 331, 35, 430, 315, 392, 35, 369, 315);
                        this.Close();
                    }

                    if (size == 3)
                    {
                        newpractice newpractice = new newpractice();
                        newpractice.Show();
                        newpractice.addmg(3, 18, 326, 37, 437, 314, 387, 37, 376, 314);
                        this.Close();
                    }


                    if (size == 4)
                    {
                        newpractice newpractice = new newpractice();
                        newpractice.Show();
                        newpractice.addmg(4, 12, 324, 39, 441, 313, 387, 39, 378, 313);
                        this.Close();
                    }


                    break;
                }

                case "hmechaber":
                {
                    newpractice newpractice = new newpractice();
                    newpractice.Show();
                    newpractice.addhzmechaber(2);
                    this.Close();
                    break;
                }

                case "mechaber":
                {
                    newpractice newpractice = new newpractice();
                    newpractice.Show();
                    newpractice.addhzmechaber(3);
                    this.Close();
                    break;
                }

                case "merabev":
                {
                    if (size == 0)
                    {
                        MessageBox.Show("אנא בחר מספר כניסות לרכיב");
                    }



                    if (size == 2)
                    {
                        newpractice newpractice = new newpractice();
                        newpractice.Show();
                        newpractice.addmerabev(2, 378, 222, 372, 108, 250, 45, 500, 287, 44, 32, 198, 197, 283, 56, 0, 0, 480, 98, 283, 243);
                        this.Close();
                    }

                    if (size == 3)
                    {
                        newpractice newpractice = new newpractice();
                        newpractice.Show();
                        newpractice.addmerabev(3, 391, 246, 362, 126, 262, 64, 505, 326, 34, 20, 198, 197, 283, 62, 0, 0, 480, 110, 283, 231);
                        this.Close();
                    }


                    if (size == 4)
                    {
                        newpractice newpractice = new newpractice();
                        newpractice.Show();
                        newpractice.addmerabev(4, 415, 254, 350, 128, 268, 48, 506, 341, 29, 11, 212, 210, 283, 54, 0, 0, 493, 107, 270, 234);
                        this.Close();
                    }


                    break;
                }

                case "mefaaneah":
                {
                    if (size == 0)
                    {
                        MessageBox.Show("אנא בחר מספר כניסות לרכיב");
                    }
                    if (size == 2)
                    {
                        newpractice newpractice = new newpractice();
                        newpractice.Show();
                        newpractice.addmefaaneh(2, 245, 83, 505, 249, 493, 62, 270, 279, 68, 40, 197, 213, 280, 66, 0, 0);
                        this.Close();
                    }


                    if (size == 3)
                    {
                        newpractice newpractice = new newpractice();
                        newpractice.Show();
                        newpractice.addmefaaneh(3, 210, 87, 515, 293, 494, 46, 277, 314, 59, 25, 226, 235, 258, 53, 0, 0);
                        this.Close();
                    }


                    if (size == 4)
                    {
                        newpractice newpractice = new newpractice();
                        newpractice.Show();
                        newpractice.addmefaaneh(4, 209, 68, 523, 312, 505, 40, 276, 342, 50, 14, 238, 250, 255, 47, 0, 0);
                        this.Close();
                    }

                    break;
                }

                case "mkdd":
                {
                    if (size == 0)
                    {
                        MessageBox.Show("אנא בחר מספר כניסות לרכיב");
                    }
                    if (size == 2)
                    {
                        newpractice newpractice = new newpractice();
                        newpractice.Show();        // int size, int ca, int cb, int cc, int cd, int ya, int yb, int yc, int yd, int hc, int hy, int gridh, int gridw, int grida, int gridb, int gridc, int gridd
                        newpractice.addmkdd(2, 235, 59, 515, 273, 494, 92, 269, 248, 44, 71, 212, 222, 271, 64, 0, 0);
                        this.Close();
                    }


                    if (size == 3)
                    {
                        newpractice newpractice = new newpractice();
                        newpractice.Show();
                        newpractice.addmkdd(3, 245, 51, 516, 302, 493, 73, 270, 267, 24, 54, 212, 222, 271, 64, 0, 0);
                        this.Close();
                    }


                    if (size == 4)
                    {
                        newpractice newpractice = new newpractice();
                        newpractice.Show();
                        newpractice.addmkdd(4, 255, 48, 519, 328, 494, 59, 269, 280, 13, 46, 212, 222, 271, 64, 0, 0);
                        this.Close();
                    }

                    break;
                }
                }
            }



            else//הדגמה
            {
                switch (type)
                {
                case "mkdd":
                {
                    if (size == 0)
                    {
                        MessageBox.Show("אנא בחר מספר כניסות לרכיב");
                    }
                    if (size == 2)
                    {
                        Illustration illustration = new Illustration();
                        illustration.Show();
                        illustration.illuaddmkdd(2, 240, 67, 524, 282, 44, 212, 222, 271, 64, 0, 0);
                        this.Close();
                    }

                    //int size, int ca, int cb, int cc, int cd, int hc, int gridh, int gridw, int grida, int gridb, int gridc, int gridd
                    if (size == 3)
                    {
                        Illustration illustration = new Illustration();
                        illustration.Show();
                        illustration.illuaddmkdd(3, 247, 53, 523, 304, 24, 212, 222, 271, 64, 0, 0);
                        this.Close();
                    }


                    if (size == 4)
                    {
                        Illustration illustration = new Illustration();
                        illustration.Show();
                        illustration.illuaddmkdd(4, 259, 46, 523, 325, 13, 212, 222, 271, 64, 0, 0);
                        this.Close();
                    }

                    break;
                }


                case "mg":
                {
                    if (size == 0)
                    {
                        MessageBox.Show("אנא בחר מספר כניסות לרכיב");
                    }

                    //   (int size, int hc, int c1a, int c1b, int c1c, int c1d, int c2a, int c2b, int c2c, int c2d)

                    if (size == 2)
                    {
                        Illustration illustration = new Illustration();
                        illustration.Show();
                        illustration.illuaddmg(2, 28, 315, 55, 445, 342, 387, 55, 372, 342);
                        this.Close();
                    }

                    if (size == 3)
                    {
                        Illustration illustration = new Illustration();
                        illustration.Show();
                        illustration.illuaddmg(3, 22, 311, 58, 460, 343, 387, 58, 382, 343);
                        this.Close();
                    }


                    if (size == 4)
                    {
                        Illustration illustration = new Illustration();
                        illustration.Show();
                        illustration.illuaddmg(4, 18, 306, 62, 467, 343, 384, 62, 388, 343);
                        this.Close();
                    }

                    break;
                }

                case "hmechaber":
                {
                    Illustration illustration = new Illustration();
                    illustration.Show();
                    illustration.illuaddhzmechaber(2);
                    this.Close();
                    break;
                }

                case "mechaber":
                {
                    Illustration illustration = new Illustration();
                    illustration.Show();
                    illustration.illuaddhzmechaber(3);
                    this.Close();
                    break;
                }

                case "merabev":
                {
                    if (size == 0)
                    {
                        MessageBox.Show("אנא בחר מספר כניסות לרכיב");
                    }



                    if (size == 2)
                    {
                        Illustration illustration = new Illustration();
                        illustration.Show();
                        illustration.illuaddmerabev(2, 349, 263, 417, 135, 255, 74, 506, 322, 47, 34, 212, 207, 285, 51, 0, 0);
                        this.Close();
                    }

                    if (size == 3)
                    {
                        Illustration illustration = new Illustration();
                        illustration.Show();
                        illustration.illuaddmerabev(3, 335, 262, 431, 139, 260, 60, 505, 341, 36, 21, 212, 208, 285, 51, 0, 0);
                        this.Close();
                    }


                    if (size == 4)
                    {
                        Illustration illustration = new Illustration();
                        illustration.Show();
                        illustration.illuaddmerabev(4, 284, 263, 386, 138, 274, 57, 508, 354, 28, 11, 212, 207, 285, 51, 0, 0);
                        this.Close();
                    }


                    break;
                }

                case "mefaaneah":
                {
                    if (size == 0)
                    {
                        MessageBox.Show("אנא בחר מספר כניסות לרכיב");
                    }
                    if (size == 2)
                    {
                        Illustration illustration = new Illustration();
                        illustration.Show();
                        illustration.illuaddmefaaneh(2, 247, 103, 510, 285, 73, 214, 211, 284, 51, 0, 0);
                        this.Close();
                    }


                    if (size == 3)
                    {
                        Illustration illustration = new Illustration();
                        illustration.Show();
                        illustration.illuaddmefaaneh(3, 251, 88, 506, 306, 55, 214, 211, 284, 51, 0, 0);
                        this.Close();
                    }


                    if (size == 4)
                    {
                        Illustration illustration = new Illustration();
                        illustration.Show();
                        illustration.illuaddmefaaneh(4, 252, 74, 507, 321, 46, 214, 211, 284, 51, 0, 0);
                        this.Close();
                    }

                    break;
                }
                }
            }
        }
        /*
         * private void myDataGrid_MouseDown(object sender,System.Windows.Input.MouseEventArgs e)
         * {
         *  System.Windows.Controls.DataGrid myGrid = (System.Windows.Controls.DataGrid)sender;
         *  System.Windows.Controls.DataGrid.HitTestInfo hti;
         * // hti = myGrid.HitTest(e.X, e.Y);
         *  string message = "You clicked ";
         *
         *  switch (hti.Type)
         *  {
         *      case System.Windows.Forms.DataGrid.HitTestType.None:
         *          message += "the background.";
         *          break;
         *      case System.Windows.Forms.DataGrid.HitTestType.Cell:
         *          message += "cell at row " + hti.Row + ", col " + hti.Column;
         *          break;
         *      case System.Windows.Forms.DataGrid.HitTestType.ColumnHeader:
         *          message += "the column header for column " + hti.Column;
         *          break;
         *      case System.Windows.Forms.DataGrid.HitTestType.RowHeader:
         *          message += "the row header for row " + hti.Row;
         *          break;
         *      case System.Windows.Forms.DataGrid.HitTestType.ColumnResize:
         *          message += "the column resizer for column " + hti.Column;
         *          break;
         *      case System.Windows.Forms.DataGrid.HitTestType.RowResize:
         *          message += "the row resizer for row " + hti.Row;
         *          break;
         *      case System.Windows.Forms.DataGrid.HitTestType.Caption:
         *          message += "the caption";
         *          break;
         *      case System.Windows.Forms.DataGrid.HitTestType.ParentRows:
         *          message += "the parent row";
         *          break;
         *  }
         *
         *  Console.WriteLine(message);
         * }*/
        /*
         * private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
         * {
         *  if (e.ColumnIndex == this.dataGridView1.Columns["button"].Index)
         *  {
         *      string query = string.Format("SELECT type From GameTable Where id={0}+2", e.ColumnIndex);
         *      SqlConnection con = new SqlConnection(@"Server=LAPTOP-0SA5RLTP;Initial Catalog = efratDB;Trusted_Connection=True;");
         *      SqlCommand cmd1 = new SqlCommand(query, con);
         *       con.Open();
         *       cmd1.ExecuteNonQuery();
         *      using (SqlDataReader reader = cmd1.ExecuteReader())
         *      {
         *          // iterate your results here
         *          type=(string) reader["type"];
         *      }
         *
         *      con.Close();
         *  }
         *  else
         *  {
         *
         *  }
         * }*/
        private void ok_click(object sender, RoutedEventArgs e)
        {
            switch (type)
            {
            case "Multiplexer":
            {
                newpractice newpractice = new newpractice();
                newpractice.Show();

                if (size == 2)
                {
                    newpractice.merabevAfterSave(2, 378, 222, 372, 108, 250, 45, 500, 287, 44, 32, 198, 197, 283, 56, 0, 0, 480, 98, 283, 243, arr1, arr2);
                }
                else if (size == 3)
                {
                    newpractice.merabevAfterSave(3, 391, 246, 362, 126, 262, 64, 505, 326, 34, 20, 198, 197, 283, 62, 0, 0, 480, 110, 283, 231, arr1, arr2);
                }
                else if (size == 4)
                {
                    newpractice.merabevAfterSave(4, 415, 254, 350, 128, 268, 48, 506, 341, 29, 11, 212, 210, 283, 54, 0, 0, 493, 107, 270, 234, arr1, arr2);
                }
                this.Close();
                //newpractice.merabevAfterSave(xmlDoc);
                break;
            }

            case "Decoder":
            {
                newpractice newpractice = new newpractice();
                newpractice.Show();
                if (size == 2)
                {
                    newpractice.mefaanehAfterSave(2, 245, 83, 505, 249, 493, 62, 270, 279, 68, 40, 197, 213, 280, 66, 0, 0, arr1);
                }
                else if (size == 3)
                {
                    newpractice.mefaanehAfterSave(3, 210, 87, 515, 293, 494, 46, 277, 314, 59, 25, 226, 235, 258, 53, 0, 0, arr1);
                }
                else if (size == 4)
                {
                    newpractice.mefaanehAfterSave(4, 209, 68, 523, 312, 505, 40, 276, 342, 50, 14, 238, 250, 255, 47, 0, 0, arr1);
                }
                this.Close();
                break;
            }

            case "Compares size":
            {
                newpractice newpractice = new newpractice();
                newpractice.Show();
                if (size == 2)
                {
                    newpractice.mgAfterSave(2, 20, 331, 35, 430, 315, 392, 35, 369, 315, arr1, arr2);
                }
                if (size == 3)
                {
                    newpractice.mgAfterSave(3, 18, 326, 37, 437, 314, 387, 37, 376, 314, arr1, arr2);
                }
                if (size == 4)
                {
                    newpractice.mgAfterSave(4, 12, 324, 39, 441, 313, 387, 39, 378, 313, arr1, arr2);
                }
                this.Close();
                break;
            }

            case "Half connective":
            {
                newpractice newpractice = new newpractice();
                newpractice.Show();
                newpractice.hzmechaberafterSave(2, arr1);
                this.Close();
                break;
            }

            case "connective":
            {
                newpractice newpractice = new newpractice();
                newpractice.Show();
                newpractice.hzmechaberafterSave(3, arr1);
                this.Close();
                break;
            }

            case "encoder":
            {
                newpractice newpractice = new newpractice();
                newpractice.Show();
                if (size == 2)
                {
                    // int size, int ca, int cb, int cc, int cd, int ya, int yb, int yc, int yd, int hc, int hy, int gridh, int gridw, int grida, int gridb, int gridc, int gridd
                    newpractice.mkddAfterSave(2, 235, 59, 515, 273, 494, 92, 269, 248, 44, 71, 212, 222, 271, 64, 0, 0, arr1);
                }


                if (size == 3)
                {
                    newpractice.mkddAfterSave(3, 245, 51, 516, 302, 493, 73, 270, 267, 24, 54, 212, 222, 271, 64, 0, 0, arr1);
                }


                if (size == 4)
                {
                    newpractice.mkddAfterSave(4, 255, 48, 519, 328, 494, 59, 269, 280, 13, 46, 212, 222, 271, 64, 0, 0, arr1);
                }
                this.Close();
                break;
            }

                /*switch (type)
                 * {
                 * case "mg":
                 *  {
                 *      break;
                 *  }
                 *
                 *  case "hmechaber":
                 *      {
                 *      break;
                 *  }*/
            }
        }