Ejemplo n.º 1
0
        protected static void CreateProfileActivity(IChatterService service, string employeeId, string xml)
        {
            var element = XElement.Parse(xml);

            var code = GetElementValue(element, "{http://ns.opensocial.org/2008/opensocial}title");
            var body = GetElementValue(element, "{http://ns.opensocial.org/2008/opensocial}body", code);

            var postedTimeStr = GetElementValue(element, "{http://ns.opensocial.org/2008/opensocial}postedTime"); ;
            DateTime postedTime = ConvertUnixEpochTime(postedTimeStr);

            service.CreateProfileActivity(employeeId, code, body, postedTime);
        }
Ejemplo n.º 2
0
 public void GetActivities(Object stateInfo)
 {
     // login if needed
     lock (this)
     {
         try
         {
             if (_service == null)
             {
                 _service = new ChatterService(url);
                 _service.Login(userName, password, token);
             }
             Activity lastActivity = latestList.Count > 0 ? latestList[0] : null;
             List<Activity> newActivities = _service.GetProfileActivities(lastActivity, cacheCapacity);
             if (newActivities.Count > 0)
             {
                 lock (latestList)
                 {
                     latestList.AddRange(newActivities);
                     latestList.Sort(new ActivitiesComparer());
                     latestList.RemoveRange(cacheCapacity, latestList.Count - cacheCapacity);
                 }
             }
         }
         catch (Exception e)
         {
             _service = null;
         }
     }
 }
 public ChatterController(IChatterService chatterService)
 {
     _chatterService = chatterService;
 }