示例#1
0
        private void FillGrid()
        {
            m_grid.ReadOnly = true;
            m_result        = new List <CInfoResult>();
            if (m_listeVariables == null)
            {
                return;
            }
            foreach (Variable variable in m_listeVariables)
            {
                CInfoResult info = new CInfoResult();
                if (m_mibTree != null)
                {
                    info.Definition = m_mibTree.FindKnownParent(variable.Id.ToNumerical());
                }
                info.Oid   = variable.Id.ToString();
                info.Value = variable.Data != null?variable.Data.ToString() : "";

                m_result.Add(info);
            }
            m_grid.AutoGenerateColumns = false;

            DataGridViewColumn col = new DataGridViewColumn();

            col.HeaderText       = I.T("OID|20001");
            col.CellTemplate     = new DataGridViewTextBoxCell();
            col.DataPropertyName = "Oid";
            col.Width            = 150;
            m_grid.Columns.Add(col);

            col            = new DataGridViewColumn();
            col.HeaderText = I.T("Name|20018");
            DataGridViewLinkCell linkCell = new DataGridViewLinkCell();

            col.CellTemplate     = linkCell;
            col.DataPropertyName = "Name";
            col.Width            = 200;
            m_grid.Columns.Add(col);

            col                  = new DataGridViewColumn();
            col.HeaderText       = I.T("Index|20043");
            col.DataPropertyName = "Index";
            col.CellTemplate     = new DataGridViewTextBoxCell();
            col.Width            = 50;
            m_grid.Columns.Add(col);



            col                  = new DataGridViewColumn();
            col.HeaderText       = I.T("Value|20042");
            col.DataPropertyName = "Value";
            col.CellTemplate     = new DataGridViewTextBoxCell();
            col.Width            = 200;
            m_grid.Columns.Add(col);


            m_grid.DataSource = m_result;
        }
示例#2
0
 private void m_grid_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 1)
     {
         List <CInfoResult> lst = m_grid.DataSource as List <CInfoResult>;
         if (lst != null && e.RowIndex >= 0 && e.RowIndex < lst.Count)
         {
             CInfoResult info = lst[e.RowIndex];
             if (info.Definition != null && m_navigateur != null)
             {
                 m_navigateur.NavigateTo(info.Definition.ModuleName, info.Definition.Name);
             }
         }
     }
 }