Пример #1
0
        //id -> maxPossibleCount
        public void Generate(List <int> configsID)
        {
            foreach (var id in configsID)
            {
                MainGrid.RowDefinitions.Add(new RowDefinition()
                {
                    // Height = new GridLength(20, GridUnitType.Star)
                    Height = new GridLength(50)
                });
                int lastRow = MainGrid.RowDefinitions.Count - 1;

                var skinElement  = GetSkinElement(); skinElement.Tag = id;
                var countElement = GetCountElement(); countElement.Tag = id;

                countElement.TextChanged += CountElement_TextInput;

                Grid.SetRow(skinElement, lastRow);
                Grid.SetColumn(skinElement, 0);

                Grid.SetRow(countElement, lastRow);
                Grid.SetColumn(countElement, 1);

                MainGrid.Children.Add(skinElement);
                MainGrid.Children.Add(countElement);

                GridConfig gridConfig = new GridConfig()
                {
                    CountElement = countElement,
                    SkinElement  = skinElement
                };

                _config[id] = gridConfig;
            }
        }
Пример #2
0
 public GridGenerator(GridConfig gridConfig, int counterCharacters, int counterEnemies)
 {
     _gridConfig        = gridConfig;
     _cellOffset        = gridConfig.CellOffset;
     _counterCharacters = counterCharacters;
     _counterEnemies    = counterEnemies;
 }
Пример #3
0
        private void Start()
        {
            //Setup the configuration. You only need to set the values you want different from the defaults that you can see on the GridConfig class.
            var gridCfg = new GridConfig
            {
                cellSize                 = 2f,
                generateHeightmap        = true,
                heightLookupType         = HeightLookupType.QuadTree,
                heightLookupMaxDepth     = 5,
                lowerBoundary            = 1f,
                upperBoundary            = 10f,
                obstacleSensitivityRange = 0.5f,
                sizeX                  = 16,
                sizeZ                  = 16,
                subSectionsX           = 2,
                subSectionsZ           = 2,
                subSectionsCellOverlap = 2,
                origin                 = this.gridHost.transform.position
            };

            //Create the grid instance
            var grid = GridComponent.Create(this.gridHost, gridCfg);

            //Initialize the grid
            grid.Initialize(10, g =>
            {
                Debug.Log("Initialization Done");
            });
        }
Пример #4
0
        public void ColumnConfigs([NotNull] GridConfig config)
        {
            var grid = new Grid {
                Stroke = config.GridStroke
            };

            foreach (Column column in config.Columns)
            {
                grid.Columns.Add(column);
                if (config.Cells == null)
                {
                    grid.Children.Add(new Cell {
                        Stroke = config.CellStroke
                    });
                }
            }
            if (config.Cells != null)
            {
                foreach (Element cell in config.Cells)
                {
                    grid.Children.Add(cell);
                }
            }

            grid.GenerateVisualTree();
            grid.Measure(config.Size);
            grid.Arrange(new Rect(config.Size));
            grid.Render(new ConsoleBuffer(80));

            grid.Columns.Select(c => c.ActualWidth).Should().Equal(config.ExpectedColumnWidths);
        }
Пример #5
0
        /// <summary>
        /// grid参数设置
        /// </summary>
        /// <returns></returns>
        public static GridConfig GetGridConfig()
        {
            var gc = new GridConfig();

            gc.filterMode  = FilterModel.advanced;//高级筛选模式
            gc.showToolbar = false;
            gc.pageSize    = 20;
            gc.editable    = true;
            gc.width       = "50%";
            gc.columns     = new List <GridColumn>()
            {
                new GridColumn()
                {
                    text = "编号", datafield = "id", width = "80px", cellsalign = AlignType.left, datatype = Datatype.dataint
                },
                new GridColumn()
                {
                    text           = "名称", datafield = "name", columntype = ColumnType.template, cellsalign = AlignType.left, datatype = Datatype.datastring,
                    initEditor     = "new $page().grid.initCustomEditor",
                    getEditorValue = "new $page().grid.getCustomEditorValue",
                    createEditor   = "new $page().grid.createCustomEditor"
                },
                new GridColumn()
                {
                    text           = "产品名", datafield = "productname", columntype = ColumnType.template, cellsalign = AlignType.left, datatype = Datatype.datastring,// BUG 使用createEditor , cellsformat一定要等于空 并且不能锁表头
                    initEditor     = "new $page().grid.initInputEditor",
                    getEditorValue = "new $page().grid.getInputEditorValue",
                    createEditor   = "new $page().grid.createInputEditor"
                }
            };
            return(gc);
        }
Пример #6
0
        public void Generate(List <int> configsID)
        {
            foreach (var id in configsID)
            {
                MainGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = GridLength.Auto
                });
                int lastRow = MainGrid.RowDefinitions.Count - 1;

                var skinElement  = GetSkinElement(); skinElement.Tag = id;
                var countElement = GetCountElement(); countElement.Tag = id;

                Grid.SetRow(skinElement, lastRow);
                Grid.SetColumn(skinElement, 0);

                Grid.SetRow(countElement, lastRow);
                Grid.SetColumn(countElement, 1);

                MainGrid.Children.Add(skinElement);
                MainGrid.Children.Add(countElement);


                GridConfig gridConfig = new GridConfig()
                {
                    CountElement = countElement,
                    SkinElement  = skinElement
                };

                _config[id] = gridConfig;

                skinElement.Click += SkinElement_Click;
            }
        }
Пример #7
0
        private void BuildGrids(Bounds b)
        {
            if (gridSize % cellSize != 0 || gridSize % cellSize != 0)
            {
                Debug.LogError("Grid Width and Grid Height must be a multiple of Cell Size");
            }

            var gridColumns = Mathf.FloorToInt(b.size.x / gridSize);
            var gridRows    = Mathf.FloorToInt(b.size.z / gridSize);

            var baseOrigin = b.min + new Vector3(gridSize * .5f, b.size.y, gridSize * .5f);
            var offset     = Vector3.zero;

            var cfg = new GridConfig
            {
                cellSize             = this.cellSize,
                sizeX                = (int)(gridSize / cellSize),
                sizeZ                = (int)(gridSize / cellSize),
                automaticConnections = true
            };

            for (int x = 0; x < gridColumns; x++)
            {
                for (int z = 0; z < gridRows; z++)
                {
                    offset.x   = x * gridSize;
                    offset.z   = z * gridSize;
                    cfg.origin = baseOrigin + offset;

                    GridComponent.Create(this.gridHost, cfg);
                }
            }
        }
Пример #8
0
        internal string DrawHtml(string uniqueID, WebGridHtmlWriter writer, Grid grid, RowCell cell)
        {
            string theValueToShow = Value(cell);

            HtmlEditor e = new HtmlEditor
            {
                ID        = uniqueID,
                ImagePath = Grid.ImagePath,
                UserBRonCarriageReturn = true,
                Width  = (WidthEditableColumn != Unit.Empty ? WidthEditableColumn : 500),
                Height = (HeightEditableColumn != Unit.Empty ? HeightEditableColumn : 400),
                Text   = theValueToShow
            };

            e.ImagePath = GridConfig.Get("WGEditorImagePath", grid.ImagePath);
            StringBuilder sb = new StringBuilder();
            StringWriter  sw = new StringWriter(sb);

            System.Web.UI.HtmlTextWriter mywriter = new System.Web.UI.HtmlTextWriter(sw);
            e.RenderControl(mywriter);
            mywriter.Flush();
            mywriter.Close();

            return(sb.ToString());
        }
Пример #9
0
 public void Initialize(IRegionProfileService gridDBService, IGridServiceCore gridCore, GridConfig config)
 {
     m_gridDBService = gridDBService;
     m_gridCore      = gridCore;
     m_config        = config;
     RegisterHandlers();
 }
        public HoldingTransferedForm(GridConfig gridConfig, UFXBLLManager bLLManager)
            : this()
        {
            _gridConfig = gridConfig;
            _accountBLL = bLLManager.AccountBLL;

            this.LoadControl += new FormLoadHandler(Form_LoadControl);
            this.LoadData    += new FormLoadHandler(Form_LoadData);

            this.srcGridView.UpdateRelatedDataGridHandler += new UpdateRelatedDataGrid(GridView_Source_UpdateRelatedDataGridHandler);
            this.srcGridView.MouseDown  += new MouseEventHandler(GridView_MouseDown);
            this.destGridView.MouseDown += new MouseEventHandler(GridView_MouseDown);

            this.cbOpertionType.SelectedIndexChanged  += new EventHandler(ComboBox_OpertionType_SelectedIndexChanged);
            this.cbSrcFundCode.SelectedIndexChanged   += new EventHandler(ComboBox_FundCode_SelectedIndexChanged);
            this.cbDestFundCode.SelectedIndexChanged  += new EventHandler(ComboBox_FundCode_SelectedIndexChanged);
            this.cbSrcPortfolio.SelectedIndexChanged  += new EventHandler(ComboBox_Portfolio_SelectedIndexChanged);
            this.cbDestPortfolio.SelectedIndexChanged += new EventHandler(ComboBox_Portfolio_SelectedIndexChanged);
            this.cbSrcTradeInst.SelectedIndexChanged  += new EventHandler(ComboBox_TradeInst_SelectedIndexChanged);
            this.cbDestTradeInst.SelectedIndexChanged += new EventHandler(ComboBox_TradeInst_SelectedIndexChanged);

            //this.cbSrcTradeInst.DropDownClosed += new EventHandler(ComboBox_TradeInst_DropDownClosed);
            //this.cbDestTradeInst.DropDownClosed += new EventHandler(ComboBox_TradeInst_DropDownClosed);
            //this.cbSrcTradeInst.LostFocus += new EventHandler(ComboBox_TradeInst_LostFocus);
            //this.cbDestTradeInst.LostFocus += new EventHandler(ComboBox_TradeInst_LostFocus);

            //button click
            this.btnTransfer.Click += new EventHandler(Button_Transfer_Click);
            this.btnRefresh.Click  += new EventHandler(Button_Refresh_Click);
            this.btnCalc.Click     += new EventHandler(Button_Calc_Click);
        }
Пример #11
0
        /// <summary>
        /// 检测是否拥有某个菜单的浏览权限
        /// </summary>
        /// <param name="url"></param>
        private void CheckMenu(Uri uri)
        {
            Uri refUri = HttpContext.Current.Request.UrlReferrer;

            if (!HasMenu(uri) && refUri == null)
            {
                throw new Exception("No permission to view this page!");
            }
            else if (refUri != null && refUri.LocalPath != uri.LocalPath && Path.GetFileNameWithoutExtension(uri.LocalPath).ToLower() == "dialogview") //关键页面,进一步做权限验证
            {
                string objName = WebHelper.Query <string>("objName", "", false);                                                                       //去掉前置的_
                if (objName == "" || !WebHelper.IsKeyInHtml(objName.Trim('_', ' ')))
                {
                    string refObjName = WebHelper.Query <string>("objName", "", refUri.Query);
                    if (!string.IsNullOrEmpty(refObjName))
                    {
                        if (GridConfig.HasObjNameInRule(objName, refObjName))
                        {
                            return;
                        }
                    }
                    throw new Exception("No permission on this objName!");
                }
            }
        }
        public static string toGridJson(this List <object> obj, string tablename, int numberofrecords)
        {
            var           json     = string.Empty;
            StringBuilder oRecords = new StringBuilder();

            string[] fieldinfo;
            json = GridConfig.getgrid(tablename, out fieldinfo);
            for (int i = 0; i <= obj.Count - 1; i++)
            {
                if (numberofrecords != -1)//this is to exit the loop if number of records is specified
                {
                    if (i >= numberofrecords)
                    {
                        break;
                    }
                }

                if (i > 0)
                {
                    oRecords.Append(",");
                }
                oRecords.Append("{");
                for (int j = 0; j <= fieldinfo.Length - 1; j++)
                {
                    if (j > 0)
                    {
                        oRecords.Append(",");
                    }
                    oRecords.Append("\"" + fieldinfo[j].ToLower() + "\":\"" + GetPropValue(obj[i], fieldinfo[j]) + "\"");
                }
                oRecords.Append("}");
            }
            return("{\"status\":\"1\", \"fields\": [" + json + "], \"records\": [" + oRecords.ToString() + "]}");
        }
Пример #13
0
        public SpotTemplateForm(GridConfig gridConfig)
            : this()
        {
            _gridConfig = gridConfig;

            this.tsbSave.Enabled = false;

            this.tsbAdd.Click         += new System.EventHandler(this.ToolStripButton_AddTemplate_Click);
            this.tsbModify.Click      += new System.EventHandler(this.ToolStripButton_ModifyTemplate_Click);
            this.tsbCopy.Click        += new EventHandler(this.ToolStripButton_CopyTemplate_Click);
            this.tsbDelete.Click      += new EventHandler(this.ToolStripButton_DeleteTemplate_Click);
            this.tsbImport.Click      += new System.EventHandler(this.ToolStripButton_Import_Click);
            this.tsbAddStock.Click    += new System.EventHandler(ToolStripButton_AddStock_Click);
            this.tsbModifyStock.Click += new System.EventHandler(ToolStripButton_ModifyStock_Click);
            this.tsbDeleteStock.Click += new System.EventHandler(ToolStripButton_DeleteStock_Click);
            this.tsbSave.Click        += new System.EventHandler(ToolStripButton_Save_Click);
            this.tsbCalcAmount.Click  += new EventHandler(ToolStripButton_CalcAmount_Click);
            this.tsbExport.Click      += new EventHandler(ToolStripButton_Export_Click);

            tempGridView.MouseClickRow    += new ClickRowHandler(GridView_Template_MouseClickRow);
            tempGridView.MouseDoubleClick += new MouseDoubleClickHandler(GridView_Template_MouseDoubleClick);

            this.LoadControl += new FormLoadHandler(Form_LoadControl);
            this.LoadData    += new FormLoadHandler(Form_LoadData);

            //添加右键点击事件
            secuGridView.MouseClick += new MouseEventHandler(SecurityGridView_MouseClick);

            secuContextMenu.ItemClicked += new ToolStripItemClickedEventHandler(SecurityContextMenu_ItemClicked);
        }
Пример #14
0
        /// <summary>
        /// grid参数设置
        /// </summary>
        /// <returns></returns>
        public static GridConfig GetGridConfig()
        {
            var gc = new GridConfig();

            gc.filterMode  = FilterModel.advanced;//高级筛选模式
            gc.showToolbar = false;
            gc.pageSize    = 20;
            gc.width       = "90%";
            gc.columns     = new List <GridColumn>()
            {
                new GridColumn()
                {
                    text = "编号", datafield = "id", width = "40px", cellsalign = AlignType.left, datatype = Datatype.dataint, pinned = true
                },
                new GridColumn()
                {
                    text = "名称", datafield = "name", width = "200px", cellsalign = AlignType.left, datatype = Datatype.datastring, pinned = true
                },
                new GridColumn()
                {
                    text = "产品名", datafield = "productname", width = "1000px", cellsalign = AlignType.left, datatype = Datatype.datastring
                },
                new GridColumn()
                {
                    text = "数量", datafield = "quantity", width = "800px", cellsalign = AlignType.right, datatype = Datatype.dataint
                },
                new GridColumn()
                {
                    text = "创建时间", datafield = "date", width = "200px", cellsformat = "yyyy-MM-dd", cellsalign = AlignType.right, datatype = Datatype.datadate
                }
            };
            return(gc);
        }
Пример #15
0
        /// <summary>
        /// grid参数设置
        /// </summary>
        /// <returns></returns>
        public static GridConfig GetGridConfig()
        {
            var gc = new GridConfig();

            gc.filterMode = FilterModel.advanced;//高级筛选模式

            gc.pageSize = 20;
            gc.width    = "90%";
            gc.columns  = new List <GridColumn>()
            {
                new GridColumn()
                {
                    text = "编号", datafield = "id", width = "40px", cellsalign = AlignType.left, datatype = Datatype.dataint
                },
                new GridColumn()
                {
                    text = "名称", datafield = "name", cellsalign = AlignType.left, datatype = Datatype.datastring, cellsRenderer = "new $page().grid.myCellsRenderer"
                },
                new GridColumn()
                {
                    text = "产品名", datafield = "productname", cellsalign = AlignType.left, datatype = Datatype.datastring
                },
                new GridColumn()
                {
                    text = "数量", datafield = "quantity", cellsalign = AlignType.right, datatype = Datatype.dataint
                },
                new GridColumn()
                {
                    text = "创建时间", datafield = "date", cellsformat = "yyyy-MM-dd", cellsalign = AlignType.right, datatype = Datatype.datadate
                }
            };
            return(gc);
        }
Пример #16
0
        public void TestGridConfig()
        {
            //var grid = ConfigManager.Instance.GetGridConfig().GetGid("cmdtrading");
            //Console.WriteLine("test");

            GridConfig gridConfig = new GridConfig();
            var        grid       = gridConfig.GetGid("cmdtrading");
        }
        /// <summary>
        /// This function permits to convert the config to a node structure
        /// </summary>
        /// <param name="model"></param>
        /// <returns>NodeDimensionValue</returns>
        private NodeDimensionValue ConvertConfigurationGrid(GridConfig model)
        {
            NodeDimensionValue parent = new NodeDimensionValue();

            recursiveBuildTree(model.ColumnDimensions.OrderBy(d => d.Order), 0, parent);

            return(parent);
        }
        /// <summary>
        /// Permet de construire la forme et l'entête de la grille
        /// </summary>
        /// <param name="model"></param>
        public void BuildStructureGrid(GridConfig model)
        {
            _configurationGrid    = model;
            _treeColumnsDimension = ConvertConfigurationGrid(model);

            // Prepare the stacked headers for DevExtreme.
            JsonStackedHeaders = GetJsonWithoutGuillemet(GetColumnHeaders(model, _treeColumnsDimension));
        }
Пример #19
0
        public SubmitSecurityDialog(GridConfig gridConfig)
            : this()
        {
            _gridConfig = gridConfig;

            this.LoadControl += new FormLoadHandler(Form_LoadControl);
            this.LoadData    += new FormLoadHandler(Form_LoadData);
        }
Пример #20
0
 private void GridConfig_CurrentCellActivating(object sender, CurrentCellActivatingEventArgs e)
 {
     if (e.CurrentRowColumnIndex.ColumnIndex == 1 || e.CurrentRowColumnIndex.ColumnIndex == 9)            
         GridConfig.AddNewRowPosition = AddNewRowPosition.Bottom;            
     else            
         GridConfig.AddNewRowPosition = AddNewRowPosition.None;            
     GridConfig.UpdateLayout();
 }
Пример #21
0
        private async Task ConfigureProperties()
        {
            CellContexMenu      = null;
            GridConfig.Total    = (await GridConfig.GetListAsync(GridSearch)).Count();
            GridConfig.ItemList = await GridConfig.GetPageAsync(Sort, GridSearch);

            GridSearch.SearchDateTo = GridSearch.SearchDateTo == DateTime.MinValue ? DateTime.Now : GridSearch.SearchDateTo;
        }
Пример #22
0
 public void Initialise(string opensimVersion, GridDBService gridDBService, IGridServiceCore gridCore, GridConfig config)
 {
     //m_opensimVersion = opensimVersion;
     m_gridDBService = gridDBService;
     m_gridCore      = gridCore;
     m_config        = config;
     RegisterHandlers();
 }
Пример #23
0
        protected async Task HandleMouseUp(GridColumnBase gridColumn)
        {
            List <string> options = (await GridConfig.GetSourceListAsync())
                                    .Select(n => gridColumn.PropertyInfo.GetValue(n, null).ToString())
                                    .Distinct().Take(11).ToList();

            await GridSearch.CreateGridSearch(gridColumn, options.Count() <= 10?options : null);
        }
Пример #24
0
 void Application_Start(object sender, EventArgs e)
 {
     web.Extensions.ExtensionMethods.installpath = Server.MapPath("~");
     // Code that runs on application startup
     //BundleConfig.RegisterBundles(BundleTable.Bundles);
     //AuthConfig.RegisterOpenAuth();
     //RouteConfig.RegisterRoutes(RouteTable.Routes);
     GridConfig.loadconfig();
 }
Пример #25
0
        /// <summary>
        /// Donne les colonnes et le nom de la table temporaire liée au SelectorInstance.
        /// </summary>
        /// <param name="selectorInstance">Instance du SelectorInstance</param>
        /// <param name="wfInstance">Instance du WorkflowInstance</param>
        /// <returns>Liste de string : en element 0, le nom de la table, puis suivent les noms des colones.</returns>
        public async Task <IEnumerable <string> > GetColumnsFromGridConfiguration(SelectorInstance selectorInstance, WorkflowInstance wfInstance)
        {
            if (selectorInstance == null)
            {
                throw new WrongParameterException("GridConfiguration.GetColumnsFromGridConfiguration : SelectorInstance is null!");
            }
            if (wfInstance == null)
            {
                throw new WrongParameterException("GridConfiguration.GetColumnsFromGridConfiguration : WorkflowInstance is null!");
            }
            if (wfInstance.WorkflowConfig == null)
            {
                throw new WrongParameterException("GridConfiguration.GetColumnsFromGridConfiguration : WorkflowInstance.WorkflowConfig is null!");
            }

            // On récupére la configuration de l'opérateur
            List <GridConfig> lstGridConf = await UnitOfWork.GetDbContext().GridConfig
                                            .Include(gc => gc.ColumnDimensions)
                                            .ThenInclude(gdc => gdc.Values)
                                            .Include(gc => gc.RowDimensions)
                                            .ThenInclude(gdc => gdc.Values)
                                            .Include(gc => gc.FixedDimensions)
                                            .ThenInclude(gdc => gdc.Values)
                                            .Include(gc => gc.WorkflowConfig)
                                            .Where(gc => gc.WorkflowConfig.Id == wfInstance.WorkflowConfig.Id)
                                            .AsNoTracking()
                                            .ToAsyncEnumerable()
                                            .ToList();

            GridConfig gridConf = lstGridConf.FirstOrDefault();


            IEnumerable <DistributionDimensionGrid> lstDistCols = GenerateDistribution(gridConf.ColumnDimensions);
            string nomTable = string.Format(Constant.TEMPLATE_TEMPORARY_TABLENAME, selectorInstance.Id.ToString());

            List <string> nomsTableEtCols = new List <string>();

            nomsTableEtCols.Add(nomTable);

            foreach (GridDimensionConfig fixes in gridConf.FixedDimensions.OrderBy(c => c.Order))
            {
                string nomCol = $"Dim{((int)fixes.InternalName).ToString()}";
                nomsTableEtCols.Add(nomCol);
            }
            foreach (GridDimensionConfig row in gridConf.RowDimensions.OrderBy(r => r.Order))
            {
                string nomCol = $"Dim{((int)row.InternalName).ToString()}";
                nomsTableEtCols.Add(nomCol);
            }
            foreach (DistributionDimensionGrid ddg in lstDistCols)
            {
                nomsTableEtCols.Add($"{ddg.ColumnName}_ID");
                nomsTableEtCols.Add($"{ddg.ColumnName}_VAL");
            }

            return(nomsTableEtCols);
        }
Пример #26
0
        public ProductForm(GridConfig gridConfig, UFXBLLManager bLLManager)
            : this()
        {
            _gridConfig = gridConfig;
            _accountBLL = bLLManager.AccountBLL;

            this.LoadControl += new FormLoadHandler(Form_LoadControl);
            this.LoadData    += new FormLoadHandler(Form_LoadData);
        }
        public InstanceManagementForm(GridConfig gridConfig)
            : this()
        {
            _gridConfig = gridConfig;

            this.LoadControl += new FormLoadHandler(Form_LoadControl);
            this.LoadData    += new FormLoadHandler(Form_LoadData);

            this.tsbRefresh.Click += new System.EventHandler(ToolStripButton_Refresh_Click);
        }
Пример #28
0
        private void Form_Load(object sender, EventArgs e)
        {
            GridConfig gridConfig = ConfigManager.Instance.GetGridConfig();
            TSGrid     hsGrid     = gridConfig.GetGid("templatestock");

            TSDataGridViewHelper.AddColumns(this.tsDataGridView1, hsGrid);
            var dataTable = GenerateData(hsGrid);

            //TSDataGridViewHelper.SetData(this.tsDataGridView1, hsGrid, dataTable);
        }
Пример #29
0
 private bool ShouldSerializeConnectionString()
 {
     if (string.IsNullOrEmpty(ConnectionString) == false &&
         (string.IsNullOrEmpty(GridConfig.Get("WGConnectionString", null as string)) ||
          ConnectionString.Equals(GridConfig.Get("WGConnectionString", null as string)) == false))
     {
         return(true);
     }
     return(Equals(m_ShouldSerializeConnectionString, true) ? true : false);
 }
Пример #30
0
        public void Initialize(GridServerBase gridServer)
        {
            m_core    = gridServer;
            m_config  = gridServer.Config;
            m_console = MainConsole.Instance;

            AddConsoleCommands();

            SetupGridServices();
        }
Пример #31
0
        public ActionResult Index()
        {
            var gridConfig = new GridConfig<SampleModel>()
                .Column(x => x.Name)
                .Column(x => x.FullName)
                .Column(x => x.SthElse);

            ViewBag.GridConfig = gridConfig;
            return View();
        }
Пример #32
0
 /// <summary>
 /// Assemble an IGridConfig for an attribute.
 /// </summary>
 /// <param name="dataField">The attribute ID</param>
 /// <returns>An IGridConfig instance</returns>
 private IGridConfig GetConfig(string dataField)
 {
     string headerText = GetMessage(dataField + LABEL);
     IGridConfig config = new GridConfig(dataField, headerText);
     return config;
 }
Пример #33
0
 public MDataTable GetUserList(GridConfig.SelectType st)
 {
     MDataTable dt = null;
     using (MAction action = new MAction(TableNames.Sys_User))
     {
         dt = action.Select();
     }
     dt.JoinOnName = Sys_User.UserID.ToString();
     MDataTable joinDt = dt.Join(TableNames.Sys_UserInfo, Sys_UserInfo.UserInfoID.ToString());
     return joinDt.Select(PageIndex, PageSize, GetWhere() + GetOrderBy(Sys_User.UserID.ToString()), GridConfig.GetSelectColumns(ObjName, st));
 }
Пример #34
0
        public void ColumnConfigs (GridConfig config)
        {
            var grid = new Grid { Stroke = config.GridStroke };
            foreach (Column column in config.Columns) {
                grid.Columns.Add(column);
                if (config.Cells == null)
                    grid.Children.Add(new Cell { Stroke = config.CellStroke });
            }
            if (config.Cells != null) {
                foreach (Element cell in config.Cells)
                    grid.Children.Add(cell);
            }

            grid.GenerateVisualTree();
            grid.Measure(config.Size);
            grid.Arrange(new Rect(config.Size));
            grid.Render(new ConsoleBuffer(80));

            grid.Columns.Select(c => c.ActualWidth).Should().Equal(config.ExpectedColumnWidths);
        }