public JobCreationWorker(JobListManager jobListManager, DistributedJob jobToDistribute) { this.jobListManager = jobListManager; this.jobToDistribute = jobToDistribute; DoWork += JobCreationWorkerDoWork; }
private void BackgroundCreationWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { P2PEditor.GuiLogMessage("Distributed job " + newDistributedJob.Guid, NotificationLevel.Debug); DataContext = new DistributedJob(); P2PEditorPresentation.ShowActiveJobs(); P2PEditorPresentation.ActiveJobsControl.JobListBox.SelectedIndex = 0; }
private void BackgroundCreationWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { P2PEditor.GuiLogMessage(String.Format(Properties.Resources.Distributed_job__0_, newDistributedJob.Guid), NotificationLevel.Debug); DataContext = new DistributedJob(); P2PEditorPresentation.ShowActiveJobsView(); P2PEditorPresentation.JobDisplay.JobListBox.SelectedIndex = 0; }
public JobParticipationWorker(P2PEditor p2PEditor, JobListManager jobListManager, DistributedJob jobToParticipateIn, Dispatcher dispatcher) { this.p2PEditor = p2PEditor; this.jobListManager = jobListManager; this.jobToParticipateIn = jobToParticipateIn; this.dispatcher = dispatcher; DoWork += JobParticipationWorkerDoWork; }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { DataContext = new DistributedJob(); try { if (!Clipboard.ContainsText(TextDataFormat.Text)) { return; } var clipboardData = Clipboard.GetText(TextDataFormat.Text); if (clipboardData.EndsWith("-status")) { ((DistributedJob)DataContext).StatusKey = clipboardData; } } catch (OutOfMemoryException) { // If clipboard content is to large, no status key is available. } }
private void ShareButton_Click(object sender, RoutedEventArgs e) { // Validate input newDistributedJob = (DistributedJob)DataContext; if (newDistributedJob.Description == null || newDistributedJob.Name == null) { P2PEditor.GuiLogMessage("Please fill all fields.", NotificationLevel.Error); return; } if (!File.Exists(newDistributedJob.LocalFilePath)) { // TODO validate that selected file contains a workspace P2PEditor.GuiLogMessage("Selected workspace does not exist.", NotificationLevel.Error); return; } var backgroundCreationWorker = new JobCreationWorker(JobListManager, newDistributedJob); backgroundCreationWorker.RunWorkerCompleted += BackgroundCreationWorkerCompleted; backgroundCreationWorker.RunWorkerAsync(); }