Exemplo n.º 1
0
    protected void OnCombobox1Changed(object sender, EventArgs e)
    {
        CheckButton _btn;

        ConnectionString += ";Database=" + combobox1.ActiveText;

        foreach (var item in TableBox.Children)
        {
            TableBox.Remove(item);
        }

        using (SqlConnection _conn = new SqlConnection(ConnectionString))
        {
            _conn.Open();

            using (SqlCommand _cmd = new SqlCommand(
                       @"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' ORDER BY TABLE_NAME DESC",
                       _conn))
            {
                using (SqlDataReader _reader = _cmd.ExecuteReader())
                {
                    while (_reader.Read())
                    {
                        _btn         = new CheckButton();
                        _btn.Label   = _reader["TABLE_NAME"].ToString();
                        _btn.Visible = true;
                        _btn.Active  = false;
                        TableBox.PackEnd(_btn);
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
    private void Update()
    {
        if (Input.GetKeyDown(interactKey))
        {
            if (target == null)
            {
                return;
            }

            FoodBox food = target.GetComponent <FoodBox>();
            if (food != null && itemHolder == null)
            {
                food.Interact(this);
            }

            TableBox table = target.GetComponent <TableBox>();
            if (table != null)
            {
                table.Interact(itemHolder, this);
            }

            ResultPost resultPost = target.GetComponent <ResultPost>();
            if (resultPost != null)
            {
                resultPost.Interact(itemHolder, this);
            }

            //TrashCan trashCan = target.GetComponent<TrashCan>();
            //if (trashCan != null)
            //{
            //    trashCan.Interact(crop, this);
            //}
        }
    }
        /* the DataTable.Copy() and Clone() methods */
        private void button5_Click(object sender, EventArgs e)
        {
            DataTable temp = table.Copy();

            TableBox.Display(temp);

            temp = table.Clone();
            TableBox.Display(temp);
        }
Exemplo n.º 4
0
        /*  Demostrates the DataTable.GetChanges() method  */
        private void button1_Click(object sender, EventArgs e)
        {
            DataTable temp = CreateTempTable();

            /* display the table */
            temp.AcceptChanges();
            TableBox.Display(temp);



            /* display added rows */
            temp.Rows.Add(111);

            DataTable Added = temp.GetChanges(DataRowState.Added);

            if (Added != null)
            {
                Added.TableName = "Added";
                TableBox.Display(Added);
            }

            temp.AcceptChanges();


            /* display modified rows */
            temp.Rows[0]["ID"] = 123;
            temp.Rows[2]["ID"] = 456;


            DataTable Modified = temp.GetChanges(DataRowState.Modified);

            if (Modified != null)
            {
                Modified.TableName = "Modified";
                TableBox.Display(Modified);
            }

            temp.AcceptChanges();


            /* display deleted rows */
            temp.Rows[2].Delete();      // DataRow.Delete() marks the row for deletion
            temp.Rows[4].Delete();
            temp.Rows.RemoveAt(3);      // WARNING: DataTable.Rows.Remove() and RemoveAt() delete the row and call AcceptChanges()


            DataTable Deleted = temp.GetChanges(DataRowState.Deleted);

            if (Deleted != null)
            {
                Deleted.TableName = "Deleted";
                Deleted.RejectChanges();    // if RejectChanges() is omitted the Deleted table does not display any row
                TableBox.Display(Deleted);
            }
        }
        /* saving and loading a table to/from an xml file */
        private void button4_Click(object sender, EventArgs e)
        {
            string FileName = Path.GetFullPath(@"..\..\Table.XML");

            table.WriteXml(FileName, XmlWriteMode.WriteSchema);

            DataTable temp = new DataTable();

            temp.ReadXml(FileName);

            TableBox.Display(temp);
        }
Exemplo n.º 6
0
        private void PaintTableBox(TableBox box)
        {
            int   childCount = box.ChildCount;
            float ox         = Painter.OriginX;//***
            float oy         = Painter.OriginY;

            Painter.SetOrigin(box.Left + ox, box.Top + oy);
            for (int i = 0; i < childCount; i++)
            {
                Paint(box.GetChild(i));
            }
            Painter.SetOrigin(ox, oy);//restore
        }
Exemplo n.º 7
0
        private void GenTable(object sender, EventArgs e)
        {
            TableBox.Text  = "#ifndef trig_tbl_inc\r\n#define trig_tbl_inc\r\n\r\n#include <avr/pgmspace.h>\r\n#include \"config.h\"\r\n\r\n";
            TableBox.Text += "#ifdef use_atan\r\n\r\n#define atan_multiplier " + NumOfAtanEntries.Value + "\r\n";
            TableBox.Text += "const signed long atan_tbl [atan_multiplier + 1] PROGMEM = {";
            string str = "";

            for (int i = 0, j = 0; i <= Convert.ToInt32(NumOfAtanEntries.Value); i++, j++)
            {
                if (j % 5 == 0)
                {
                    str += "\r\n\t";
                    j    = 0;
                }
                double val = Math.Atan((double)i / (double)NumOfAtanEntries.Value);
                val *= 57.2957795130823;
                val *= (double)MATH_MULTIPLIER.Value;
                str += string.Format("{0,6}, ", Math.Round(val));
            }
            TableBox.Text += str + "\r\n};\r\n\r\n#endif\r\n\r\n";

            str = "";

            TableBox.Text += "#ifdef use_asin\r\n\r\n#define asin_multiplier " + NumOfAsinEntries.Value + "\r\n";
            TableBox.Text += "const signed long asin_tbl [asin_multiplier + 1] PROGMEM = {";

            for (int i = 0, j = 0; i <= Convert.ToInt32(NumOfAsinEntries.Value); i++, j++)
            {
                if (j % 5 == 0)
                {
                    str += "\r\n\t";
                    j    = 0;
                }
                double val = Math.Asin((double)i / (double)NumOfAsinEntries.Value);
                val *= 57.2957795130823;
                val *= (double)MATH_MULTIPLIER.Value;
                str += string.Format("{0,6}, ", Math.Round(val));
            }
            TableBox.Text += str + "\r\n};\r\n\r\n#endif\r\n\r\n#endif\r\n";

            TableBox.Focus();
            TableBox.SelectAll();
        }