public void KillForm() { StatusChange(false); try { if (PlateReader != null) { delVoidVoid closeform = PlateReader.Close; PlateReader.Invoke(closeform); int timeLoop = 0; if (ThreadToRunForm != null && ThreadToRunForm.IsAlive && timeLoop < 100) { timeLoop++; Thread.Sleep(1000); } PlateReader = null; GC.Collect(); } if (ThreadToRunForm.IsAlive) { ThreadToRunForm.Abort(); ThreadToRunForm = null; PlateReader = null; GC.Collect(); } } catch { PlateReader = null; GC.Collect(); } }
private void InitializePlateReader() { //seperate method to be called by a seperate thread, this keeps the form //with its own message queue try { Application.Run(PlateReader = new VictorForm(FailedToLoad)); } catch (Exception thrown) { FailedToLoad.FailedToLoad = true; } }
private void InitializePlateReader() { //seperate method to be called by a seperate thread, this keeps the form //with its own message queue Application.Run(PlateReader = new VictorForm()); }