예제 #1
0
 public void SetEntityEditor <TEntity>(Type entityEditorType)
 {
     if (!typeof(ICrudEntityEditor <TEntity>).IsAssignableFrom(entityEditorType) && !typeof(ICrudEntityEditor <object>).IsAssignableFrom(entityEditorType))
     {
         throw new ArgumentException(string.Format("Does not implement {0}", typeof(ICrudEntityEditor <TEntity>)), "entityEditorType");
     }
     _entityEditorAdapter = new CrudEntityEditorAdapter <TEntity>();
     _entityEditorType    = entityEditorType;
 }
예제 #2
0
 public CrudGrid()
 {
     try {
         _updating   = true;
         _threadLock = new object();
         InitializeComponent();
         //BorderStyle = BorderStyle.None;
         _selectedEntity         = null;
         _dataSource             = null;
         _sortColumnIndex        = 0;
         _sortColumnName         = null;
         _sortDirection          = SortDirection.Ascending;
         _pageSize               = DefaultPageSize;
         _pageSizeUpDown.Minimum = 100;
         _pageSizeUpDown.Maximum = int.MaxValue;
         _pageSizeUpDown.Value   = _pageSize;
         _autoPageSize           = false;
         _pageNumber             = 0;
         _endPageNumber          = 0;
         _totalRecords           = 0;
         _rowToEntityMap         = new Dictionary <int, object>();
         CalculateEntityToRowLookup();
         _gridTitle                  = string.Empty;
         _crudCapabilities           = CrudCapabilities.Default;
         _columnsBindings            = new ICrudGridColumn[0];
         _entityEditorAdapter        = new CrudEntityEditorAdapter <object>();
         _entityEditorType           = typeof(DefaultCrudEntityEditor);
         _gridContainerPanel.Resize += new EventHandler(_gridContainerPanel_Resize);
         LeftClickToDeselect         = false;
         RightClickForContextMenu    = true;
         UseEntityReferenceForLookup = false;
         AutoSelectOnCreate          = false;
         _refreshThrottle            = new Throttle(TimeSpan.FromMilliseconds(250));
         _grid.MinimumHeight         = DefaultRowHeight;
         OrganizeLayout();
     } finally {
         _updating = false;
     }
 }