protected void FormatGridItem(GridItem item) { item.Style["color"] = "#000"; if (item is GridDataItem) { item.Style["vertical-align"] = "middle"; item.Style["text-align"] = "center"; } switch (item.ItemType) //Mimic RadGrid appearance for the exported PDF file { /* case GridItemType.Item: item.Style["background-color"] = "#4F4F4F"; break; case GridItemType.AlternatingItem: item.Style["background-color"] = "#494949"; break; case GridItemType.Header: item.Style["background-color"] = "#2B2B2B"; break; case GridItemType.CommandItem: item.Style["background-color"] = "#000000"; break; */ } if (item is GridCommandItem) { item.PrepareItemStyle(); //needed to span the image over the CommandItem cells } }
public GridMenu(int xloc, int yloc, int cols, Texture2D texture, SoundBank soundbank) { m_xpos = xloc; m_ypos = yloc; m_columns = cols; m_texture = texture; m_soundbank = soundbank; Console.WriteLine("Starting Drawing at [" + xloc + ", " + yloc + "]"); m_x = -1; m_y = 0; m_rows = 1; m_num_items = 0; m_selected_x = -1; m_selected_y = -1; m_list = new List<SelectionItem>(); m_grid = new GridItem[m_rows, m_columns]; for (int i = 0; i < m_columns; i++) { m_grid[m_rows-1, i] = new GridItem(); m_grid[m_rows-1, i].m_selectable = false; } }
private void AsEditRow(GridItem item, bool current) { if (current && creatorData.Mode == GridItemMode.Edit) { item.Type = GridItemType.EditRow; } }
public GridItem CreateItem(object dataItem) { var item = new GridItem { DataItem = dataItem, State = GridItemStates.Default, Type = GridItemType.DataRow }; if (dataItem is IGroup) { AsGroupRow(item); } else { var current = comparer.KeysEqualTo(dataItem); AsEditRow(item, current); AsSelected(item, current); AsMaster(item); } return item; }
public override bool ShouldDecorate(GridItem gridItem) { return (gridItem.State & GridItemStates.Selected) == GridItemStates.Selected && gridItem.Type != GridItemType.DetailRow && gridItem.Type != GridItemType.EmptyRow && gridItem.Type != GridItemType.GroupRow; }
public override bool ShouldDecorate(GridItem gridItem) { return gridItem.Type != GridItemType.EmptyRow && gridItem.Type != GridItemType.GroupRow && gridItem.Type != GridItemType.DetailRow && (gridItem.State & GridItemStates.Master) == GridItemStates.Master; }
public override void InitializeCell(TableCell cell, int columnIndex, GridItem inItem) { base.InitializeCell(cell, columnIndex, inItem); if (inItem is GridHeaderItem && !String.IsNullOrEmpty(HeaderText)) { cell.Text = Localization.GetString(string.Format("{0}.Header", HeaderText), LocalResourceFile); } }
public void SetGridEntity(GridItem gridItem) { GridItem = gridItem; if (gridItem != null) { gridItem.Owner = this; } }
public override IEnumerable<GridItem> GetChildItems(GridItem item) { using (CmsContext.Editing) { var id = new Id(item.Id); var entity = CmsService.Instance.GetItem<Entity>(id); return entity.GetChildren<Entity>().Select(GetGridItem); } }
public void Should_insert_as_first_cell_if_not_groups() { var gridItem = new GridItem { Type = GridItemType.DataRow }; var builder = new Mock<IGridRowBuilder>(); builder.Setup(b => b.CreateRow()).Returns(new HtmlElement("tr")); decorator.Decorate(builder.Object, gridItem, true); var node = decorator.CreateRow(); node.Children.Count.ShouldEqual(1); }
public IGridRowBuilder CreateBuilder(GridRenderingData renderingData, GridItem item) { var creator = BuilderRegistry[item.Type]; ExecuteRowCallback(item, renderingData.Callback); var gridRowBuilder = creator(renderingData, item); return decoratorProvider.ApplyDecorators(gridRowBuilder, item, renderingData.HasDetailTemplate); }
public virtual IGridRowBuilder CreateFooterBuilder(GridRenderingData renderingData) { var builder = new GridRowBuilder(renderingData.Columns.Select(column => cellBuilderFactory.CreateFooterCellBuilder(column, renderingData.AggregateResults ))); var item = new GridItem { GroupLevel = renderingData.GroupMembers.Count(), Type = GridItemType.FooterRow }; return decoratorProvider.ApplyDecorators(builder, item, renderingData.HasDetailTemplate); }
public override void InitializeCell(System.Web.UI.WebControls.TableCell cell, int columnIndex, GridItem inItem) { if (Initializable(inItem.ItemType)) { base.InitializeCell(cell, columnIndex, inItem); return; } object dataItem = inItem.DataItem; string value = null; if (null != dataItem) { DataRowView row = dataItem as DataRowView; if (null != row) { value = row[base.DataField].ToString(); } else { PropertyInfo pi = dataItem.GetType().GetProperty(base.DataField); if (null != pi) { object selectedValue = pi.GetValue(dataItem); if (null != selectedValue) { TypeCode targetDataType = this.TargetDataType; if (targetDataType != TypeCode.Empty) { selectedValue = Convert.ChangeType(selectedValue, targetDataType); } value = selectedValue.ToString(); } } } } TextBox ctrl = new TextBox(); ctrl.TextMode = this.TextMode; ctrl.ID = "txt" + base.UniqueName; ctrl.ReadOnly = base.ReadOnly; if (this.ControlWidth != Unit.Empty) ctrl.Width = this.ControlWidth; if (this.ControlHeight != Unit.Empty) ctrl.Height = this.ControlHeight; if (null != value) { ctrl.Text = String.Format("{0}", value); } cell.Controls.Add(ctrl); }
public void Should_insert_cell_after_group_cell_if_grouped() { var gridItem = new GridItem { Type = GridItemType.DataRow, GroupLevel = 1 }; var builder = new Mock<IGridRowBuilder>(); var container = new HtmlElement("tr"); new HtmlElement("td").AppendTo(container); builder.Setup(b => b.CreateRow()).Returns(container); decorator.Decorate(builder.Object, gridItem, true); var node = decorator.CreateRow(); node.Children.Count.ShouldEqual(2); node.Children[1].Attribute("class").ShouldEqual(UIPrimitives.Grid.HierarchyCell); }
public GridItem CreateGroupFooterItem(object dataItem) { if (creatorData.ShowGroupFooter) { var groupFooter = new GridItem { GroupLevel = creatorData.GroupsCount, DataItem = dataItem, Type = GridItemType.GroupFooterRow }; return groupFooter; } return null; }
List<GridItem>SearchVertically(GridItem item) { List<GridItem> vItem = new List<GridItem> { item }; int lower = item.y - 1; int upper = item.y + 1; while(lower >=0 && _item [item.x, lower].id == item.id && _item[item.x, lower]!=null) { vItem.Add(_item[item.x, lower]); lower--; } while (upper < ySize && _item[item.x, upper].id == item.id && _item[item.x, upper] != null) { vItem.Add(_item[item.x, upper]); upper++; } return vItem; }
List<GridItem>SearchHorizontally(GridItem item) { List<GridItem> hItem = new List<GridItem> { item }; int left = item.x - 1; int right = item.x + 1; while(left >= 0 && _item[left,item.y].id == item.id && _item[left,item.y]!= null) { hItem.Add(_item[left, item.y]); left--; } while(right < xSize && _item[right,item.y].id == item.id && _item[right,item.y]!=null) { hItem.Add(_item[right,item.y]); right++; } return hItem; }
public override void InitializeCell(System.Web.UI.WebControls.TableCell cell, int columnIndex, GridItem inItem) { if (Initializable(inItem.ItemType)) { base.InitializeCell(cell, columnIndex, inItem); return; } object dataItem = inItem.DataItem; string value = null; if (null != dataItem) { DataRowView row = dataItem as DataRowView; if (null != row) { value = row[base.DataField].ToString(); } else { PropertyInfo pi = dataItem.GetType().GetProperty(base.DataField); if (null != pi) { object selectedValue = pi.GetValue(dataItem); if (null != selectedValue) { TypeCode targetDataType = this.TargetDataType; if (targetDataType != TypeCode.Empty) { selectedValue = Convert.ChangeType(selectedValue, targetDataType); } value = selectedValue.ToString(); } } } } CheckBox ctrl = new CheckBox(); ctrl.ID = "chb" + base.UniqueName; if (null != value) { ctrl.Checked = String.Equals(this.CheckedValue, value, StringComparison.OrdinalIgnoreCase); } cell.Controls.Add(ctrl); }
public override void InitializeCell(TableCell cell, int columnIndex, GridItem inItem) { base.InitializeCell(cell, columnIndex, inItem); if (inItem is GridHeaderItem && !String.IsNullOrEmpty(HeaderText)) { GridHeaderItem headerItem = inItem as GridHeaderItem; string columnName = DataField; if (!Owner.AllowSorting) { cell.Text = Localization.GetString(string.Format("{0}.Header", HeaderText), LocalResourceFile); } else { LinkButton button = (LinkButton) headerItem[columnName].Controls[0]; button.Text = Localization.GetString(string.Format("{0}.Header", HeaderText), LocalResourceFile); } } }
private void TraverseHeaderItems(GridItem[] headerCollection, string[] groupIndexArray) { if (currentHeaderItemIndex == headerCollection.Length) { return; } string[] headerIndex = headerCollection[currentHeaderItemIndex].GroupIndex.Split('_'); for (int j = 0; j < headerIndex.Length; j++) { if (headerIndex[j] != groupIndexArray[j]) { return; } } GridGroupHeaderItem currentHeaderItem = headerCollection[currentHeaderItemIndex] as GridGroupHeaderItem; table.Cells[headerIndex.Length, row].Value = currentHeaderItem.DataCell.Text; currentHeaderItemIndex++; row++; TraverseHeaderItems(headerCollection, groupIndexArray); }
public override void InitializeCell(TableCell cell, int columnIndex, GridItem inItem) { if (GridDropDownColumnEdit.Initializable(inItem.ItemType)) { base.InitializeCell(cell, columnIndex, inItem); } else { object dataItem = inItem.DataItem; string value = null; if (null != dataItem) { DataRowView rowView = dataItem as DataRowView; if (null != rowView) { value = rowView[base.DataField].ToString(); } else { PropertyInfo pi = dataItem.GetType().GetProperty(base.DataField); if (null != pi) { object selectedValue = pi.GetValue(dataItem); if (null != selectedValue) { value = selectedValue.ToString(); } } } } RadComboBox cbx = new RadComboBox(); cbx.ID = "cbx" + base.UniqueName; if (null != value) { cbx.SelectedValue = value; } cell.Controls.Add(cbx); } }
private void FollowBtn_Click(object sender, EventArgs e) { valueGrid.Focus(); GridItem item = valueGrid.SelectedGridItem; if (item.Label == "m_FileID" || item.Label == "m_PathID") { int fileId = -1; long pathId = -1; foreach (GridItem gi in item.Parent.EnumerateAllItems()) { if (gi.Label == "m_FileID") { fileId = int.Parse((string)gi.Value); } if (gi.Label == "m_PathID") { pathId = long.Parse((string)gi.Value); } } if (fileId == 0 && pathId == 0) { MessageBox.Show("Cannot open null reference", "Assets View"); return; } else if (fileId == -1 || pathId == -1) { MessageBox.Show("Could not find other id, is this really a pptr?", "Assets View"); return; } AssetExternal ext = helper.GetExtAsset(inst, fileId, pathId); GameObjectViewer view = new GameObjectViewer(helper, ext.file, ext.instance.GetBaseField(), ext.info); view.Show(); } }
GridItem FindProperty(GridItem parent, string propertyPath, string path) { foreach (GridItem gi in parent.GridItems) { string mypath = gi.Label; if (path != string.Empty) { mypath = path + "." + gi.Label; } if (mypath == propertyPath) { return(gi); } GridItem sgi = FindProperty(gi, propertyPath, mypath); if (sgi != null) { return(sgi); } } return(null); }
// Procura por informações do possível match MatchInfo GetMatchInformation(GridItem item) { MatchInfo m = new MatchInfo(); m.match = null; List <GridItem> hMatch = SearchHorizontally(item); List <GridItem> vMatch = SearchVertically(item); if (hMatch.Count >= minItemsForMatch && hMatch.Count > vMatch.Count) { m.matchStartingX = GetMinimumX(hMatch); m.matchEndingX = GetMaximumX(hMatch); m.matchStartingY = m.matchEndingY = hMatch[0].y; m.match = hMatch; } else if (vMatch.Count >= minItemsForMatch) { m.matchStartingY = GetMinimumY(vMatch); m.matchEndingY = GetMaximumY(vMatch); m.matchStartingX = m.matchEndingX = hMatch[0].x; m.match = vMatch; } return(m); }
/// <summary> /// Reset the value of the current property /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void miReset_OnClick(object sender, EventArgs e) { GridItem item = base.SelectedGridItem; object oldValue = item.Value; try { base.ResetSelectedProperty(); if ((item.Value == null && oldValue != null) || !item.Value.Equals(oldValue)) { base.OnPropertyValueChanged(new PropertyValueChangedEventArgs( item, oldValue)); } base.Refresh(); } catch (Exception ex) { MessageBox.Show("Unable to reset property: " + ex.Message, "Reset Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void SetPropertyVisibility(GridItem changedItem) { if (changedItem != null) { switch (changedItem.Label) { case "iTunes Library": // Read playlists m_Itunes.GetItunesPlayLists(changedItem.Value.ToString(), false); AddPlaylists(); break; case "Plex Database": // Read accounts GetProperty("Plex Account").Choices = new CustomChoices(GetPlexAccounts().Select(a => a.id + " - " + a.name).ToArray(), true); break; } } GridItem exportItem = GetOption("Sync Playlists"); List <string> exportRelatedItems = m_Itunes.ItunesPlaylists.ConvertAll(i => i.FullPlaylistName); exportRelatedItems.Add("Remove Empty Playlists"); exportRelatedItems.Add("iTunes Library"); foreach (CustomProperty item in grdConfig.Item) { if (exportRelatedItems.Contains(item.Name)) { item.Visible = bool.Parse(exportItem.Value.ToString()); } } grdConfig.Refresh(); }
private List <GridItem> GetVerticalSimilarItems(GridItem item) { List <GridItem> verticalItems = new List <GridItem> { item }; int up = item.Y - 1; int down = item.Y + 1; int upperBound = -1; int lowerBound = _data.GetSizeY(); while (CheckVerticalMatchBeforeBound(up, item, upperBound)) { verticalItems.Add(_data.Items[item.X, up]); up--; } while (CheckVerticalMatchToBound(down, item, lowerBound)) { verticalItems.Add(_data.Items[item.X, down]); down++; } return(verticalItems); }
private List <GridItem> GetHorizontalSimilarItems(GridItem item) { List <GridItem> horizontalItems = new List <GridItem> { item }; int left = item.X - 1; int right = item.X + 1; int leftBound = -1; int rightBound = _data.GetSizeX(); while (CheckHorizontalMatchBeforeBound(left, item, leftBound)) { horizontalItems.Add(_data.Items[left, item.Y]); left--; } while (CheckHorizontalMatchToBound(right, item, rightBound)) { horizontalItems.Add(_data.Items[right, item.Y]); right++; } return(horizontalItems); }
void AttackCommand() { if (attackMode) { attackMode = false; rangeRenderer.enabled = false; map.UnHilightMap(); selectUnit(selected.GetComponent <unitScript>()); } else { unitScript unit = selected.GetComponent <unitScript>(); if (unit.hasAttacked()) { return; } Weapon currentWeapon = unit.getCurrentWeapon(); GridItem pos = selected.GetComponent <GridItem>(); map.UnHilightMap(); if (currentWeapon.type == WeaponType.melee) { MeleeWeapon currentMeleeWeapon = (MeleeWeapon)currentWeapon; map.toggleHighlight(true, Color.red, pos.getX(), pos.getY(), currentMeleeWeapon.range); } else if (currentWeapon.type == WeaponType.shield) { Shield currentShield = (Shield)currentWeapon; map.toggleHighlight(true, Color.yellow, pos.getX(), pos.getY(), currentShield.range); } attackMode = true; pathFinder.setPathfinding(false); } }
private void FiltroPedidos() { int filtro = Convert.ToInt32(rdbFiltro.SelectedValue); AcessoLogin acessoLogin = (AcessoLogin)Session["acessoLogin"]; int franquia = acessoLogin.idFranquia; DataTable dt = bdp.pro_getFiltroPedidos(filtro, franquia); if (dt.Rows.Count > 0) { GridPedidosAbertos.DataSource = dt; GridPedidosAbertos.DataBind(); grid.Visible = true; DesabilitaFuncoes(); } else { GridPedidosAbertos.DataBind(); GridItem.DataBind(); cancelarPedido.Visible = false; divItem.Visible = false; grid.Visible = false; BuscaMensagem("Não existe dados para essa fonte de busca"); } }
public void OnOpenNotePaper(GridItem item) { _windowPanel.NotePaperPanel.NoteID = item.Item.GetAttributeByName("_NoteID").Value.ToString(); _windowPanel.NotePaperPanel.Show(); }
public void Should_not_decorate_if_grid_does_not_have_detail_view() { var gridItem = new GridItem { Type = GridItemType.DataRow }; decorator.Decorate(new Mock<IGridRowBuilder>().Object, gridItem, false); decorator.ShouldDecorate(gridItem).ShouldBeFalse(); }
public static bool AreSlotsInRange(GridItem curSlot, GridItem attackedSlot, int range) { return(Vector3.Distance(curSlot.transform.position, attackedSlot.transform.position) <= range *Mathf.Max(m.itemDimensions.x, m.itemDimensions.y)); }
protected void gv_precios_UpdateCommand(object source, GridCommandEventArgs e) { try { lblmensaje.Text = ""; Conexion Ocoon = new Conexion(); GridItem item = gv_precios.Items[e.Item.ItemIndex]; Label lbl_id_StockDetalle = (Label)item.FindControl("lbl_id_StockDetalle"); int iid_det = Convert.ToInt32(lbl_id_StockDetalle.Text.Trim()); CheckBox ckvalidado = (CheckBox)item.FindControl("cb_validar"); List <object> ArrayEditorValue = new List <object>(); GridEditableItem editedItem = e.Item as GridEditableItem; GridEditManager editMan = editedItem.EditManager; foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns) { if (column is IGridEditableColumn) { IGridEditableColumn editableCol = (column as IGridEditableColumn); if (editableCol.IsEditable) { IGridColumnEditor editor = editMan.GetColumnEditor(editableCol); string editorType = editor.ToString(); string editorText = "unknown"; object editorValue = null; if (editor is GridNumericColumnEditor) { editorText = (editor as GridNumericColumnEditor).Text; editorValue = (editor as GridNumericColumnEditor).NumericTextBox.DbValue; ArrayEditorValue.Add(editorValue); } if (editor is GridDateTimeColumnEditor) { editorText = (editor as GridDateTimeColumnEditor).Text; editorValue = (editor as GridDateTimeColumnEditor).PickerControl; ArrayEditorValue.Add(editorValue); } } } } DateTime Fec_reg_bd = Convert.ToDateTime((ArrayEditorValue[0] as RadDateTimePicker).SelectedDate); string ingreso = ArrayEditorValue[1].ToString(); string pedido = ArrayEditorValue[2].ToString(); Ocoon.ejecutarDataReader("UP_WEBXPLORA_OPE_ACTUALIZAR_REPORTE_STOCK_SANFERNDO", iid_det, pedido, ingreso, Fec_reg_bd, Session["sUser"].ToString(), DateTime.Now, ckvalidado.Checked); cargarGrilla_Precio(); } catch (Exception ex) { lblmensaje.Text = ex.ToString(); Response.Redirect("~/err_mensaje_seccion.aspx", true); } }
public void DestroyItem(GridItem item) { GameObject.Destroy(item.Boundary.gameObject); GameObject.Destroy(item.Quantity.gameObject); GameObject.Destroy(item.gameObject); }
public override bool ShouldDecorate(GridItem gridItem) { return (gridItem.State & GridItemStates.Alternating) == GridItemStates.Alternating && gridItem.Type != GridItemType.EmptyRow && gridItem.Type != GridItemType.GroupRow; }
public abstract void ApplyDamage(Unit source, GridItem attackedSlot);
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Z)) { print("+"); rotation += 90; } if (Input.GetKeyDown(KeyCode.C)) { print("-"); rotation -= 90; } if (Input.GetMouseButton(0)) { RaycastHit hit; // Check if over UI if (!UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject()) { var ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, Mathf.Infinity, (1 << 8))) { GameObject objectHit = hit.collider.gameObject; GridItem position = objectHit.GetComponent <GridItem>(); //if (objectHit.tag == "tile") { if (panelIndex == 0) { GetComponent <TileMap>().setTile(position.getX(), position.getY(), rotation, index); } else if (panelIndex == 1) { GetComponent <TileMap>().setObject(position.getX(), position.getY(), rotation, index); } else if (panelIndex == 2) { if (tempoaryTrigger[0].x == -1) { print("Value1 set"); tempoaryTrigger[0] = position.getPos(); } else if (tempoaryTrigger[1].x == -1 && position.getPos() != tempoaryTrigger[0]) { tempoaryTrigger[1] = position.getPos(); print("Value2 set"); setTrigger(); } } else if (panelIndex == 3) { GameObject.Find("EffectPanel").GetComponent <EffectPanelScript>().updateClickedPosition(position.getPos()); panelIndex = lastIndex; } else if (panelIndex == 4) { GetComponent <TileMap>().setSpawner(position.getX(), position.getY(), index); } else if (panelIndex == 5) { GetComponent <TileMap>().setModifer(position.getX(), position.getY(), index, true); print("CAKE IS A LIE"); } } } } } else if (Input.GetMouseButton(1)) { RaycastHit hit; // Check if over UI if (!UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject()) { var ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, Mathf.Infinity, (1 << 8))) { GameObject objectHit = hit.collider.gameObject; GridItem position = objectHit.GetComponent <GridItem>(); //if (objectHit.tag == "tile") { if (panelIndex == 0) { index = GetComponent <TileMap>().getTileIndex(position.getX(), position.getY()); } else if (panelIndex == 1) { GetComponent <TileMap>().setObject(position.getX(), position.getY(), rotation, 0); } else if (panelIndex == 4) { GetComponent <TileMap>().setSpawner(position.getX(), position.getY(), 0); } else if (panelIndex == 5) { GetComponent <TileMap>().setModifer(position.getX(), position.getY(), 0, true); print("CAKE IS A LIE"); } } } } } }
/// <summary> /// 提取值 /// </summary> /// <param name="item"></param> /// <returns></returns> public static Hashtable ExtractValuesFromTableView(this GridItem item) { return(new Hashtable(item.OwnerTableView.DataKeyValues[item.ItemIndex], StringComparer.OrdinalIgnoreCase)); }
protected DateTime?SetEndDate(GridItem item) { return(item.OwnerTableView.GetColumn("EndDate").CurrentFilterValue == string.Empty ? new DateTime?() : DateTime.Parse(item.OwnerTableView.GetColumn("EndDate").CurrentFilterValue)); }
/// <summary> /// Assigns a new GridItem to a cell in the grid. /// </summary> /// <param name="x">Row of the cell to be updated.</param> /// <param name="y">Column of the cell to be updated.</param> /// <param name="item">Item to be associated with the cell.</param> public void UpdateGridItem(int x, int y, GridItem item) { _grid[x * _rows + y] = item; }
/// <summary> /// Assigns a new GridItem to a cell in the grid. /// </summary> /// <param name="coords">Vector of the grid coordinates of the cell to be updated.</param> /// <param name="item">Item to be associated with the cell.</param> public void UpdateGridItem(Vector2 coords, GridItem item) { UpdateGridItem((int)coords.x, (int)coords.y, item); }
// ****************************************************************** private static void ExpandItemWithInitialExpandedAttribute(PropertyGrid propertyGrid, GridItem gridItem) { if (gridItem != null) { if (gridItem.GridItemType == GridItemType.Property && gridItem.Expandable) { object[] objs = gridItem.Value.GetType().GetCustomAttributes(typeof(PropertyGridInitialExpandedAttribute), false); if (objs.Length > 0) { if (((PropertyGridInitialExpandedAttribute)objs[0]).InitialExpanded) { gridItem.Expanded = true; } } } foreach (GridItem childItem in gridItem.GridItems) { ExpandItemWithInitialExpandedAttribute(propertyGrid, childItem); } } }
public override bool ShouldDecorate(GridItem gridItem) { return gridItem.Type != GridItemType.DetailRow && gridItem.Type != GridItemType.GroupRow; }
public void PropertyChanged(GridItem itemChanged, object oldVal) { drawArea.PropertyChanged(itemChanged, oldVal); drawArea.Refresh(); }
private void AsSelected(GridItem item, bool current) { if (current && creatorData.Mode == GridItemMode.Select) { item.State |= GridItemStates.Selected; } }
private void pg1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { int n = listBox1.SelectedIndex; if (n == -1) { return; } n = CurrentObjects[n]; string name = e.ChangedItem.Label; GridItem parent = e.ChangedItem.Parent; //if (parent != null) name = parent.Label; if (parent.Label == "data") { GridItem parent2 = parent.Parent; if (parent2 != null) { name = parent2.Label; } } if (name == "nameindex") { name = parent.Label; } byte[] buff = pcc.Exports[n].Data; List <PropertyReader.Property> p = PropertyReader.getPropList(pcc, buff); int m = -1; for (int i = 0; i < p.Count; i++) { if (pcc.Names[p[i].Name] == name) { m = i; } } if (m == -1) { return; } PCCObject.ExportEntry ent = pcc.Exports[n]; byte[] buff2; switch (p[m].TypeVal) { case PropertyReader.Type.BoolProperty: byte res = 0; if ((bool)e.ChangedItem.Value == true) { res = 1; } ent.Data[p[m].offsetval] = res; break; case PropertyReader.Type.FloatProperty: buff2 = BitConverter.GetBytes((float)e.ChangedItem.Value); for (int i = 0; i < 4; i++) { ent.Data[p[m].offsetval + i] = buff2[i]; } break; case PropertyReader.Type.IntProperty: case PropertyReader.Type.StringRefProperty: int newv = Convert.ToInt32(e.ChangedItem.Value); int oldv = Convert.ToInt32(e.OldValue); buff2 = BitConverter.GetBytes(newv); for (int i = 0; i < 4; i++) { ent.Data[p[m].offsetval + i] = buff2[i]; } break; case PropertyReader.Type.StructProperty: if (e.ChangedItem.Value.GetType() == typeof(int)) { int val = Convert.ToInt32(e.ChangedItem.Value); if (e.ChangedItem.Label == "nameindex") { int val1 = Convert.ToInt32(e.ChangedItem.Value); buff2 = BitConverter.GetBytes(val1); for (int i = 0; i < 4; i++) { ent.Data[p[m].offsetval + i] = buff2[i]; } int t = listBox1.SelectedIndex; listBox1.SelectedIndex = -1; listBox1.SelectedIndex = t; } else { string sidx = e.ChangedItem.Label.Replace("[", ""); sidx = sidx.Replace("]", ""); int index = Convert.ToInt32(sidx); buff2 = BitConverter.GetBytes(val); for (int i = 0; i < 4; i++) { ent.Data[p[m].offsetval + i + index * 4 + 8] = buff2[i]; } int t = listBox1.SelectedIndex; listBox1.SelectedIndex = -1; listBox1.SelectedIndex = t; } } break; case PropertyReader.Type.ByteProperty: case PropertyReader.Type.NameProperty: if (e.ChangedItem.Value.GetType() == typeof(int)) { int val = Convert.ToInt32(e.ChangedItem.Value); buff2 = BitConverter.GetBytes(val); for (int i = 0; i < 4; i++) { ent.Data[p[m].offsetval + i] = buff2[i]; } int t = listBox1.SelectedIndex; listBox1.SelectedIndex = -1; listBox1.SelectedIndex = t; } break; case PropertyReader.Type.ObjectProperty: if (e.ChangedItem.Value.GetType() == typeof(int)) { int val = Convert.ToInt32(e.ChangedItem.Value); buff2 = BitConverter.GetBytes(val); for (int i = 0; i < 4; i++) { ent.Data[p[m].offsetval + i] = buff2[i]; } int t = listBox1.SelectedIndex; listBox1.SelectedIndex = -1; listBox1.SelectedIndex = t; } break; default: return; } pcc.Exports[n] = ent; pg1.ExpandAllGridItems(); }
private void InstantiateUserControl(GridModuleRenderingDefinition definition, GridItem item) { var control = this.Page.LoadControl(definition.Path); if (control == null) { Controls.Add(new LiteralControl("Could not load control : " + definition.Path)); } else { var rendering = control as IGridModuleRendering; if (rendering == null) { Controls.Add(new LiteralControl("The Control '" + definition.Path + "' does not implement IGridModuleRendering")); } else { rendering.InitializeModule(item.Id, item.ColumnSpan); Controls.Add((Control)rendering); } } }
private bool FindNearestGridSlot(List <InventoryGrid> grids, out int fitColumn, out int fitRow, bool isPlayerOwned) { fitColumn = 0; fitRow = 0; Vector3 bottomLeftPos = SelectedItem.transform.localPosition - new Vector3(SelectedItem.ColumnSize * BackpackGrid.BlockSize / 2, SelectedItem.RowSize * BackpackGrid.BlockSize / 2, 0); Vector3 centerPos = SelectedItem.transform.localPosition; //see which grid we are at FocusedGrid = null; foreach (InventoryGrid grid in grids) { //check if item is allowed in this grid bool isItemAllowed = false; if (grid.AllowedItemTypes.Count > 0) { bool typeMatchFound = false; foreach (ItemType type in grid.AllowedItemTypes) { if (SelectedItem.Item.Type == type) { typeMatchFound = true; } } if (typeMatchFound) { isItemAllowed = true; } } else { isItemAllowed = true; } if (centerPos.x >= grid.Grid.transform.localPosition.x && centerPos.x <= grid.Grid.transform.localPosition.x + grid.Columns * grid.BlockSize && centerPos.y >= grid.Grid.transform.localPosition.y && centerPos.y <= grid.Grid.transform.localPosition.y + grid.Rows * grid.BlockSize && grid.IsPlayerOwned == isPlayerOwned && isItemAllowed) { FocusedGrid = grid; } } if (FocusedGrid == null) { return(false); } //starting from 1 block down-left of bottomLeftPos, check if there's room to fit the item int col = 0; int row = 0; bool result = false; int [] xArray = new int[] { 0, -1, 0, -1, 1, 0, 1 }; int [] yArray = new int[] { 0, -1, -1, 0, 0, 1, 1 }; int count = 0; while (!result && count < 7) { result = FocusedGrid.GetColumnRowFromPos(bottomLeftPos + new Vector3(BackpackGrid.BlockSize * xArray[count], BackpackGrid.BlockSize * yArray[count], 0), out col, out row); if (result) { //check if this col/row can fit the item GridItem replace = null; if (ReplaceItem != null) { ReplaceItem.Sprite.alpha = 1; } if (FocusedGrid.CanItemFitHere(col, row, SelectedItem.ColumnSize, SelectedItem.RowSize, out replace)) { ReplaceItem = replace; if (ReplaceItem != null) { ReplaceItem.Sprite.alpha = 0.5f; } fitColumn = col; fitRow = row; return(true); } } count++; } if (!result) { return(false); } return(false); }
public override bool ShouldDecorate(GridItem gridItem) { return((gridItem.State & GridItemStates.Alternating) == GridItemStates.Alternating && gridItem.Type != GridItemType.EmptyRow && gridItem.Type != GridItemType.GroupRow); }
public void AddItemToBodySlot(GridItem item, BodySlot slot) { item.Sprite.pivot = UIWidget.Pivot.Center; item.Sprite.transform.parent = item.Boundary.transform.parent; if (item.IsRotatable) { if (item.Item.Type == ItemType.PrimaryWeapon || item.Item.Type == ItemType.SideArm) { if (item.Orientation == GridItemOrient.Landscape) { int temp = item.ColumnSize; item.ColumnSize = item.RowSize; item.RowSize = temp; item.Orientation = GridItemOrient.Portrait; item.transform.localEulerAngles = new Vector3(0, 0, 90); } if (((float)item.ColumnSize) / ((float)item.RowSize) < 0.4f) { item.Sprite.width = slot.Background.height; item.Sprite.height = Mathf.FloorToInt(item.Sprite.width * ((item.ColumnSize * 1f) / item.RowSize)); } else { item.Sprite.width = slot.Background.width; item.Sprite.height = Mathf.FloorToInt(item.Sprite.width * ((item.ColumnSize * 1f) / item.RowSize)); } } else if (item.Item.Type == ItemType.Armor) { if (item.Orientation == GridItemOrient.Portrait) { int temp = item.ColumnSize; item.ColumnSize = item.RowSize; item.RowSize = temp; item.Orientation = GridItemOrient.Landscape; item.transform.localEulerAngles = new Vector3(0, 0, 0); } item.Sprite.width = slot.Background.width; item.Sprite.height = Mathf.FloorToInt(item.Sprite.width * ((item.RowSize * 1f) / item.ColumnSize)); } else if (item.Item.Type == ItemType.Thrown || item.Item.Type == ItemType.Tool) { if (item.Orientation == GridItemOrient.Portrait) { int temp = item.ColumnSize; item.ColumnSize = item.RowSize; item.RowSize = temp; item.Orientation = GridItemOrient.Landscape; item.transform.localEulerAngles = new Vector3(0, 0, 0); } item.Sprite.height = slot.Background.height; item.Sprite.width = Mathf.FloorToInt(item.Sprite.height * ((item.ColumnSize * 1f) / item.RowSize)); } } else { item.Sprite.width = slot.Background.width; item.Sprite.height = item.Sprite.width; } item.Boundary.width = slot.Background.width - 10; item.Boundary.height = slot.Background.height - 10; item.Sprite.depth = (int)InventoryItemDepth.Normal; item.transform.localPosition = item.Boundary.transform.localPosition; NGUITools.AddWidgetCollider(item.gameObject); item.State = GridItemState.None; slot.Items.Add(item); item.IsPlayerOwned = true; item.ClearParentGrid(); }
public MultiPropertyChangedCommand([NotNull] object[] targets, [NotNull] GridItem gridItem, [NotNull] object[] oldValues) // ReSharper disable once AssignNullToNotNullAttribute : this(targets, gridItem.PropertyDescriptor, oldValues, gridItem.Value) { }
public static void RecolorMask(GridItem u, int color, GridMask attackMask) { RecolorRange(color, GetSlotsInMask(u.gridX, u.gridY, attackMask)); }
private void AsGroupRow(GridItem item) { item.Type = GridItemType.GroupRow; }
protected void gv_competencia_UpdateCommand(object source, GridCommandEventArgs e) { try { lblmensaje.Text = ""; Conexion Ocoon = new Conexion(); GridItem item = gv_competencia.Items[e.Item.ItemIndex]; Label lbl_id_regcompetencia = (Label)item.FindControl("lblregcompetencia"); int iid_regcompetencia = Convert.ToInt32(lbl_id_regcompetencia.Text.Trim()); CheckBox ckvalidado = (CheckBox)item.FindControl("cb_validar"); //psalas, 16/08/2011, se agrega esta logica porque en la tabla ope_reporte_competencia, //los validados se consideran como 0 y los invalidados como 1 if (ckvalidado.Checked == true) { ckvalidado.Checked = false; } else { ckvalidado.Checked = true; } List <object> ArrayEditorValue = new List <object>(); GridEditableItem editedItem = e.Item as GridEditableItem; GridEditManager editMan = editedItem.EditManager; foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns) { if (column is IGridEditableColumn) { IGridEditableColumn editableCol = (column as IGridEditableColumn); if (editableCol.IsEditable) { IGridColumnEditor editor = editMan.GetColumnEditor(editableCol); string editorType = editor.ToString(); string editorText = "unknown"; object editorValue = null; if (editor is GridNumericColumnEditor) { editorText = (editor as GridNumericColumnEditor).Text; editorValue = (editor as GridNumericColumnEditor).NumericTextBox.DbValue; ArrayEditorValue.Add(editorValue); } if (editor is GridDateTimeColumnEditor) { editorText = (editor as GridDateTimeColumnEditor).Text; editorValue = (editor as GridDateTimeColumnEditor).PickerControl; ArrayEditorValue.Add(editorValue); } } } } DateTime promocionini = Convert.ToDateTime((ArrayEditorValue[0] as RadDateTimePicker).SelectedDate); DateTime promocionfin = Convert.ToDateTime((ArrayEditorValue[1] as RadDateTimePicker).SelectedDate); string precioregular = ArrayEditorValue[2].ToString(); //psalas. 16/08/2011. se agrega preciooferta por requerimiento san fernando string preciooferta = ArrayEditorValue[3].ToString(); string strpromocionini = Convert.ToString(promocionini); string strpromocionfin = Convert.ToString(promocionfin); Ocoon.ejecutarDataReader("UP_WEBXPLORA_OPE_ACTUALIZAR_REPORTE_COMPETENCIA_SF_MODERNO", iid_regcompetencia, precioregular, preciooferta, strpromocionini, strpromocionfin, Session["sUser"].ToString(), DateTime.Now, ckvalidado.Checked); cargarGrilla_Competencias(); } catch (Exception ex) { lblmensaje.Text = ex.ToString(); Response.Redirect("~/err_mensaje_seccion.aspx", true); } }
private void AsMaster(GridItem item) { if (creatorData.HasDetailTemplate) { item.State |= GridItemStates.Master; } }
public void Decorate(IGridRowBuilder rowBuilder, GridItem gridItem, bool hasDetailView) { CurrentGridItem = gridItem; DecoratedRowBuilder = rowBuilder; HasDetailView = hasDetailView; }
public override bool ShouldDecorate(GridItem item) { return(item.Type == GridItemType.EditRow || item.Type == GridItemType.InsertRow); }
/// <summary> /// Telerik compatible extension function for each individual bound item to get the actual type bound /// </summary> /// <typeparam name="T"></typeparam> /// <param name="item"></param> /// <returns></returns> protected T DataItemAs <T>(GridItem item) where T : class { return(item.DataItem as T); }
public abstract bool ShouldDecorate(GridItem gridItem);