상속: Newtonsoft.Json.Linq.JObject
예제 #1
0
        public HCondition GetNotValue()
        {
            HCondition value = null;

            try
            {
                value = new HCondition(JObject.Parse(this["not"].ToString()));
            }
            catch (Exception e)
            {
                Debug.WriteLine("{0} : Can not fetch the not value attribute", e.ToString());
            }
            return(value);
        }
예제 #2
0
        public HCondition GetFilter()
        {
            HCondition filter = null;

            try
            {
                filter = new HCondition(this["filter"].ToObject <JObject>());
            }
            catch (Exception e)
            {
                Debug.WriteLine("{0} : Can not fetch the params attribute", e.ToString());
            }
            return(filter);
        }
예제 #3
0
 public void SetFilter(HCondition filter)
 {
     try
     {
         if (filter == null)
         {
             this.Remove("filter");
         }
         else
         {
             this["filter"] = filter;
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0} : Can not update the filter attribute", e.ToString());
     }
 }
예제 #4
0
 public void SetNotValue(HCondition value)
 {
     try
     {
         if (value == null)
         {
             this.Remove("not");
         }
         else
         {
             this["not"] = value;
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0} : Can not update the not value attribute", e.ToString());
     }
 }
예제 #5
0
 public HCommand(string cmd, JToken @params, HCondition filter)
 {
     SetCmd(cmd);
     SetParams(@params);
     SetFilter(filter);
 }
예제 #6
0
 /// <summary>
 /// Sets a filter to be applied to upcoming messages at the session level.
 /// </summary>
 /// <param name="filter"></param>
 /// <param name="messageDelegate"></param>
 public void SetFilter(HCondition filter, Action<HMessage> messageDelegate)
 {
     HMessage cmdMessage = BuildCommand("session", "hSetFilter", filter, null, null);
     this.filter = filter;
     cmdMessage.SetTimeout(options.GetMsgTimeout());
     Send(cmdMessage, messageDelegate);
 }
예제 #7
0
        /// <summary>
        /// since v0.5
        /// The client MUST be connected to access to this service.
        /// Allow a hubapp client to create a hMessage with a hCommand payload.
        /// </summary>
        /// <param name="actor"></param>
        /// <param name="cmd"></param>
        /// <param name="params"></param>
        /// <param name="filter"></param>
        /// <param name="mOptions"></param>
        /// <returns></returns>
        public HMessage BuildCommand(string actor, string cmd, JToken @params, HCondition filter, HMessageOptions mOptions)
        {
            if (actor == null || actor.Length <= 0)
                throw new MissingAttrException("actor");
            if (cmd == null || cmd.Length <= 0)
                throw new MissingAttrException("cmd");

            HCommand hcommand = new HCommand(cmd, @params, filter);

            HMessage hmessage = BuildMessage(actor, "hCommand", hcommand, mOptions);
            return hmessage;
        }
예제 #8
0
        private void setFilterBt_Click(object sender, RoutedEventArgs e)
        {
            HCondition filter = new HCondition();
            HArrayOfValue valueArray = new HArrayOfValue();
            valueArray.SetName("publisher");
            JArray ja = new JArray();
            ja.Add("urn:localhost:u1");
            ja.Add("urn:localhost:u2");
            valueArray.SetValues(ja);
            filter.SetInValue(valueArray);

            Debug.WriteLine("\n-- set filer --");
            Debug.WriteLine(filter);
            Debug.WriteLine("---------------\n");
          
            //Remove the filter.
            //HCondition filter = new HCondition(JObject.Parse("{}")); 
            client.SetFilter(filter, callback);
        }
예제 #9
0
 public void SetNotValue(HCondition value)
 {
     try
     {
         if (value == null)
             this.Remove("not");
         else
             this["not"] = value;
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0} : Can not update the not value attribute", e.ToString());
     }
 }
예제 #10
0
 public HCondition GetNotValue()
 {
     HCondition value = null;
     try
     {
         value = new HCondition(JObject.Parse(this["not"].ToString()));
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0} : Can not fetch the not value attribute", e.ToString());
     }
     return value;
 }
예제 #11
0
 public HCondition GetFilter()
 {
     HCondition filter = null;
     try
     {
         filter =  new HCondition(this["filter"].ToObject<JObject>());
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0} : Can not fetch the params attribute", e.ToString());
     }
     return filter;
 }
예제 #12
0
 public HCommand(string cmd, JToken @params, HCondition filter)
 {
     SetCmd(cmd);
     SetParams(@params);
     SetFilter(filter);
 }
예제 #13
0
 public void SetFilter(HCondition filter)
 {
     try
     {
         if (filter == null)
             this.Remove("filter");
         else
             this["filter"] = filter;
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0} : Can not update the filter attribute", e.ToString());
     }
 }