コード例 #1
0
        public void SetValue(CellContext cellContext, object p_Value)
        {
            //Выдергиваю текущее значение
            Map    map      = (cellContext.Grid as FRom.Grid.FRomGrid).DataSource;
            object oldValue = map[
                cellContext.Position.Column - cellContext.Grid.FixedColumns,
                cellContext.Position.Row - cellContext.Grid.FixedRows,
                null];

            SourceGrid.ValueChangeEventArgs valArgs = new SourceGrid.ValueChangeEventArgs(oldValue, p_Value);

            if (cellContext.Grid != null)
            {
                cellContext.Grid.Controller.OnValueChanging(cellContext, valArgs);
            }

            map[
                cellContext.Position.Column - cellContext.Grid.FixedColumns,
                cellContext.Position.Row - cellContext.Grid.FixedRows,
                null] = p_Value;

            if (cellContext.Grid != null)
            {
                cellContext.Grid.Controller.OnValueChanged(cellContext, EventArgs.Empty);
            }
        }
コード例 #2
0
        public override void OnValueChanging(CellContext sender, ValueChangeEventArgs e)
        {
            base.OnValueChanging(sender, e);

            //BeginEdit on the row, set the Cancel = true if failed to start editing.
            bool success = ((DataGrid)sender.Grid).BeginEditRow(sender.Position.Row);

            if (success == false)
            {
                throw new SourceGridException("Failed to editing row " + sender.Position.Row.ToString());
            }
        }
コード例 #3
0
ファイル: ArrayGrid.cs プロジェクト: Sphere10/Framework
        public virtual void SetValue(CellContext cellContext, object p_Value)
        {
            Array  array    = ((ArrayGrid)cellContext.Grid).DataSource;
            object oldValue = array.GetValue(cellContext.Position.Row - cellContext.Grid.FixedRows, cellContext.Position.Column - cellContext.Grid.FixedColumns);
            ValueChangeEventArgs valArgs = new ValueChangeEventArgs(oldValue, p_Value);

            if (cellContext.Grid != null)
            {
                cellContext.Grid.Controller.OnValueChanging(cellContext, valArgs);
            }

            array.SetValue(p_Value, cellContext.Position.Row - cellContext.Grid.FixedRows, cellContext.Position.Column - cellContext.Grid.FixedColumns);

            if (cellContext.Grid != null)
            {
                cellContext.Grid.Controller.OnValueChanged(cellContext, EventArgs.Empty);
            }
        }
コード例 #4
0
ファイル: FRomValueModel.cs プロジェクト: vc/from-editor
        public void SetValue(CellContext cellContext, object p_Value)
        {
            //Выдергиваю текущее значение
            Map map = (cellContext.Grid as FRom.Grid.FRomGrid).DataSource;
            object oldValue = map[
                cellContext.Position.Column - cellContext.Grid.FixedColumns,
                cellContext.Position.Row - cellContext.Grid.FixedRows,
                null];

            SourceGrid.ValueChangeEventArgs valArgs = new SourceGrid.ValueChangeEventArgs(oldValue, p_Value);

            if (cellContext.Grid != null)
                cellContext.Grid.Controller.OnValueChanging(cellContext, valArgs);

            map[
                cellContext.Position.Column - cellContext.Grid.FixedColumns,
                cellContext.Position.Row - cellContext.Grid.FixedRows,
                null] = p_Value;

            if (cellContext.Grid != null)
                cellContext.Grid.Controller.OnValueChanged(cellContext, EventArgs.Empty);
        }
コード例 #5
0
ファイル: DataGrid.cs プロジェクト: Sphere10/Framework
        public void SetValue(CellContext cellContext, object value)
        {
            DataGrid           grid     = (DataGrid)cellContext.Grid;
            PropertyDescriptor prop     = grid.Columns[cellContext.Position.Column].PropertyColumn;
            object             oldValue = GetValue(cellContext);

            ValueChangeEventArgs valArgs = new ValueChangeEventArgs(oldValue, value);

            if (cellContext.Grid != null)
            {
                cellContext.Grid.Controller.OnValueChanging(cellContext, valArgs);
            }



            grid.DataSource.SetEditValue(prop, valArgs.NewValue);

            if (cellContext.Grid != null)
            {
                cellContext.Grid.Controller.OnValueChanged(cellContext, EventArgs.Empty);
            }
        }
コード例 #6
0
        public void SetValue(CellContext cellContext, object value)
        {
            DataGrid           grid     = (DataGrid)cellContext.Grid;
            PropertyDescriptor prop     = grid.Columns[cellContext.Position.Column].PropertyColumn;
            object             oldValue = GetValue(cellContext);

            //[email protected]: if value is the same,
            //no need to trigger value changed event or to write back to datasource.
            string oldText = oldValue == null ? string.Empty : oldValue.ToString();
            string newText = value == null ? string.Empty : value.ToString();

            if (newText == oldText)
            {
                return;
            }

            ValueChangeEventArgs valArgs = new ValueChangeEventArgs(oldValue, value);

            if (cellContext.Grid != null)
            {
                cellContext.Grid.Controller.OnValueChanging(cellContext, valArgs);
            }

            //[email protected]: ValueChanging event will be used for validation
            //If operation cancelled then return without setting database. i.e., reject changes
            if (valArgs.Cancel)
            {
                return;
            }

            grid.DataSource.SetEditValue(prop, valArgs.NewValue);

            if (cellContext.Grid != null)
            {
                cellContext.Grid.Controller.OnValueChanged(cellContext, EventArgs.Empty);
            }
        }
コード例 #7
0
ファイル: ArrayGrid.cs プロジェクト: wsrf2009/KnxUiEditor
		public virtual void SetValue(CellContext cellContext, object p_Value)
		{
			Array array = ((ArrayGrid)cellContext.Grid).DataSource;
			object oldValue = array.GetValue(cellContext.Position.Row - cellContext.Grid.FixedRows, cellContext.Position.Column - cellContext.Grid.FixedColumns);
			ValueChangeEventArgs valArgs = new ValueChangeEventArgs(oldValue, p_Value);
			if (cellContext.Grid != null)
				cellContext.Grid.Controller.OnValueChanging(cellContext, valArgs);

			array.SetValue(p_Value, cellContext.Position.Row - cellContext.Grid.FixedRows, cellContext.Position.Column - cellContext.Grid.FixedColumns);

			if (cellContext.Grid != null)
				cellContext.Grid.Controller.OnValueChanged(cellContext, EventArgs.Empty);
		}
コード例 #8
0
ファイル: DataGrid.cs プロジェクト: wsrf2009/KnxUiEditor
		public override void OnValueChanging(CellContext sender, ValueChangeEventArgs e)
		{
			base.OnValueChanging (sender, e);

			//BeginEdit on the row, set the Cancel = true if failed to start editing.
			bool success = ((DataGrid)sender.Grid).BeginEditRow(sender.Position.Row);
			if (success == false)
				throw new SourceGridException("Failed to editing row " + sender.Position.Row.ToString());
		}
コード例 #9
0
ファイル: DataGrid.cs プロジェクト: wsrf2009/KnxUiEditor
		public void SetValue(CellContext cellContext, object value)
		{
			DataGrid grid = (DataGrid)cellContext.Grid;
			PropertyDescriptor prop = grid.Columns[cellContext.Position.Column].PropertyColumn;
			object oldValue = GetValue(cellContext);
			
			ValueChangeEventArgs valArgs = new ValueChangeEventArgs(oldValue, value);
			if (cellContext.Grid != null)
				cellContext.Grid.Controller.OnValueChanging(cellContext, valArgs);

			

			

			grid.DataSource.SetEditValue(prop, valArgs.NewValue);

			if (cellContext.Grid != null)
				cellContext.Grid.Controller.OnValueChanged(cellContext, EventArgs.Empty);
		}