public void Dispose() { xAxis = null; yAxis = null; disabledPen?.Dispose(); disabledPen = null; dfEventInfo = null; dfRenderer?.Dispose(); dfRenderer = null; dfLine = null; dfRect = null; dfAreaF = null; dfArea = null; dfEventArgs = null; sysFont = null; imageProcessor?.Dispose(); imageProcessor = null; IsClosing = true; lock (Sync) { foreach (var dict in Objects.Values) { foreach (var item in dict.Values.OfType <IDisposable>()) { item.Dispose(); } dict.Clear(); } Objects.Clear(); newIDs.Clear(); } Dispose2(); }
private void button1_Click_1(object sender, System.EventArgs e) { if (openImageFile.ShowDialog() == DialogResult.OK) { textBox1.Text = openImageFile.FileName; System.IO.StreamReader sr = new System.IO.StreamReader(openImageFile.FileName); image = Image.FromStream(sr.BaseStream); //sr.Close(); IImageProcessorProvider imageProcessorProvider = new ImageProcessorProvider(); IImageProcessor imageProcessor = imageProcessorProvider.GetImageProcessor(_robot, _processingInfo); CaptureInfo captureInfo = new CaptureInfo(); imageProcessor.SetCaptureInfo(captureInfo); ImageInfo imageInfo = new ImageInfo(); imageInfo.SetImage(image); imageInfo.SetImageType(ImageType.FocusLevel); imageInfo.SetIsZNull(false); imageInfo.SetImageIndex(1); imageInfo.SetZ(0D); imageProcessor.SetImageInfo(imageInfo); // And second slice //imageInfo.SetImageIndex(2); //imageInfo.SetZ(20D); //imageProcessor.SetImageInfo(imageInfo); // And EFI //imageInfo.SetImageType(ImageType.ExtendedFocus); //imageInfo.SetImageIndex(3); //imageInfo.SetZ(20D); //imageProcessor.SetImageInfo(imageInfo); imageProcessor.Dispose(); imageProcessor = null; } }