//从单元输入数值 private void inputValues() { try { ValueTransform valueT = UnitVary.Value; NUD_ScaleX.Value = (decimal)valueT.scale.X; NUD_ScaleY.Value = (decimal)valueT.scale.Y; NUD_Rotate.Value = (decimal)valueT.rotateDegree; //NUD_ShearX.Value = (decimal)unit.shearX; //NUD_ShearY.Value = (decimal)unit.shearY; NUD_PosX.Value = (decimal)valueT.pos.X; NUD_PosY.Value = (decimal)valueT.pos.Y; NUD_AnchorX.Value = (decimal)valueT.anchor.X; NUD_AnchorY.Value = (decimal)valueT.anchor.Y; NUD_SizeW.Value = (decimal)Math.Abs(valueT.scale.X * Unit.getSize().Width); NUD_SizeH.Value = (decimal)Math.Abs(valueT.scale.Y * Unit.getSize().Height); NUD_Alpha.Value = (decimal)valueT.alpha; RectangleF box = Unit.getTransformBox(); textBox_RoomW.Text = "" + MathUtil.get2PlaceFloat(Math.Abs(box.Width)); textBox_RoomH.Text = "" + MathUtil.get2PlaceFloat(Math.Abs(box.Height)); } catch (Exception e) { Console.WriteLine(e.Message); } }
/// <summary> /// Gets the new BLOB value property. /// </summary> /// <param name="item">The item.</param> /// <returns></returns> private byte[] getNewBlobValueProperty(ProtocolEvent item) { if (item == null) { return(null); } // check for operation type: NewBlobValue stored for InitialValueAssigned && ObjectChanged operation if (!(new[] { ProtocolEventType.InitialValueAssigned, ProtocolEventType.ObjectChanged }).Contains(item.ProtocolEventType)) { return(null); } // convert item.NewValue to blob if needed var blobValue = ValueTransform.ConvertToBlob(item.NewValue); return(blobValue); }
/// <summary> /// The set transform. /// </summary> /// <param name="d"> /// The d. /// </param> /// <param name="transformation"> /// The transformation. /// </param> /// <exception cref="InvalidOperationException"> /// </exception> private static void SetTransform(DependencyObject d, ValueTransform transformation) { var ssvc = (ValueFilter)d; if (ssvc != null) { if (ssvc.TransformMode != ValueTransform.None) { throw new InvalidOperationException( string.Format( "ValueTransform has already been set to {0} for this ValueFilter", ssvc.TransformMode)); } ssvc.TransformMode = transformation; } }
/// <summary> /// The set transform. /// </summary> /// <param name="d"> /// The d. /// </param> /// <param name="transformation"> /// The transformation. /// </param> /// <exception cref="InvalidOperationException"> /// </exception> private static void SetTransform(DependencyObject d, ValueTransform transformation) { var ssvc = (ValueFilter) d; if (ssvc != null) { if (ssvc.TransformMode != ValueTransform.None) { throw new InvalidOperationException( string.Format( "ValueTransform has already been set to {0} for this ValueFilter", ssvc.TransformMode)); } ssvc.TransformMode = transformation; } }
protected void CustomBind(string name, ValueTransform translator) { bind_functions.Add(name, translator); }
static void DelegateAssignment() { ValueTransform vtx = Cube; double v25 = vtx(5); }
/// <summary> /// Persists the session events. /// </summary> /// <param name="persistSession">The session.</param> private void persistSessionEvents(Session persistSession) { if (ProtocolEvents.Count == 0 && AllChildren.Count == 0) { return; } // create or find protocol session for current session data var protocolSession = getProtocolSession(persistSession); protocolSession.StartedOn = StartedOn; protocolSession.CommitedOn = CommitedOn; double timeOffset = 0; // for each protocol event create protocol record foreach (var protocolEvent in ProtocolEvents.OrderBy(x => x.EventId)) { if (protocolEvent.IsNotForProtocol) { continue; } var protocolRecord = new ProtocolRecord(persistSession); if (protocolEvent.Target != null) { protocolRecord.AuditedObject = new AuditedObjectWeakReference(persistSession, protocolEvent.Target); } protocolRecord.ProtocolSession = protocolSession; protocolRecord.OperationType = protocolEvent.ProtocolEventType.ToString(); protocolRecord.UserName = SecuritySystem.CurrentUserName; protocolRecord.Description = protocolEvent.Description; protocolRecord.ModifiedOn = protocolEvent.EventDateTime.AddMilliseconds(timeOffset += 3); protocolRecord.PropertyName = protocolEvent.PropertyName; if (protocolEvent.NewValue != null) { protocolRecord.NewValue = ValueTransform.ObjectToString(protocolEvent.NewValue); if (protocolEvent.NewValue is IXPObject) { protocolRecord.NewObject = new XPWeakReference(persistSession, protocolEvent.NewValue); } } if (protocolEvent.OldValue != null) { protocolRecord.OldValue = ValueTransform.ObjectToString(protocolEvent.OldValue); if (protocolEvent.OldValue is IXPObject) { protocolRecord.OldObject = new XPWeakReference(persistSession, protocolEvent.OldValue); } } protocolRecord.NewBlobValue = getNewBlobValueProperty(protocolEvent); // for ObjectCreated events replication key to current replication key value; otherwise // use event's replication key value protocolRecord.ReplicationKey = protocolEvent.ProtocolEventType == ProtocolEventType.ObjectCreated ? ExtensionsHelper.GetReplicationKey(protocolEvent.Target) : protocolEvent.ReplicationKey; } }