Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
        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
            });
        }
Ejemplo n.º 3
0
        /// <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
        }
Ejemplo n.º 4
0
        //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);
                });
            }
        }
Ejemplo n.º 5
0
 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);
     }
 }
Ejemplo n.º 6
0
    private void Awake()
    {
        if (instance != null)
        {
            Debug.LogWarning("There is several instances of ControlParameters in the scene !");
            return;
        }

        instance = this;
    }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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();
            }
        }
Ejemplo n.º 9
0
        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();
            }
        }
Ejemplo n.º 10
0
        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);
 }
Ejemplo n.º 12
0
        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();
            }
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        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);
        }
Ejemplo n.º 15
0
        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;
            }
        }
Ejemplo n.º 16
0
        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;
            }
        }
Ejemplo n.º 17
0
        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}");
            }
        }
Ejemplo n.º 18
0
        /// <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());
        }
Ejemplo n.º 19
0
 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;
         }
     }
 }
Ejemplo n.º 20
0
        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;
            }
        }
Ejemplo n.º 21
0
        /// <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());
        }
Ejemplo n.º 22
0
 /// <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>();
 }
Ejemplo n.º 24
0
 /// <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");
 }
Ejemplo n.º 25
0
 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));
 }
Ejemplo n.º 26
0
		public UIHintAttribute (string uiHint, string presentationLayer, params object [] controlParameters)
		{
			UIHint = uiHint;
			PresentationLayer = presentationLayer;
			this.controlParameters = new ControlParameters (controlParameters);
		}
Ejemplo n.º 27
0
 // Start is called before the first frame update
 void Start()
 {
     controlParameters = GameObject.Find("ControlParameters").GetComponent <ControlParameters>();
     Init();
     ResetParameters();
 }
Ejemplo n.º 28
0
 /// <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);
 }