当前位置: 首页>>代码示例>>C#>>正文


C# CellContext.EndEdit方法代码示例

本文整理汇总了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);
		}
开发者ID:Xavinightshade,项目名称:ipsimulator,代码行数:30,代码来源:Grid.cs

示例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;
					}
				}
			}
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:24,代码来源:CheckBox.cs

示例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;
							}
						}
					}
				}
			}
		}
开发者ID:Xavinightshade,项目名称:ipsimulator,代码行数:58,代码来源:CheckBox.cs

示例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);
				}
			}
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:39,代码来源:CheckBox.cs


注:本文中的CellContext.EndEdit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。