public void Destory() { if (mCurrentClip != null) {//若当前已经打开了片段,询问是否保存并清理 _QuerySaveClip(); _ClearCurrentClip(); } onSpeAnimClipNew = null; onSpeAnimClipOpen = null; onSpeAnimClipValueChange = null; onSpeAnimClipItemNumChange = null; onSpeAnimClipItemSelect = null; onSpeAnimClipSetNewAction = null; mIsBindingMode = false; mCurrSelect = -1; mActionMgr.Clear(); mCmdMgr.Clear(); _ClearCurrentClip(); mRefModelBoneRoot = null; GameObject.DestroyImmediate(mEditorAttachPoint); mEditorAttachPoint = null; }
public void Unsubscribe(string name, NotifyDelegate del) { if (notifyDelegates.ContainsKey(name)) { notifyDelegates[name] -= del; } }
protected virtual bool DoStore() { //MessageBox.Show("Do Store."); try { Modules.ScoreModule.DALStudent student = new Modules.ScoreModule.DALStudent(); if (cand != null) { student.Insert(cand); } return(true); } catch { //MessageBox.Show("数据库读写错误"); if (this.InvokeRequired) { NotifyDelegate doNotify = new NotifyDelegate(DoShowMsgBox); this.Invoke(doNotify, "数据库读写错误"); } else { DoShowMsgBox("数据库读写错误"); } return(false); } }
////////////////////////////////////////////////////////////// public UBSModuleDelegates(SendMessageDelegate pSendMessageFunction, GetAvailableModuleNamesDelegate pGetAvailableModulesFunction, GetModule pGetModule, LogDelegate pLogFunction, WriteConsoleDelegate pWriteConsoleFunction, NotifyDelegate pNotifyFunction, ErrorDelegate pErrorFunction, ExecutionTimeDelegate pExecutionTimeFunction, SetGlobalParameterDelegate pSetGlobalParameterFunction, GetGlobalParameterDelegate pGetGlobalParameterFunction, GoToModuleDelegate pGoToModuleFunction, ButtonColorDelegate pButtonColoFunction) { SendMessageFunction = pSendMessageFunction; GetAvailableModulesFunction = pGetAvailableModulesFunction; GetModule = pGetModule; LogFunction = pLogFunction; WriteConsoleFunction = pWriteConsoleFunction; NotifyFunction = pNotifyFunction; ErrorFunction = pErrorFunction; ExecutionTimeFunction = pExecutionTimeFunction; SetGlobalParameterFunction = pSetGlobalParameterFunction; GetGlobalParameterFunction = pGetGlobalParameterFunction; GoToModuleFunction = pGoToModuleFunction; ButtonColorFunction = pButtonColoFunction; }
public void Start(NotifyDelegate nd) { Console.WriteLine("Yes, I shouldn't write to the console from here, it's just to demonstrate the code executed."); Console.WriteLine("SaveToDatabase Complete"); Console.WriteLine(" "); nd.Invoke(); }
private static void StartupLedWiz() { lock (StartupLocker) { if (StartedUp == 0) { MainWindow = IntPtr.Zero; deviceList.handles = new uint[LWZ_MAX_DEVICES] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; deviceList.numdevices = 0; try { NotifyDelegate del = new NotifyDelegate(Notify); IntPtr ptr = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(LWZDEVICELIST))); Marshal.StructureToPtr(deviceList, ptr, true); LWZ_SET_NOTIFY(del, (uint)ptr.ToInt32()); deviceList = (LWZDEVICELIST)Marshal.PtrToStructure(ptr, typeof(LWZDEVICELIST)); Marshal.FreeCoTaskMem(ptr); Log.Debug("Ledwiz devicelist content. Handles: {0}, Num devices: {1}".Build(string.Join(", ", deviceList.handles.Select(H => H.ToString())), deviceList.numdevices)); } catch (Exception ex) { Log.Exception("Could not init LedWiz", ex); throw new Exception("Could not init LedWiz", ex); } } StartedUp++; } }
///<summary> /// Create a <see cref="DelegatedExceptionNotifier"/> with the specified exception notification delegate. ///</summary> ///<param name="notifyDelegate">The <see cref="NotifyDelegate"/> to execute when an exception is recieved by the <see cref="DelegatedExceptionNotifier"/>.</param> public DelegatedExceptionNotifier(NotifyDelegate notifyDelegate) { if (notifyDelegate == null) { throw new ArgumentNullException("notifyDelegate"); } _notifyDelegate = notifyDelegate; }
public void CreateNotificationDelegate(string name) { if (!notifyDelegates.ContainsKey(name)) { NotifyDelegate notification = DefaultNotification; notifyDelegates.Add(name, notification); } }
public void Notify(CExam exam) { string msg = string.Empty; if (exam.Passed) { msg = "¿¼ÊԺϸñ"; } else { msg = exam.Message.Message; } if (this.btnXStart.InvokeRequired) { NotifyDelegateBool doNotify = new NotifyDelegateBool(DoSetBtnEnable); this.btnXStart.Invoke(doNotify, false); } else { DoSetBtnEnable(false); } if (exam.Passed) { if (changeState != null) { changeState(this, new StateChangeEventArgs(CtrlPanelState.Pass, msg)); } } else { if (changeState != null) { changeState(this, new StateChangeEventArgs(CtrlPanelState.Fail, msg)); } } if (this.btnXStart.InvokeRequired) { NotifyDelegate doNotify = new NotifyDelegate(DoNotify); this.btnXStart.Invoke(doNotify, "¿ªÊ¼¿¼ÊÔ"); } else { DoNotify("¿ªÊ¼¿¼ÊÔ"); } if (this.btnXStart.InvokeRequired) { NotifyDelegateBool doNotify = new NotifyDelegateBool(DoSetBtnEnable); this.btnXStart.Invoke(doNotify, true); } else { DoSetBtnEnable(true); } }
public void Start(NotifyDelegate nd) { /* I shouldn't write to the console from here, * just for demonstration purposes */ Console.WriteLine("SaveToDatabase Complete"); Console.WriteLine(" "); nd.Invoke(); }
static void Main(string[] args) { //Note, this NotifyDelegate type is defined in the SaveToDatabase project NotifyDelegate nofityDelegate = new NotifyDelegate(NotifyIfComplete); SaveToDatabase sd = new SaveToDatabase(); sd.Start(nofityDelegate); Console.ReadKey(); }
public static void Start(Notify notificationDelegate) { //Note, this NotifyDelegate type is defined in the SaveToDatabase project NotifyDelegate nofityDelegate = new NotifyDelegate(NotifyIfComplete); SaveToDatabase sd = new SaveToDatabase(); sd.Start(nofityDelegate); Console.ReadKey(); notificationDelegate.Invoke("Example2 executed!"); }
public int RegisterClient(NotifyDelegate callBack) { var client = new Client() { Id = this.curClientId > 32 ? 0 : this.curClientId++, Notify = callBack }; this.clients.Add(client); return(client.Id); }
public ProcMonManager() { _notifyDelegate = ReceiveMessage; _processMonitor = new ProcessMonitorEx(); _messageQueue = new Queue <ProcessEventItem>(); _messageCount = 0; Initialize(); }
/// <summary> /// Queues a Notification /// </summary> public void QueueNotification(NotificationType notificationType, object data) { if (data == null) { throw new ArgumentNullException("data"); } var notification = this.NotificationFactory.Make(notificationType); var notifyDelegate = new NotifyDelegate(notification.Notify); notifyDelegate.BeginInvoke(data, null, null); }
public void Notify(IState state) { if (this.labelXStatus.InvokeRequired) { NotifyDelegate doNotify = new NotifyDelegate(DoNotify); this.labelXStatus.Invoke(doNotify, state); } else { DoNotify(state); } }
protected void ShowMsgBox(UserControl ctrl, string msg) { if (ctrl.InvokeRequired) { NotifyDelegate doNotify = new NotifyDelegate(DoShowMsgBox); ctrl.Invoke(doNotify, msg); } else { DoShowMsgBox(msg); } }
/// <summary> /// Clea up this instance. /// </summary> private void _localCleanup() { _lock = null; _name = null; _thread = null; _notifyStart = null; _notifyFinish = null; _queued = false; _canceled = false; _exception = null; _progress.Value = null; }
/// <summary> /// Queues a Notification /// </summary> public void QueueNotification(NotificationType notificationType, object data) { if (data == null) { throw new ArgumentNullException("data"); } var notification = this.NotificationFactory.Make(notificationType); var notifyDelegate = new NotifyDelegate(notification.Notify); notifyDelegate.BeginInvoke(data, null, null); }
public void notifyRenderComplete(Exception failure) { if (renderCompleteDelegate != null) { renderCompleteDelegate(failure); return; } if (failure == null) { NotifyDelegate method = ModalNotifyRenderComplete; Invoke(method); } }
delegate void NotifyDelegate(bool visible);//创建一个代理 /// <summary> /// /// </summary> private void SetNotify(bool visible) { //if (!notify.InvokeRequired) if (!InvokeRequired) { notify.Visible = visible; this.notify.ShowBalloonTip(1000, "提示信息", notifyMessage, ToolTipIcon.Info); } else { NotifyDelegate notifyDelegate = new NotifyDelegate(SetNotify); Invoke(notifyDelegate, new object[] { visible });//执行唤醒操作 } }
////////////////////////////////////////////////////////////// public void AppendDelegates(UBSModuleDelegates module_delegates) { this.SendMessageFunction = module_delegates.SendMessageFunction; this.GetAvailableModulesFunction = module_delegates.GetAvailableModulesFunction; this.GetModuleFunction = module_delegates.GetModule; this.LogFunction = module_delegates.LogFunction; this.WriteConsoleFunction = module_delegates.WriteConsoleFunction; this.NotifyFunction = module_delegates.NotifyFunction; this.ErrorFunction = module_delegates.ErrorFunction; this.ExecutionTimeFunction = module_delegates.ExecutionTimeFunction; this.SetGlobalParameterFunction = module_delegates.SetGlobalParameterFunction; this.GetGlobalParameterFunction = module_delegates.GetGlobalParameterFunction; this.GoToModuleFunction = module_delegates.GoToModuleFunction; this.ButtonColorFunction = module_delegates.ButtonColorFunction; }
/// <summary> /// Called when the reference count goes to zero. /// </summary> protected override void _cleanup() { try { _lock = null; _text = null; _job = null; _notifyDelegate = null; base._cleanup(); } catch (System.Exception e) { System.Console.WriteLine("Error 1615620548: {0}", e.Message); } }
//Constructor used to make an auction, which requires some parameters public Auction(Vehicle vehicle, Seller salesman, int auctionNumber, decimal minPrice, NotifyDelegate notify) { this.Vehicle = vehicle; this.Salesman = salesman; this.AuctionNumber = auctionNumber; this.MinPrice = minPrice; this.Notify = notify; if (Salesman.Person != null) { Salesman.Person.SubscribeToEvent(this); } else { Salesman.Company.SubscribeToEvent(this); } }
public void Start(NotifyDelegate nd) { string message = string.Empty; if (DateTime.Now.Second > 30) { message = "Success"; } else { message = "failure"; } nd.Invoke(message); }
public Autoit(string appName, NotifyDelegate Notify) { this.Notify = Notify; this.appName = appName; try { au3 = new AutoItX3(); SetWindow(); } catch (Exception e) { Notify(e.Message); } UpdateWindowPos(); }
public void StartupLighting() { try { NotifyDelegate del = new NotifyDelegate(Notify); IntPtr ptr = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(LWZDEVICELIST))); Marshal.StructureToPtr(deviceList, ptr, true); LWZ_SET_NOTIFY(del, (uint)ptr.ToInt32()); deviceList = (LWZDEVICELIST)Marshal.PtrToStructure(ptr, typeof(LWZDEVICELIST)); Marshal.FreeCoTaskMem(ptr); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message, "LEDWiz Error"); } }
protected virtual void ExamPass(string msg) { if (cand != null) { cand.Kscj = 1; cand.HuiHeShu = examTimes + 1; if (cand.HuiHeShu == 1) { cand.KS1 = msg; } if (cand.HuiHeShu == 2) { cand.KS2 = msg; } if (this.StudentExamChange != null) { this.StudentExamChange(cand.Xm + "," + msg + ",考试结束!"); } //显示考试通过 if (this.InvokeRequired) { NotifyDelegate doNotify = new NotifyDelegate(DoShowMsgBox); this.Invoke(doNotify, msg); } else { DoShowMsgBox(msg); } if (DoStore()) { if (this._printContent != null) { if ((new Modules.ScoreModule.frmMessageBox()).ShowDialog() == DialogResult.Yes) { DoPrint(); } } } } }
public static void Main() { NotifyDelegate myNotifyDelegate = null; // ************************************************** User user1 = new User(fullName: "Sara Ahmadi"); myNotifyDelegate += user1.Notify; // ************************************************** // ************************************************** User user2 = new User(fullName: "Ali Reza Alavi"); myNotifyDelegate += user2.Notify; // ************************************************** // ************************************************** User user3 = new User(fullName: "Dariush Tasdighi"); myNotifyDelegate += user3.Notify; // ************************************************** while (1 == 1) { System.Console.Write("Write a message to send to all users: "); string message = System.Console.ReadLine(); System.Console.WriteLine(); if (myNotifyDelegate != null) { myNotifyDelegate(message); } } }
public void ResultsFromCreationDicomdirAsynchronously(IAsyncResult theIAsyncResult) { DvtkApplicationLayer.MediaSession theMediaSession = (DvtkApplicationLayer.MediaSession)GetExecutingSession(); try { // Obligated to call the following method according to the asynchronous design pattern. theMediaSession.MediaSessionImplementation.EndGenerationDICOMDIR(theIAsyncResult); } catch (Exception ex) { // // Problem: // Errors thrown from a workerthread are eaten by the .NET 1.x CLR. // Workaround: // Directly call the global (untrapped) exception handler callback. // Do NOT rely on // either // - System.AppDomain.CurrentDomain.UnhandledException // or // - System.Windows.Forms.Application.ThreadException // These events will only be triggered for the main thread not for worker threads. // // CustomExceptionHandler eh = new CustomExceptionHandler(); // System.Threading.ThreadExceptionEventArgs args = new ThreadExceptionEventArgs(ex); // eh.OnThreadException(this, args); // // Rethrow. This rethrow may work in the future .NET 2.x CLR. // Currently eaten. // throw ex; } theMediaSession.MediaSessionImplementation.EndResultsGathering(); DvtkApplicationLayer.MediaSession mediaSession = (DvtkApplicationLayer.MediaSession)_TagThatIsBeingExecuted; mediaSession.CreateMediaFiles(); _FirstMediaFileToValidate = "dicomdir_creation_logging"; // Update the UI. Do this with an invoke, because the thread that is calling this // method is NOT the thread that created all controls used! _EndExecution = new EndExecution(_TagThatIsBeingExecuted); theMediaSession.IsExecute = false; _TagThatIsBeingExecuted = null; _MainForm = (MainForm)_ParentForm._MainForm; if(_MainForm != null) { _MainForm.MainStatusBar.Text = "DICOMDIR creation completed."; } _NotifyDelegate = new NotifyDelegate(_ParentForm.Notify); _ParentForm.Invoke(_NotifyDelegate, new object[]{_EndExecution}); }
public ResourceCounter(string resourceName, int period, NotifyDelegate notifyDelegate) { this.resourceName = resourceName; this.period = period; this.notifyDelegate = notifyDelegate; }
public void StartupLighting() //seems like this may be important even I don't care about the pattern just to initialize the device { try { NotifyDelegate del = new NotifyDelegate(Notify); IntPtr ptr = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(LWZDEVICELIST))); Marshal.StructureToPtr(deviceList, ptr, true); LWZ_SET_NOTIFY(del, (uint)ptr.ToInt32()); deviceList = (LWZDEVICELIST)Marshal.PtrToStructure(ptr, typeof(LWZDEVICELIST)); Marshal.FreeCoTaskMem(ptr); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message, "LEDWiz Error"); } }
private static void StartupLedWiz() { lock (StartupLocker) { if (StartedUp == 0) { MainWindow = IntPtr.Zero; deviceList.handles = new uint[LWZ_MAX_DEVICES] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; deviceList.numdevices = 0; try { NotifyDelegate del = new NotifyDelegate(Notify); IntPtr ptr = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(LWZDEVICELIST))); Marshal.StructureToPtr(deviceList, ptr, true); LWZ_SET_NOTIFY(del, (uint)ptr.ToInt32()); deviceList = (LWZDEVICELIST)Marshal.PtrToStructure(ptr, typeof(LWZDEVICELIST)); Marshal.FreeCoTaskMem(ptr); } catch (Exception ex) { Log.Exception("Could not init LedWiz", ex); throw new Exception("Could not init LedWiz", ex); } } StartedUp++; } }
//Method that overloads the previous method to make a different notify method public int PutUpForSale(Vehicle vehicle, Seller salesman, decimal minPrice, NotifyDelegate notify) { if (!AuctionList.Any(x => x.Vehicle.Equals(vehicle))) { ++_auctionNumber; Auction au = new Auction(vehicle, salesman, _auctionNumber, minPrice, notify); AuctionList.Add(au); return _auctionNumber; } else { Console.WriteLine("The vehicle has already been put up for sale!"); return AuctionList.Find(x => x.Vehicle.Equals(vehicle)).AuctionNumber; } }
///<summary> /// Create a <see cref="DelegatedExceptionNotifier"/> with the specified exception notification delegate. ///</summary> ///<param name="notifyDelegate">The <see cref="NotifyDelegate"/> to execute when an exception is recieved by the <see cref="DelegatedExceptionNotifier"/>.</param> public DelegatedExceptionNotifier(NotifyDelegate notifyDelegate) { if (notifyDelegate == null) throw new ArgumentNullException("notifyDelegate"); _notifyDelegate = notifyDelegate; }
public void Notify(Exam.Exam exam) { if (!exam.Passed) { //若要改变出错时模型车位置,请调整此处代码。 //可再为每种ResultType添加switch(exam.Message.Index), //以细化针对不同杆线错误时,模型车的位置 switch (exam.Message.TypeOfResult) { case ResultType.Gan: che.SetWeizhi(gan[exam.Message.Index].X, gan[exam.Message.Index].Y); break; case ResultType.Xian: switch (exam.Message.Index) { case 0: case 2: che.SetWeizhi(xian[exam.Message.Index].X1, che.Y); break; case 1: case 3: case 4: che.SetWeizhi(che.X, xian[exam.Message.Index].Y1); break; } break; case ResultType.ZT: che.SetWeizhi(che.X, che.Y); break; case ResultType.XH: che.SetWeizhi(che.X, che.Y); break; case ResultType.LXC: che.SetWeizhi(che.X, che.Y); break; case ResultType.TimeOut: che.SetWeizhi(che.X, che.Y); break; default: break; } } CMonData data = monitor.CurrData; CSignals g = data.GetSignals(SignalType.GAN); for (int i = 0; i < 5; i++) { gan[i].Stat = g[i]; } CSignals x = data.GetSignals(SignalType.XIAN); for (int i = 0; i < 5; i++) { xian[i].Stat = x[i]; } if (this.picBoxModelBackGround.InvokeRequired) { NotifyDelegate doNotify = new NotifyDelegate(DoNotify); this.picBoxModelBackGround.Invoke(doNotify); } else { DoNotify(); } }
private void ExecuteVisualBasicScript() { try { Script theScriptFileTag = _TagThatIsBeingExecuted as Script; if (theScriptFileTag == null) { // Sanity check. Debug.Assert(false); } else { DvtkApplicationLayer.VisualBasicScript applicationLayerVisualBasicScript = new DvtkApplicationLayer.VisualBasicScript(((DvtkApplicationLayer.ScriptSession)theScriptFileTag.ParentSession).ScriptSessionImplementation , theScriptFileTag.ScriptFileName); // END String[] emptyArray = {}; ArrayList listContainingExmptyArray = new ArrayList(); listContainingExmptyArray.Add(emptyArray); applicationLayerVisualBasicScript.Execute(listContainingExmptyArray.ToArray()); } // Update the UI. Do this with an invoke, because the thread that is calling this // method is NOT the thread that created all controls used! theScriptFileTag.ParentSession.IsExecute = false; Script script = (Script)_TagThatIsBeingExecuted ; ((ScriptSession)script.ParentSession).CreateScriptFiles(); _EndExecution = new EndExecution(_TagThatIsBeingExecuted); _TagThatIsBeingExecuted = null; _NotifyDelegate = new NotifyDelegate(parentForm.Notify); parentForm.Invoke(_NotifyDelegate, new object[]{_EndExecution}); } catch (Exception ex) { // // Problem: // Errors thrown from a workerthread are eaten by the .NET 1.x CLR. // Workaround: // Directly call the global (untrapped) exception handler callback. // Do NOT rely on // either // - System.AppDomain.CurrentDomain.UnhandledException // or // - System.Windows.Forms.Application.ThreadException // These events will only be triggered for the main thread not for worker threads. // CustomExceptionHandler eh = new CustomExceptionHandler(); System.Threading.ThreadExceptionEventArgs args = new ThreadExceptionEventArgs(ex); eh.OnThreadException(this, args); // // Rethrow. This rethrow may work in the future .NET 2.x CLR. // Currently eaten. // throw ex; } }
public LocalState(IShipHandle iShipHandle, ManualResetEvent manualEvent, NotifyDelegate notifyDelegate) { ManualResetEvent = manualEvent; NotifyDelegate = notifyDelegate; IShipHandle = iShipHandle; }
public void ResultsFromValidateMediaFilesAsynchronously(IAsyncResult theIAsyncResult) { Dvtk.Sessions.MediaSession theMediaSession = (Dvtk.Sessions.MediaSession)GetExecutingSession(); try { // Obligated to call the following method according to the asynchronous design pattern. theMediaSession.EndValidateMediaFiles(theIAsyncResult); } catch (Exception ex) { // // Problem: // Errors thrown from a workerthread are eaten by the .NET 1.x CLR. // Workaround: // Directly call the global (untrapped) exception handler callback. // Do NOT rely on // either // - System.AppDomain.CurrentDomain.UnhandledException // or // - System.Windows.Forms.Application.ThreadException // These events will only be triggered for the main thread not for worker threads. // CustomExceptionHandler eh = new CustomExceptionHandler(); System.Threading.ThreadExceptionEventArgs args = new ThreadExceptionEventArgs(ex); eh.OnThreadException(this, args); // // Rethrow. This rethrow may work in the future .NET 2.x CLR. // Currently eaten. // throw ex; } theMediaSession.EndResultsGathering(); if (mediaFilesToBeValidated.Count > 0) { ValidateMediaFiles(); } else { // Update the UI. Do this with an invoke, because the thread that is calling this // method is NOT the thread that created all controls used! _EndExecution = new EndExecution(_TagThatIsBeingExecuted); _TagThatIsBeingExecuted = null; _NotifyDelegate = new NotifyDelegate(_ParentForm.Notify); _ParentForm.Invoke(_NotifyDelegate, new object[]{_EndExecution}); } }
private void ExecuteVisualBasicScript() { try { ScriptFileTag theScriptFileTag = _TagThatIsBeingExecuted as ScriptFileTag; if (theScriptFileTag == null) // Sanity check. { Debug.Assert(false); } else { // TODO!!!!! // The following code should be removed when the business layer is completely implemented! // For now, construct a business layer object that does the execution of the VBS. // BEGIN DvtkApplicationLayer.VisualBasicScript applicationLayerVisualBasicScript = new DvtkApplicationLayer.VisualBasicScript(theScriptFileTag._Session as ScriptSession, theScriptFileTag._ScriptFileName); // END String[] emptyArray = {}; ArrayList listContainingExmptyArray = new ArrayList(); listContainingExmptyArray.Add(emptyArray); applicationLayerVisualBasicScript.Execute(listContainingExmptyArray.ToArray()); } // Update the UI. Do this with an invoke, because the thread that is calling this // method is NOT the thread that created all controls used! _EndExecution = new EndExecution(_TagThatIsBeingExecuted); _TagThatIsBeingExecuted = null; _NotifyDelegate = new NotifyDelegate(_ParentForm.Notify); _ParentForm.Invoke(_NotifyDelegate, new object[]{_EndExecution}); } catch (Exception ex) { // // Problem: // Errors thrown from a workerthread are eaten by the .NET 1.x CLR. // Workaround: // Directly call the global (untrapped) exception handler callback. // Do NOT rely on // either // - System.AppDomain.CurrentDomain.UnhandledException // or // - System.Windows.Forms.Application.ThreadException // These events will only be triggered for the main thread not for worker threads. // CustomExceptionHandler eh = new CustomExceptionHandler(); System.Threading.ThreadExceptionEventArgs args = new ThreadExceptionEventArgs(ex); eh.OnThreadException(this, args); // // Rethrow. This rethrow may work in the future .NET 2.x CLR. // Currently eaten. // throw ex; } }
public NewClass(NotifyDelegate oNotifier) { m_Notifier = oNotifier; }