public RequestColorWorker(Queue <ColorAtPoint> queue, MasterImage masterImageWorker, RunWorkerCompletedEventHandler completedEventHandler = null) { this.queue = queue; worker = new BackgroundWorker(); worker.DoWork += new DoWorkEventHandler(ColorPixel); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(OnCompleted); if (completedEventHandler != null) { worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(completedEventHandler); } worker.WorkerSupportsCancellation = true; this.masterImage = masterImageWorker; }
/// <summary> /// Initialize master image (if needed) and update it with the new file. /// Can either specify a file name, or provide the full project. /// </summary> private void UpdateMasterImage(string fileName = null, PPProject project = null) { if (masterImage == null) { masterImage = new MasterImage(); masterImage.ProgressChanged += new ProgressChangedEventHandler(OnProgressChanged); masterImage.StatusChanged += new TextEventHandler(Form_UpdateStatusText); masterImage.ProjectEdited += new ProjectEventHandler(MasterImage_OnProjectEdited); } if (fileName != null) { masterImage.Load(fileName); } else { masterImage.SetProject(project); } history.Clear(); UpdateZoomedImage(SCALE_FIT); }
private void Image_OnCancelLoad(object sender, EventArgs e) { masterImage.CancelLoad(); masterImage = null; pictureBox.Image = null; }
public void Run(MasterImage masterImageWorker) { this.masterImage = masterImageWorker; Run(); }