Ejemplo n.º 1
0
        public JobCreationWorker(JobListManager jobListManager, DistributedJob jobToDistribute)
        {
            this.jobListManager  = jobListManager;
            this.jobToDistribute = jobToDistribute;

            DoWork += JobCreationWorkerDoWork;
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
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;
        }
Ejemplo n.º 5
0
        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.
            }
        }
Ejemplo n.º 6
0
        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();
        }