コード例 #1
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);
 }
コード例 #2
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);
        }
コード例 #3
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;
        }
コード例 #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 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;
 }
コード例 #6
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;
 }
コード例 #7
0
 public HCommand(string cmd, JToken @params, HCondition filter)
 {
     SetCmd(cmd);
     SetParams(@params);
     SetFilter(filter);
 }
コード例 #8
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());
     }
 }