示例#1
0
        public void OnActionCellSteppedTest()
        {
            List <CardType> receivedEvents = new List <CardType>();
            ActionCell      cell           = new ActionCell(1, 11, 1, 1, "Chance", "Chance", CardType.Chance);

            cell.CellStepped += (object sender, ActionCellEvtArgs e) => receivedEvents.Add(e.TypeCard);

            cell.Step();
            Assert.AreEqual(1, receivedEvents.Count);
            Assert.AreEqual(cell.TypeCard, receivedEvents[0]);
        }
示例#2
0
        public void BindActionCell(ActionCell ac, CellsListControlBase cellsList)
        {
            if (ac.Html.HasText())
            {
                ltlText.Text     = ac.Html;
                lbAction.Visible = false;
            }
            else
            {
                ltlText.Visible          = false;
                lbAction.Text            = ac.Text;
                lbAction.CommandArgument = ac.Row.Index.ToString();
                lbAction.CommandName     = ac.ActionType.ToString();

                if (ac.ActionType == ActionTypes.Edit)
                {
                    lbAction.CssClass += "button";
                    SetEditingRowMode(EditingRowMode.None, ac.Row.Index);
                }
                else if (ac.ActionType == ActionTypes.Delete)
                {
                    lbAction.CssClass += "close";

                    if (lbAction.Text.HasNoText())
                    {
                        lbAction.Text = "&times;";
                    }
                }
            }

            if (ac.Attributes != null)
            {
                AddTdHtmlTableCellAttributes(ac.Attributes);
            }

            if (ac.HideCell)
            {
                TdHtmlTableCell.Style.Add("display", "none");
            }

            CellsList = cellsList;

            if (ac.ActionType == ActionTypes.Custom)
            {
                lbCancel.Visible = false;

                var args = new ActionCellCustomBoundEventArgs(ac, this);

                CellsList.Body.GridControl.OnActionCellCustomBound(args);
            }
        }
 public ActionCellCustomBoundEventArgs(ActionCell ac, CellControlBase actionCellControl)
 {
     ActionCell        = ac;
     ActionCellControl = actionCellControl;
 }