public void ClosingForm(object sender, FormClosingEventArgs e) { if (video != null) { video.closeVideoFlux(); video.Dispose(); } video = null; if (IA != null) { IA.CloseSerialPort(); } IA = null; }
VideoProg video; // Video public Form1() { InitializeComponent(); this.FormClosing += new FormClosingEventHandler(ClosingForm); // Fermeture de la fenetre // Debug Logger Log = new Logger(); Logger.GlobalLogger = Log; Log.attachToRTB(RTB_LOG); Log.levelDebug = 2; // Port Serie getListePortSerie(ctlListePorts); // Instanciation des composants IA = new IntelArt(); IA.listAffichageArduino = ListeArduino; IA.listAffichageCubes = ListeCubes; IA.listAffichageZones = ListeZones; IA.imageDebug = debugIA; video = new VideoProg(ImageReel, null, numericUpDown1, LblFPS); video.imageDebug = imageDebug; video.ListerWebCam(ListeWebCam, Resolution); #region #### Liens Composants #### // Liens entre les composants // IA => Video IA.DrawPolylineEvent += video.onDrawPolyline; // Video => IA video.OnUpdatePositionCubes += IA.OnPositionUpdateCubes; video.OnUpdatePositionRobots += IA.OnPositionUpdateRobots; video.OnUpdatePositionZones += IA.OnPositionUpdateZones; video.OnUpdatePositionZoneTravail += IA.OnPositionUpdateZoneTravail; #endregion }