Пример #1
0
        public Filters(DataTable dt, Main.SockInfo si)
        {
            InitializeComponent();
            dtFilters = dt;
            sinfo = si;
            int i;
            string funs;

            foreach (DataRow dr in dt.Rows)
            {
                i = dgridFilters.Rows.Add();
                funs = "";
                dgridFilters.Rows[i].Cells["name"].Value = dr["id"].ToString();
                dgridFilters.Rows[i].Cells["enabled"].Value = dr["enabled"];
                foreach (byte f in (byte[])dr["MsgFunction"])
                {
                    funs += si.msg(f) + " ";
                }
                foreach (byte f in (byte[])dr["APIFunction"])
                {
                    funs += si.api(f) + " ";
                }
                foreach (byte f in (byte[])dr["DNSFunction"])
                {
                    funs += si.api(f) + " ";
                }
                if (funs != string.Empty)
                {
                    dgridFilters.Rows[i].Cells["function"].Value = funs.TrimEnd();
                }
            }
        }
        public EditFilter(DataRow dr, Main.SockInfo si, DataTable dtFilters, DataGridView dgridFilters, int dgF_l)
        {
            InitializeComponent();
            drFilters = dr;
            sinfo = si;
            // the following parameters, need to update the grid of the Filters form
            dtF = dtFilters;
            dgF = dgridFilters; // the grid
            dgF_line = dgF_l; // the line to update

            UpdateUI(dr);
        }