Example #1
0
 public GameConsoleAdapter(Game game, Action <string> stdout, Func <string> stdin, IGridAdapter adapter)
 {
     _game        = game;
     _stdout      = stdout;
     _stdin       = stdin;
     _gridAdapter = adapter;
 }
Example #2
0
        public void AttachToTree(DevExpress.XtraTreeList.TreeList tree)
        {
#if DEBUG_TRACE_LOG_ON
            _logger.Debug("Set-GRID : New");
#endif
            //first disconnect eventual old one
            if (_target != null)
            {
                _target.DataSourceChanged           -= GridDataSourceChanged;
                _target.CustomRowCellEditForEditing -= CustomRowCellEditForEditingHandler;
                _target.ShownEditor             -= EditorShownHandler;
                _target.CustomColumnDisplayText -= CustomColumnDisplayText;
                _target.ListSourceChanged       -= DataController_ListSourceChanged;
                _target.CellValueChanged        -= _target_CellValueChanged;
                _target.ValidatingEditor        -= _target_ValidatingEditor;
            }
            _target = new TreeListAdapter(tree);
            _target.AutoPopulateColumns = true;
            _target.ListSourceChanged  += DataController_ListSourceChanged;
            _target.DataSourceChanged  += GridDataSourceChanged;
            _target.ValidatingEditor   += _target_ValidatingEditor;
            //connect
            _target.DataSource = this;
            _target.PopulateColumns();
        }
Example #3
0
        protected bool disposedValue = false; // To detect redundant calls
        protected override void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    //disconnect events in any case
                    if (_target != null)
                    {
                        _target.DataSourceChanged           -= GridDataSourceChanged;
                        _target.CustomRowCellEditForEditing -= CustomRowCellEditForEditingHandler;
                        _target.ShownEditor             -= EditorShownHandler;
                        _target.CustomColumnDisplayText -= CustomColumnDisplayText; //try remove anyway
                        _target.ListSourceChanged       -= DataController_ListSourceChanged;
                        _target.CellValueChanged        -= _target_CellValueChanged;

                        //remove eventual grid cells editor repositories from grid
                        foreach (RepositoryItem ri in _repositories.Values)
                        {
                            _target.RepositoryItems.Remove(ri);
                        }
                        _target = null;
                    }
                    if (DataSource != null)
                    {
                        DataSource = null;
                    }
                    //clear cached attributes and repositories
                    resetAttributes();

                    ListChanged -= handleListItemChanged;
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
                //call inherited
                base.Dispose(disposing);
            }
        }
Example #4
0
 public static Vector ToGridAdapterCoordinates(this IGridAdapter gridAdapter, Vector3 vector)
 {
     return(new Vector());
 }