private Task DownloadTask(object taskId)
        {
            Task t = null;

            HiveClient.TryAndRepeat(() => {
                t = HiveServiceLocator.Instance.CallHiveService(s => s.GetTask((Guid)taskId));
            }, Settings.Default.MaxRepeatServiceCalls, "Failed to download task.");
            return(t);
        }
Exemplo n.º 2
0
 public static void StartJob(Action <Exception> exceptionCallback, RefreshableJob refreshableJob, CancellationToken cancellationToken)
 {
     HiveClient.StoreAsync(
         new Action <Exception>((Exception ex) => {
         refreshableJob.ExecutionState = ExecutionState.Prepared;
         exceptionCallback(ex);
     }), refreshableJob, cancellationToken);
     refreshableJob.ExecutionState = ExecutionState.Started;
 }
Exemplo n.º 3
0
 public static void UpdateJob(Action <Exception> exceptionCallback, RefreshableJob refreshableJob, CancellationToken cancellationToken)
 {
     refreshableJob.IsProgressing    = true;
     refreshableJob.Progress.Message = "Saving Job...";
     HiveClient.StoreAsync(
         new Action <Exception>((Exception ex) => {
         exceptionCallback(ex);
     }), refreshableJob.Job, cancellationToken);
     refreshableJob.IsProgressing = false;
     refreshableJob.Progress.Finish();
 }
Exemplo n.º 4
0
        public static void UpdateJob(RefreshableJob refreshableJob)
        {
            refreshableJob.IsProgressing = true;

            try {
                refreshableJob.Progress.Start("Saving Job...", ProgressMode.Indeterminate);
                HiveClient.StoreAsync(new Action <Exception>((Exception ex) => {
                    throw new Exception("Update failed.", ex);
                }), refreshableJob.Job, new CancellationToken());
            } finally {
                refreshableJob.IsProgressing = false;
                refreshableJob.Progress.Finish();
            }
        }
        protected Tuple <Task, TaskData> DownloadTaskData(Task task)
        {
            downloadSemaphore.WaitOne();
            TaskData result = null;

            try {
                if (abort)
                {
                    return(null);
                }
                HiveClient.TryAndRepeat(() => {
                    result = HiveServiceLocator.Instance.CallHiveService(s => s.GetTaskData(task.Id));
                }, Settings.Default.MaxRepeatServiceCalls, "Failed to download task data.");
            }
            finally {
                downloadSemaphore.Release();
            }
            return(new Tuple <Task, TaskData>(task, result));
        }
Exemplo n.º 6
0
        private void RemoveItems(IEnumerable <T> items, out IEnumerable <T> successful, out IEnumerable <T> unsuccessful, out Exception exception)
        {
            List <T> removed    = new List <T>();
            List <T> notremoved = new List <T>();

            exception = null;
            foreach (T item in items)
            {
                try {
                    HiveClient.Delete(item);
                    removed.Add(item);
                }
                catch (Exception ex) {
                    exception = ex;
                    notremoved.Add(item);
                }
            }
            successful   = removed;
            unsuccessful = notremoved;
        }
Exemplo n.º 7
0
 public virtual void Store()
 {
     HiveClient.Store(this, new System.Threading.CancellationToken());
     Modified = false;
 }