protected virtual void OnCommandReceived(ChatHistoryItem chathistoryitem, string @from, string command, string[] param, string fullparam) { CommandReceivedDelegate handler = CommandReceived; if (handler != null) { handler(this, chathistoryitem, @from, command, param, fullparam); } }
public static PipeClient RunThread(CommandReceivedDelegate aCommandReceived, ConnectedChangedDelegate aConnectionChanged) { if (LastRun != null && (DateTime.Now - LastRun).TotalSeconds < 10) return null; if (itsThread != null && itsThread.IsAlive) StopThread(); itsClient = new PipeClient(); itsClient.ConnectedChanged += aConnectionChanged; itsThread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(itsClient.Run)); itsThread.IsBackground = true; // Die with main thread. itsThread.Start(aCommandReceived); return itsClient; }