Пример #1
0
        void dgvMain_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e)
        {
            if (m_datasource != null && m_datasource.Count > e.RowIndex)
            {
                IGameFile gameFile = m_datasource[e.RowIndex].Object;

                if (!m_properties.ContainsKey(e.ColumnIndex))
                {
                    m_properties.Add(e.ColumnIndex, gameFile.GetType().GetProperty(dgvMain.Columns[e.ColumnIndex].DataPropertyName));
                }

                e.Value = m_properties[e.ColumnIndex].GetValue(gameFile);
            }
        }
Пример #2
0
 public virtual void UpdateDataSourceFile(IGameFile gameFile)
 {
     if (ctrlView.DataSource != null)
     {
         foreach (ObjectView <GameFile> item in (BindingListView <GameFile>)ctrlView.DataSource)
         {
             if (item.Object.Equals(gameFile))
             {
                 IGameFile dsSet = item.Object as IGameFile;
                 Array.ForEach(dsSet.GetType().GetProperties().Where(x => x.SetMethod != null).ToArray(), x => x.SetValue(dsSet, x.GetValue(gameFile)));
                 ctrlView.Invalidate(true);
                 break;
             }
         }
     }
 }