private void Login(string username, string password)
        {
            JObject data = new JObject();

            try
            {
                data.Add("login", username);
                data.Add("password", password);
                data.Add("sent", HUtil.DateTime2Timestamps(DateTime.UtcNow));
                if (options.Context != null)
                {
                    data.Add("context", options.Context);
                }

                socketIO.Emit("hConnect", data);
            }
            catch (Exception e)
            {
                if (socketIO != null)
                {
                    Disconnect();
                }
                if (connTimeoutTimer != null)
                {
                    connTimeoutTimer.Cancel();
                    connTimeoutTimer = null;
                }
                updateStatus(ConnectionStatus.DISCONNECTED, ConnectionErrors.TECH_ERROR, e.Message);
            }
        }
示例#2
0
 public void SetPublished(DateTime?published)
 {
     try
     {
         if (published == null)
         {
             this.Remove("published");
         }
         else
         {
             this["published"] = HUtil.DateTime2Timestamps(published.Value);
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0} : Can not update the published attribute", e.ToString());
     }
 }
示例#3
0
 public void SetRelevance(DateTime?relevance)
 {
     try
     {
         if (relevance == null)
         {
             this.Remove("relevance");
         }
         else
         {
             this["relevance"] = HUtil.DateTime2Timestamps(relevance.Value);
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0} : Can not update the relevance attribute", e.ToString());
     }
 }
示例#4
0
 public void SetSent(DateTime?sent)
 {
     try
     {
         if (sent == null)
         {
             this.Remove("sent");
         }
         else
         {
             this["sent"] = HUtil.DateTime2Timestamps(sent.Value);
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0} : Can not update the sent attribute", e.ToString());
     }
 }