protected void DoEventManagerDispatchCommandException(IQEventManager eventManager, Exception ex, IQSimpleCommand command) { if (OnEventManagerDispatchCommandException (eventManager, ex, command)) { RaiseEventManagerDispatchCommandException (EMDispatchCommandException, eventManager, ex, command); } }
protected void RaiseEventManagerDispatchCommandException(EventManagerDispatchCommandExceptionHandler handler, IQEventManager eventManager, Exception ex, IQSimpleCommand command) { if (handler != null) { handler (eventManager, ex, command); } }
private void cmd_SaveCompleted(IQSimpleCommand command, ILQHsmMemento memento) { SaveCmd cmd = (SaveCmd)command; using (StreamWriter sw = new StreamWriter(cmd.FileName)) { BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(sw.BaseStream, memento); } }
protected void Execute(IQSimpleCommand cmd) { try { cmd.Execute(); } catch (Exception ex) { DoEventManagerDispatchCommandException(this, ex, cmd); } }
public void AsyncDispatch(IQSimpleCommand cmd) { lock (_QLock) { if (!(cmd is HsmEventHolder)) { if (!(cmd is SimpleTransactionalCmd)) { cmd = new SimpleTransactionalCmd(cmd); } } _BottomQueue.Enqueue(cmd); } _WaitHandle.Set(); }
public void AsyncDispatch(IQSimpleCommand cmd) { lock (_QLock) { if (!(cmd is HsmEventHolder)) { if (!(cmd is SimpleTransactionalCmd)) { cmd = new SimpleTransactionalCmd (cmd); } } _BottomQueue.Enqueue (cmd); } _WaitHandle.Set (); }
public bool PollOne() { front: int count; object queueEntry = null; lock (_QLock) { count = _FrontStack.Count; if (count > 0) { queueEntry = _FrontStack.Pop(); } else { count = _BottomQueue.Count; if (count > 0) { queueEntry = _BottomQueue.Dequeue(); } } } if (count > 0) { if (queueEntry == null) { Logger.Error("---- QueueEntry is null! ----"); goto front; } IQSimpleCommand command = queueEntry as IQSimpleCommand; if (command == null) { Logger.Error("---- Command is null! ----"); goto front; } Execute(command); return(true); } return(false); }
private void cmd_RestoreCompleted(IQSimpleCommand command, ILQHsmMemento memento) { DoStateChange(_Book); }
public SimpleTransactionalCmd(IQSimpleCommand cmd) { _Cmd = cmd; _Transaction = QEvent.GetThreadTransaction (); }
protected virtual bool OnEventManagerDispatchCommandException(IQEventManager eventManager, Exception ex, IQSimpleCommand command) { return(true); }
private void _EventManager_EMDispatchCommandException(IQEventManager eventManager, Exception ex, IQSimpleCommand command) { DoEventManagerDispatchCommandException (eventManager, ex, command); }
protected void DoEventManagerDispatchCommandException(IQEventManager eventManager, Exception ex, IQSimpleCommand command) { if (OnEventManagerDispatchCommandException(eventManager, ex, command)) { RaiseEventManagerDispatchCommandException(EMDispatchCommandException, eventManager, ex, command); } }
private void _EventManager_EMDispatchCommandException(IQEventManager eventManager, Exception ex, IQSimpleCommand command) { DoEventManagerDispatchCommandException(eventManager, ex, command); }
protected void RaiseEventManagerDispatchCommandException(EventManagerDispatchCommandExceptionHandler handler, IQEventManager eventManager, Exception ex, IQSimpleCommand command) { if (handler != null) { handler(eventManager, ex, command); } }
public SimpleTransactionalCmd(IQSimpleCommand cmd) { _Cmd = cmd; _Transaction = QEvent.GetThreadTransaction(); }
private void _EventManager_EMDispatchCommandException(IQEventManager eventManager, Exception ex, IQSimpleCommand command) { Logger.Error(ex, command.ToString()); }
protected virtual bool OnEventManagerDispatchCommandException(IQEventManager eventManager, Exception ex, IQSimpleCommand command) { return true; }
protected void Execute(IQSimpleCommand cmd) { try { cmd.Execute (); } catch (Exception ex) { DoEventManagerDispatchCommandException (this, ex, cmd); } }