Ejemplo n.º 1
0
        void ResourceTree_OnReload(ResourceTreeView.State state)
        {
            CheckUpdateStatusJob.UpdateUIDelegate actUpdateUI = null;

            switch (state.JobType)
            {
            case Master.JobType.CheckoutJob:
                actUpdateUI = GetResourceCallback;
                break;

            case Master.JobType.CheckUpdateStatus:
                actUpdateUI = CheckUpdateStatus;
                break;

            case Master.JobType.CreateResource:
                // TODO
                // This needs to delete the resource from CouchDB and then
                // create the resource on CouchDB again.
                throw new NotImplementedException();
                break;

            case Master.JobType.GetResource:
                actUpdateUI = GetResourceCallback;
                break;

            case Master.JobType.ReleaseResource:
                actUpdateUI = ReleaseResourceCallback;
                break;

            case Master.JobType.SaveResource:
                actUpdateUI = SaveResourceCallback;
                break;

            default:
                throw new InvalidOperationException("Unknown job type to retry.");
            }

            _workMaster.AddJob(new JobArgs()
            {
                CouchDB          = _couchdb,
                ErrorManager     = ErrorManager,
                FileSystem       = FileSystem,
                JobType          = state.JobType,
                RequestingUser   = TEMP_USERNAME,
                Requestor        = this,
                Resource         = state.Resource,
                Timeout          = (uint)Settings.Instance.NetworkTimeout,
                UpdateUICallback = actUpdateUI
            });
        }