public Main() { // Addin Core.Addins.AddinStore.Discover(); Core.Addins.AddinStore.Discover(Environment.CurrentDirectory); //Core.Addins.AddinStore.Discover(Path.Combine(Environment.CurrentDirectory, "plugins")); InitializeComponent(); log4net.Appender.IAppender app = LogManager.GetRepository().GetAppenders().FirstOrDefault(x => x is Logging.StatusStripAppender); if (app != null) { Logging.StatusStripAppender ssa = app as Logging.StatusStripAppender; ssa.StatusStrip = _status_strip; ssa.ToolStripStatusLabel = _status_label; } Core.BuildingBlocks.Setup setup = null; try //check konfigurasi parsley, jika tidak ada gunakan konfigurasi default { if (File.Exists(@"CurrentParsley.cfg")) { setup = Core.BuildingBlocks.Setup.LoadBinary(@"CurrentParsley.cfg"); //_logger.Info("Last Parsley configuration successfully loaded."); _logger.Info("Last Parsley configuration successfully loaded."); _logger.Debug("Last Parsley configuration successfully loaded."); } else { setup = new Parsley.Core.BuildingBlocks.Setup(); } } catch (System.Exception) { setup = new Parsley.Core.BuildingBlocks.Setup(); _logger.Info("Last Parsley configuration failed to load properly. Using default one."); } //setting streaming camera Core.BuildingBlocks.FrameGrabber fg = new Parsley.Core.BuildingBlocks.FrameGrabber(setup.Camera); _live_feed = new Parsley.UI.Concrete.StreamViewer(); _live_feed.Interpolation = Emgu.CV.CvEnum.INTER.CV_INTER_LINEAR; _live_feed.FunctionalMode = Emgu.CV.UI.ImageBox.FunctionalModeOption.RightClickMenu; _live_feed.FrameGrabber = fg; _live_feed.FrameGrabber.FPS = 30; _live_feed.FormClosing += new FormClosingEventHandler(_live_feed_FormClosing); this.AddOwnedForm(_live_feed); _live_feed.Show(); fg.Start(); //setting rendering 3d _3d_viewer = new Parsley.UI.Concrete.Draw3DViewer(); _3d_viewer.FormClosing += new FormClosingEventHandler(_3d_viewer_FormClosing); _3d_viewer.RenderLoop.FPS = 30; _3d_viewer.AspectRatio = setup.Camera.FrameAspectRatio; _3d_viewer.IsMaintainingAspectRatio = true; _3d_viewer.RenderLoop.Start(); this.AddOwnedForm(_3d_viewer); _3d_viewer.Show(); _context = new Context(setup, fg, _3d_viewer.RenderLoop, _live_feed.EmbeddableStream); _settings = new Settings(_context); _settings.FormClosing += new FormClosingEventHandler(_settings_FormClosing); _settings.PropertyGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(PropertyGrid_PropertyValueChanged); this.AddOwnedForm(_settings); _slide_welcome = new WelcomeSlide(); _slide_intrinsic_calib = new IntrinsicCalibrationSlide(_context); _slide_extrinsic_calib = new ExtrinsicCalibrationSlide(_context); _slide_laser_setup = new LaserSetupSlide(_context); _slide_scanning = new ScanningSlide(_context); _slide_image_algorithm_test = new ImageAlgorithmTestSlide(_context); _slide_pattern_designer = new PatternDesignerSlide(_context); _slide_control.AddSlide(_slide_welcome); _slide_control.AddSlide(_slide_scanning); _slide_control.AddSlide(_slide_intrinsic_calib); _slide_control.AddSlide(_slide_extrinsic_calib); _slide_control.AddSlide(_slide_laser_setup); _slide_control.AddSlide(_slide_image_algorithm_test); _slide_control.AddSlide(_slide_pattern_designer); _slide_control.SlideChanged += new EventHandler<SlickInterface.SlideChangedArgs>(_slide_control_SlideChanged); _slide_control.Selected = _slide_welcome; }
public Main() { // Addin Core.Addins.AddinStore.Discover(); Core.Addins.AddinStore.Discover(Environment.CurrentDirectory); //Core.Addins.AddinStore.Discover(Path.Combine(Environment.CurrentDirectory, "plugins")); InitializeComponent(); log4net.Appender.IAppender app = LogManager.GetRepository().GetAppenders().FirstOrDefault(x => x is Logging.StatusStripAppender); if (app != null) { Logging.StatusStripAppender ssa = app as Logging.StatusStripAppender; ssa.StatusStrip = _status_strip; ssa.ToolStripStatusLabel = _status_label; } Core.BuildingBlocks.Setup setup = null; try //check konfigurasi parsley, jika tidak ada gunakan konfigurasi default { if (File.Exists(@"CurrentParsley.cfg")) { setup = Core.BuildingBlocks.Setup.LoadBinary(@"CurrentParsley.cfg"); //_logger.Info("Last Parsley configuration successfully loaded."); _logger.Info("Last Parsley configuration successfully loaded."); _logger.Debug("Last Parsley configuration successfully loaded."); } else { setup = new Parsley.Core.BuildingBlocks.Setup(); } } catch (System.Exception) { setup = new Parsley.Core.BuildingBlocks.Setup(); _logger.Info("Last Parsley configuration failed to load properly. Using default one."); } //setting streaming camera Core.BuildingBlocks.FrameGrabber fg = new Parsley.Core.BuildingBlocks.FrameGrabber(setup.Camera); _live_feed = new Parsley.UI.Concrete.StreamViewer(); _live_feed.Interpolation = Emgu.CV.CvEnum.INTER.CV_INTER_LINEAR; _live_feed.FunctionalMode = Emgu.CV.UI.ImageBox.FunctionalModeOption.RightClickMenu; _live_feed.FrameGrabber = fg; _live_feed.FrameGrabber.FPS = 30; _live_feed.FormClosing += new FormClosingEventHandler(_live_feed_FormClosing); this.AddOwnedForm(_live_feed); _live_feed.Show(); fg.Start(); //setting rendering 3d _3d_viewer = new Parsley.UI.Concrete.Draw3DViewer(); _3d_viewer.FormClosing += new FormClosingEventHandler(_3d_viewer_FormClosing); _3d_viewer.RenderLoop.FPS = 30; _3d_viewer.AspectRatio = setup.Camera.FrameAspectRatio; _3d_viewer.IsMaintainingAspectRatio = true; _3d_viewer.RenderLoop.Start(); this.AddOwnedForm(_3d_viewer); _3d_viewer.Show(); _context = new Context(setup, fg, _3d_viewer.RenderLoop, _live_feed.EmbeddableStream); _settings = new Settings(_context); _settings.FormClosing += new FormClosingEventHandler(_settings_FormClosing); _settings.PropertyGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(PropertyGrid_PropertyValueChanged); this.AddOwnedForm(_settings); _slide_welcome = new WelcomeSlide(); _slide_intrinsic_calib = new IntrinsicCalibrationSlide(_context); _slide_extrinsic_calib = new ExtrinsicCalibrationSlide(_context); _slide_laser_setup = new LaserSetupSlide(_context); _slide_scanning = new ScanningSlide(_context); _slide_image_algorithm_test = new ImageAlgorithmTestSlide(_context); _slide_pattern_designer = new PatternDesignerSlide(_context); _slide_control.AddSlide(_slide_welcome); _slide_control.AddSlide(_slide_scanning); _slide_control.AddSlide(_slide_intrinsic_calib); _slide_control.AddSlide(_slide_extrinsic_calib); _slide_control.AddSlide(_slide_laser_setup); _slide_control.AddSlide(_slide_image_algorithm_test); _slide_control.AddSlide(_slide_pattern_designer); _slide_control.SlideChanged += new EventHandler <SlickInterface.SlideChangedArgs>(_slide_control_SlideChanged); _slide_control.Selected = _slide_welcome; }