Ejemplo n.º 1
0
        public bool WorktrackerConnect()
        {
            try
            {
                /*
                 * var task = Task.Factory.StartNew(() =>
                 * {
                 *  try { return WorkTrackerConnection.GetRemoteService(); }
                 *  catch { return null; }
                 * });
                 * task.Wait(new TimeSpan(0, 0, 2));
                 * if (!task.IsCompleted)
                 *  throw new Exception("Could not establish connection to WT in time");
                 *
                 * worktracker = task.Result;
                 */
                worktracker = WorkTrackerConnection.GetRemoteService();
                if (worktracker == null)
                {
                    return(false);
                }

                if (currentUser == null)
                {
                    currentUser = worktracker.GetEmployeeForAuthenticatedUser();
                }
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                return(false);
            }
        }
Ejemplo n.º 2
0
 public void WorktrackerDisonnect()
 {
     worktracker = null;
 }