private void _CurrentProcess_ErrorDataReceived(object sender, DataReceivedEventArgs e) { try { if (!string.IsNullOrEmpty(e?.Data)) { var message = Newtonsoft.Json.JsonConvert.DeserializeObject <MessageExchange.MessageInfo>(e.Data); if (message.Type == MessageExchange.MessageType.exception) { message = Newtonsoft.Json.JsonConvert.DeserializeObject <MessageExchange.ExceptionInfo>(e.Data); } _OutPutError.Add(message); ReceiveError?.Invoke(this, message); } } catch (Exception ex) { StopApp(); var message = new MessageExchange.MessageInfo { Text = e.Data, Time = DateTime.Now, Type = MessageExchange.MessageType.exception }; _OutPutError.Add(message); ReceiveError?.Invoke(this, message); } }
private void RaiseErrorEvent(FileReceiverErrorArgs arg) { ReceiveError?.Invoke(arg); if (arg.IsCritical) { RecieverThread?.Abort(); TimerThread.Abort(); } }