public void AssignParameterValues() { if (ControlParameters != null) { ControlParameters.Where(x => x.LinkedControl is IsValuable && (x.Parameter.Direction == ParameterDirection.InputOutput || x.Parameter.Direction == ParameterDirection.Output)).ToList().ForEach(p => ((IsValuable)p.LinkedControl).Value = p.Parameter.Value); } }
public void AddControlParameter(string pParamName, object ParamControl) { if (pParamName.Substring(0, 1) != "@") { pParamName = '@' + pParamName; } SqlParameter lParam; if (Parameters[pParamName] != null) { lParam = Parameters[pParamName]; } else { lParam = new SqlParameter() { ParameterName = pParamName }; Parameters.Add(lParam); } ControlParameters.Add(new ControlParameter() { Parameter = lParam, LinkedControl = ParamControl }); }
/// <summary> /// Test that not setting the any properties returns in an (almost) empty Blob /// </summary> /// public void testExceptionsThrown() { ControlParameters controlParameters = new ControlParameters(); Blob encoded = controlParameters.wireEncode(); Assert.AssertEquals(2, encoded.buf().limit()); // only TLV type 104 and length 0 should be set }
//public abstract void AssignOutputParameter(string ParamName, DbParameter pParam); public void AssignParameterValues() { if (ControlParameters != null) { ControlParameters.Where(x => x.LinkedControl is IsValuable).ToList().ForEach(p => { AddParameterValue(p.Parameter.ParameterName, ((IsValuable)p.LinkedControl).Value); }); } }
private static void Repaint(int id, Event e, ControlParameters param) { if (param.style != null) { bool bHover = param.rect.Contains(e.mousePosition); bool bActive = GUIUtility.hotControl == id; bool bKeyboardFocus = GUIUtility.keyboardControl == id; param.style.Draw(param.rect, param.content, bHover, bActive, param.bOn, bKeyboardFocus); } }
private void Awake() { if (instance != null) { Debug.LogWarning("There is several instances of ControlParameters in the scene !"); return; } instance = this; }
public static bool Label(Rect rect, bool selected, GUIContent content, GUIStyle style) { var param = new ControlParameters(labelHash, rect, content, style) { bOn = selected, onMouseDown = () => selected = true }; Control(param); return(selected); }
private static void MouseDrag(int id, Event e, ControlParameters param) { if (GUIUtility.hotControl == id) { if (param.onMouseDrag != null) { param.onMouseDrag(Event.current.delta); } Event.current.Use(); } }
private static void MouseDown(int id, Event e, ControlParameters param) { if (param.rect.Contains(e.mousePosition) && e.button == param.mouseButton) { if (param.onMouseDown != null) { param.onMouseDown(); } GUIUtility.hotControl = id; Event.current.Use(); } }
public virtual void AssignValuesParameters() { string _stage = "Assigning values to parameters"; try { ControlParameters.Where(x => x.LinkedControl is IsValuable && (x.Parameter.Direction == ParameterDirection.InputOutput || x.Parameter.Direction == ParameterDirection.Output)).ToList().ForEach(p => ((IsValuable)p.LinkedControl).Value = p.Parameter.Value); } catch (Exception ex) { throw new Exception($"[{this.GetType().Name}/{System.Reflection.MethodBase.GetCurrentMethod().Name}#{_stage}] {ex.Message}"); } }
private void Awake() { if (StaticControlParams) { Destroy(gameObject); } else { StaticControlParams = this; } LoadControlParameters(); FindObjectOfType <LevelHandler>().SetControlParameters(CameraSpeed, JoystickSensitivity, JoystickBoarderSize, FlySensitivity, TurnSensitivity, InverseReverse); }
private static void MouseUp(int id, Event e, ControlParameters param) { if (GUIUtility.hotControl == id && e.button == param.mouseButton) { if (param.onMouseUp != null) { param.onMouseUp(); } GUIUtility.hotControl = 0; Event.current.Use(); } }
public static Rect DragButton(Rect rect, GUIContent content, GUIStyle style) { var param = new ControlParameters(dragButtonHash, rect, content, style) { onMouseDrag = delta => { rect.x += delta.x; rect.y += delta.y; } }; Control(param); return(rect); }
private void InternalProcess() { IEnumerable <TradeDay> days = Initialize(); controlFileAvailable.Wait(); ControlParameters parameters = GetControlParameters(); IEnumerable <TradeDay> matchingDays = null; if (parameters != null) { matchingDays = from d in days where d.Date >= parameters.FromDate && d.Date <= parameters.ToDate && d.Volume >= parameters.Volume select d; } matchesFound(dataSource, matchingDays); }
private bool disposedValue = false; // To detect redundant calls protected override void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { Cmd.Dispose(); ControlParameters.Clear(); ControlParameters = null; } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } }
public void AddControlParameter(string ParamName, Object ParamControl) { SqlParameter lParam = new SqlParameter() { ParameterName = ParamName }; ControlParameters.Add(new ControlParameter() { Parameter = lParam, LinkedControl = ParamControl }); Parameters.Add(lParam); if (AutoUpdate && ParamControl is Control) { ((Control)ParamControl).TextChanged += RSFrame_TextChanged; } }
public void AssignParameterValues() { string _stage = "Assigning values to control parameters"; try { if (ControlParameters != null) { ControlParameters.Where(x => x.LinkedControl is IsValuable).ToList().ForEach(p => { AddParameterValues(p.Parameter.ParameterName, ((IsValuable)p.LinkedControl).Value); }); } } catch (Exception ex) { throw new Exception($"[{this.GetType().Name}/{System.Reflection.MethodBase.GetCurrentMethod().Name}#{_stage}] {ex.Message}"); } }
/// <summary> /// Test encoding/decoding with no name defined /// </summary> /// /// <exception cref="EncodingException"></exception> public void testEncodeDecodeWithNoName() { ControlParameters controlParameters = new ControlParameters(); controlParameters.setStrategy(new Name( "/localhost/nfd/strategy/broadcast")); controlParameters.setUri("null://"); // encode Blob encoded = controlParameters.wireEncode(); // decode ControlParameters decodedControlParameters = new ControlParameters(); decodedControlParameters.wireDecode(encoded); // compare Assert.AssertEquals(controlParameters.getStrategy().toUri(), decodedControlParameters.getStrategy().toUri()); Assert.AssertEquals(controlParameters.getUri(), decodedControlParameters.getUri()); }
public override void AddControlParameter(string ParamName, object ParamControl) { { SqlParameter lParam = new SqlParameter() { ParameterName = ParamName }; ControlParameters.Add(new ControlParameter() { Parameter = lParam, LinkedControl = ParamControl }); Parameters.Add(lParam); if (AutoUpdate && ParamControl is IsValuable) { ((IsValuable)ParamControl).TextChanged += RSFrame_TextChanged; } } }
public static void Control(ControlParameters param) { int id = GUIUtility.GetControlID(param.hash, FocusType.Passive); Event e = Event.current; switch (e.GetTypeForControl(id)) { case EventType.MouseDown: MouseDown(id, e, param); break; case EventType.MouseUp: MouseUp(id, e, param); break; case EventType.MouseDrag: MouseDrag(id, e, param); break; case EventType.Repaint: Repaint(id, e, param); break; } }
/// <summary> /// Test encoding/decoding /// </summary> /// /// <exception cref="EncodingException"></exception> public void testEncodeDecode() { ControlParameters controlParameters = new ControlParameters(); controlParameters.setName(new Name("/test/control/parameters")); controlParameters.setFaceId(1); // encode Blob encoded = controlParameters.wireEncode(); // decode ControlParameters decodedControlParameters = new ControlParameters(); decodedControlParameters.wireDecode(encoded); // compare Assert.AssertEquals(controlParameters.getName().toUri(), decodedControlParameters.getName().toUri()); Assert.AssertEquals(controlParameters.getFaceId(), decodedControlParameters.getFaceId()); Assert.AssertEquals("decoded forwarding flags childInherit is different", controlParameters.getForwardingFlags().getChildInherit(), decodedControlParameters.getForwardingFlags().getChildInherit()); Assert.AssertEquals("decoded forwarding flags capture is different", controlParameters.getForwardingFlags().getCapture(), decodedControlParameters.getForwardingFlags().getCapture()); }
/// <summary> /// Decode input as a control parameters and set the fields of the /// controlParameters object. Your derived class should override. /// </summary> /// /// <param name="controlParameters"></param> /// <param name="input"></param> /// <exception cref="System.NotSupportedException">for unimplemented if the derivedclass does not override.</exception> /// <exception cref="EncodingException">For invalid encoding.</exception> public virtual void decodeControlParameters(ControlParameters controlParameters, ByteBuffer input) { throw new NotSupportedException( "decodeControlParameters is not implemented"); }
// Start is called before the first frame update void Start() { hornetController = GetComponent <HornetController>(); cp = FindObjectOfType <ControlParameters>(); }
/// <summary> /// Encode controlParameters and return the encoding. /// Your derived class should override. /// </summary> /// /// <param name="controlParameters">The ControlParameters object to encode.</param> /// <returns>A Blob containing the encoding.</returns> /// <exception cref="System.NotSupportedException">for unimplemented if the derivedclass does not override.</exception> public virtual Blob encodeControlParameters(ControlParameters controlParameters) { throw new NotSupportedException( "encodeControlParameters is not implemented"); }
public void AssignValuesParameters() { ControlParameters.Where(x => x.LinkedControl is IsValuable && (x.Parameter.Direction == ParameterDirection.InputOutput || x.Parameter.Direction == ParameterDirection.Output)).ToList().ForEach(p => AddParameterValue(p.Parameter.ParameterName, ((IsValuable)p.LinkedControl).Value)); }
public UIHintAttribute (string uiHint, string presentationLayer, params object [] controlParameters) { UIHint = uiHint; PresentationLayer = presentationLayer; this.controlParameters = new ControlParameters (controlParameters); }
// Start is called before the first frame update void Start() { controlParameters = GameObject.Find("ControlParameters").GetComponent <ControlParameters>(); Init(); ResetParameters(); }
/// <summary> /// Decode input as a control parameters and set the fields of the /// controlParameters object. Copy from the input when making new Blob values. /// Your derived class should override. /// </summary> /// /// <param name="controlParameters"></param> /// <param name="input"></param> /// <exception cref="System.NotSupportedException">for unimplemented if the derivedclass does not override.</exception> /// <exception cref="EncodingException">For invalid encoding.</exception> public void decodeControlParameters( ControlParameters controlParameters, ByteBuffer input) { decodeControlParameters(controlParameters, input, true); }