using System.Drawing; using System.Reflection.Emit; using System.Windows.Forms; namespace WindowsFormsApp2 { public partial class displayResult : UserControl { public displayResult() { InitializeComponent(); singleCam1.callback = callback; singleCam2.callback = callback; singleCam3.callback = callback; singleCam4.callback = callback; singleCam5.callback = callback; singleCam6.callback = callback; singleCam7.callback = callback; singleCam8.callback = callback; } void callback(int id) { switch (id) { case 0: singleCam1.closeSocket(); break; case 1: singleCam2.closeSocket(); break; case 2: singleCam3.closeSocket(); break; case 3: singleCam4.closeSocket(); break; case 4: singleCam5.closeSocket(); break; case 5: singleCam6.closeSocket(); break; case 6: singleCam7.closeSocket(); break; case 7: singleCam8.closeSocket(); break; } FullScreen dial = new FullScreen(); dial.OnFullScreenClose = (camid) => { dial.ReleaseUdp(); switch (camid) { case 0: singleCam1.setCamId(0); break; case 1: singleCam2.setCamId(1); break; case 2: singleCam3.setCamId(2); break; case 3: singleCam4.setCamId(3); break; case 4: singleCam5.setCamId(4); break; case 5: singleCam6.setCamId(5); break; case 6: singleCam7.setCamId(6); break; case 7: singleCam8.setCamId(7); break; } }; if (id > -1) { dial.bindCam(id); dial.Show(); } } void onclose(int camid) { } public void init() { singleCam1.setCamId(0); singleCam2.setCamId(1); singleCam3.setCamId(2); singleCam4.setCamId(3); singleCam5.setCamId(4); singleCam6.setCamId(5); singleCam7.setCamId(6); singleCam8.setCamId(7); } public void close() { singleCam1.closeSocket(); singleCam2.closeSocket(); singleCam3.closeSocket(); singleCam4.closeSocket(); singleCam5.closeSocket(); singleCam6.closeSocket(); singleCam7.closeSocket(); singleCam8.closeSocket(); userControl11.closeSocket(); } } }