/// <summary> /// Called when a search result is selected. /// </summary> /// <param name="guid">The <see cref="Guid"/> of the selected resource.</param> /// <remarks>Runs on the UI thread.</remarks> void search_OnResultSelected(Guid guid) { // If the tree already has it, then ignore this after telling the user if (ResourceTree.ResourceExistsInTree(guid)) { MessageBox.Show("The selected item is already present."); return; } GetResourceJob.UpdateUIDelegate actUpdateUI = GetResourceCallback; MetaAsset ma = new MetaAsset(guid, _couchdb); Version resource = new Version(ma, _couchdb); ResourceTree.StartDownload(resource, Master.JobType.CheckoutJob); _workMaster.AddJob(new JobArgs() { CouchDB = _couchdb, ErrorManager = ErrorManager, FileSystem = FileSystem, JobType = Master.JobType.CheckoutJob, ProgressMethod = JobBase.ProgressMethodType.Determinate, RequestingUser = TEMP_USERNAME, Requestor = this, Resource = resource, Timeout = 100000, UpdateUICallback = actUpdateUI }); }
/// <summary> /// Handles the Click event of the BtnGetSelected control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> /// <remarks>Runs on the UI thread.</remarks> private void BtnGetSelected_Click(object sender, RoutedEventArgs e) { GetResourceJob.UpdateUIDelegate actUpdateUI = GetResourceCallback; if (ResourceTree.Selected == null) { MessageBox.Show("You must select a resource first."); return; } ResourceTree.StartDownload(ResourceTree.Selected, Master.JobType.GetResource); _workMaster.AddJob(new JobArgs() { CouchDB = _couchdb, ErrorManager = ErrorManager, FileSystem = FileSystem, JobType = Master.JobType.GetResource, RequestingUser = TEMP_USERNAME, Requestor = this, Resource = ResourceTree.Selected, Timeout = 150000, UpdateUICallback = actUpdateUI }); }