static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); BooleanReferenceType FailedToLoad=new BooleanReferenceType(); Application.Run(new VictorForm(FailedToLoad)); }
/// <summary> /// Startup, object called from calling thread to indicate a failure to load /// </summary> /// <param name="FailedToLoad"></param> public VictorForm(BooleanReferenceType FailedToLoad) { lock (this) { try { isInitialized = false; //MessageBox.Show(Thread.CurrentThread.Name); InitializeComponent(); del_RunParameterizedProtocol = RunDifferentProtocol; StartVictor(); isInitialized = true; FailedToLoad.FailedToLoad = false; FailedToLoad.ErrorMessage = null; FailedToLoad.thrown = null; } catch (Exception thrown) { FailedToLoad.FailedToLoad = true; FailedToLoad.ErrorMessage = thrown.Message; FailedToLoad.thrown = thrown; this.txtErrors.Text += thrown.Message; this.CurrentStatus = InstrumentState.Busted; isInitialized = false; Application.ExitThread(); } } }