private void ExecuteRejectTask(object parameter) { Logger.AddTrace("Executing Reject Shared Task"); //Delete shared task ViewsManager.UnshareTask(this.SelectedSharedTask.MachineSource, this.SelectedSharedTask.ViewId, this.SelectedSharedTask.Task); this.SharedTasks.Remove(this.SelectedSharedTask); }
private void ExecuteAcceptTask(object parameter) { Logger.AddTrace("Executing Accept Shared Task"); var desiredViewTemplate = _dataManager.Views.Items.Where(v => v.Id == this.SelectedSharedTask.ViewId).FirstOrDefault(); if (desiredViewTemplate == null) { this.CreateViewTemplate(this.SelectedSharedTask.ViewId, this.SelectedSharedTask.ViewDescription); } var repositoryTasks = _entities[this.SelectedSharedTask.ViewId]; if (repositoryTasks == null) { Logger.AddWarning(string.Format("There is no valid repository '{0}/{1}' for the shared task '{2}'.", this.SelectedSharedTask.ViewId, this.SelectedSharedTask.ViewDescription, this.SelectedSharedTask.Task.Description)); return; } var addedTask = repositoryTasks.Items.Where(s => s.Id == this.SelectedSharedTask.Task.Id).FirstOrDefault(); if (addedTask == null) { repositoryTasks.Create(this.SelectedSharedTask.Task); } else { addedTask.Category = this.SelectedSharedTask.Task.Category; addedTask.Description = this.SelectedSharedTask.Task.Description; addedTask.Parameters = this.SelectedSharedTask.Task.Parameters; } //Download files if were shared this.DownloadFiles(this.SelectedSharedTask.MachineTarget, this.SelectedSharedTask.Task); //Delete shared task ViewsManager.UnshareTask(this.SelectedSharedTask.MachineSource, this.SelectedSharedTask.ViewId, this.SelectedSharedTask.Task); this.SharedTasks.Remove(this.SelectedSharedTask); }