Exemple #1
0
        /// <summary>
        /// Sets the named property
        /// </summary>
        /// <param name='type'>
        /// Type.
        /// </param>
        /// <param name='name'>
        /// Name.
        /// </param>
        /// <param val='value'>
        /// property value
        /// </param>
        public void SetProperty(object obj, string name, object val)
        {
            // send request
            var req = new CLRSetPropertyMessage(obj, name, val);

            CLRMessage.Write(_cout, req);

            // get response (to make sure is not an exception)
            CLRMessage.ReadValue(_cin);
        }
Exemple #2
0
 /// <summary>
 /// Sets property on object.
 /// </summary>
 /// <param name="req">Req.</param>
 private void HandleSetProperty(CLRSetPropertyMessage req)
 {
     try
     {
         // get object
         var obj = ToLocalObject(req.Obj);
         // invoke
         _api.SetProperty(obj, req.PropertyName, req.Value);
         CLRMessage.WriteValue(_cout, null);
     }
     catch (TargetInvocationException te)
     {
         CLRMessage.WriteValue(_cout, te.GetBaseException());
     }
     catch (Exception e)
     {
         CLRMessage.WriteValue(_cout, e);
     }
 }