本文整理汇总了C#中CellContext.EndEdit方法的典型用法代码示例。如果您正苦于以下问题:C# CellContext.EndEdit方法的具体用法?C# CellContext.EndEdit怎么用?C# CellContext.EndEdit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CellContext
的用法示例。
在下文中一共展示了CellContext.EndEdit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: grid_MouseDown
protected virtual void grid_MouseDown(GridVirtual sender, System.Windows.Forms.MouseEventArgs e)
{
//verifico che l'eventuale edit sia terminato altrimenti esco
if (sender.Selection.ActivePosition.IsEmpty() == false)
{
CellContext focusCell = new CellContext(sender, sender.Selection.ActivePosition);
if (focusCell.Cell != null && focusCell.IsEditing())
{
if (focusCell.EndEdit(false) == false)
return;
}
}
//scateno eventi di MouseDown
Position position = sender.PositionAtPoint( new Point(e.X, e.Y) );
if (position.IsEmpty() == false)
{
Cells.ICellVirtual cellMouseDown = sender.GetCell(position);
if (cellMouseDown != null)
{
sender.ChangeMouseDownCell(position, position);
//Cell.OnMouseDown
CellContext cellContext = new CellContext(sender, position, cellMouseDown);
sender.Controller.OnMouseDown(cellContext, e);
}
}
else
sender.ChangeMouseDownCell(Position.Empty, Position.Empty);
}
示例2: AutoChangeValues
private void AutoChangeValues(CellContext sender, bool newVal)
{
foreach(Position pos in sender.Grid.Selection.GetSelectionRegion().GetCellsPositions())
{
Cells.ICellVirtual c = sender.Grid.GetCell(pos);
Models.ICheckBox check;
if (c != this && c != null &&
(check = (Models.ICheckBox)c.Model.FindModel(typeof(Models.ICheckBox))) != null )
{
CellContext context = new CellContext(sender.Grid, pos, c);
context.StartEdit();
try
{
check.SetCheckedValue(context, newVal);
context.EndEdit(false);
}
catch(Exception)
{
context.EndEdit(true);
throw;
}
}
}
}
示例3: UIChangeChecked
/// <summary>
/// Toggle the value of the current cell and if AutoChangeValueOfSelectedCells is true of all the selected cells.
/// Simulate an edit operation.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void UIChangeChecked(CellContext sender, EventArgs e)
{
Models.ICheckBox checkModel = (Models.ICheckBox)sender.Cell.Model.FindModel(typeof(Models.ICheckBox));;
if (checkModel == null)
throw new SourceGrid.SourceGridException("Models.ICheckBox not found");
Models.CheckBoxStatus checkStatus = checkModel.GetCheckBoxStatus(sender);
if (checkStatus.CheckEnable)
{
bool newVal = true;
if (checkStatus.Checked != null)
newVal = !checkStatus.Checked.Value;
sender.StartEdit();
try
{
checkModel.SetCheckedValue(sender, newVal);
sender.EndEdit(false);
}
catch(Exception)
{
sender.EndEdit(true);
throw;
}
//change the status of all selected control
if (AutoChangeValueOfSelectedCells)
{
foreach(Position pos in sender.Grid.Selection.GetSelectionRegion().GetCellsPositions())
{
Cells.ICellVirtual c = sender.Grid.GetCell(pos);
Models.ICheckBox check;
if (c != this && c != null &&
(check = (Models.ICheckBox)c.Model.FindModel(typeof(Models.ICheckBox))) != null )
{
CellContext context = new CellContext(sender.Grid, pos, c);
context.StartEdit();
try
{
check.SetCheckedValue(context, newVal);
context.EndEdit(false);
}
catch(Exception)
{
context.EndEdit(true);
throw;
}
}
}
}
}
}
示例4: UIChangeChecked
/// <summary>
/// Toggle the value of the current cell and if AutoChangeValueOfSelectedCells is true of all the selected cells.
/// Simulate an edit operation.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void UIChangeChecked(CellContext sender, EventArgs e)
{
Models.ICheckBox checkModel = (Models.ICheckBox)sender.Cell.Model.FindModel(typeof(Models.ICheckBox));;
if (checkModel == null)
throw new SourceGrid.SourceGridException("Models.ICheckBox not found");
Models.CheckBoxStatus checkStatus = checkModel.GetCheckBoxStatus(sender);
if (checkStatus.CheckEnable)
{
bool newVal = true;
if (checkStatus.Checked != null)
newVal = !checkStatus.Checked.Value;
sender.StartEdit();
try
{
checkModel.SetCheckedValue(sender, newVal);
sender.EndEdit(false);
OnCheckedChanged(EventArgs.Empty);
}
catch(Exception ex)
{
sender.EndEdit(true);
throw new Exception(string.Empty, ex);
}
//change the status of all selected control
if (AutoChangeValueOfSelectedCells)
{
AutoChangeValues(sender, newVal);
}
}
}