private void Wifi_OnWifiConnectionAttemptCompletedHandler(object sender, MsgPumpResults result)
        {
            ErrReport report;

            WrapErr.ToErrReport(out report, 2000355, "Failure on Wifi_OnWifiConnectionAttemptCompletedHandler", () => {
                this.log.Info("Wifi_OnWifiConnectionAttemptCompletedHandler", () => string.Format(
                                  "Is OnWifiConnectionAttemptCompleted null={0}",
                                  this.OnWifiConnectionAttemptCompleted == null));

                // Set when the current connection is using new parameters
                if (this.pendingSaveConnectNetInfo != null)
                {
                    if (result.Code == MsgPumpResultCode.Connected)
                    {
                        this.WifiStoreNewCredentials(this.pendingSaveConnectNetInfo);
                    }
                    else
                    {
                        // Wipping out password will cause dialog to come up on next connect
                        this.pendingSaveConnectNetInfo.Password = "";
                    }
                    this.pendingSaveConnectNetInfo = null;
                }
                this.OnWifiConnectionAttemptCompleted?.Invoke(sender, result);
            });
            this.RaiseIfException(report);
        }
        private void MsgPump_ConnectResultEventHandler(object sender, MsgPumpResults e)
        {
            switch (e.Code)
            {
            case MsgPumpResultCode.Connected:
            case MsgPumpResultCode.ConnectionFailure:
                this.OnSerialConnectionAttemptCompleted?.Invoke(this, e);
                break;

            case MsgPumpResultCode.NotConnected:
                this.OnError?.Invoke(this, new SerialUsbError(SerialErrorCode.NotConnected));
                break;

            case MsgPumpResultCode.ReadFailure:
                this.OnError?.Invoke(this, new SerialUsbError(SerialErrorCode.ReadFailure));
                break;

            case MsgPumpResultCode.WriteFailure:
                this.OnError?.Invoke(this, new SerialUsbError(SerialErrorCode.WriteFailure));
                break;

            default:
                this.log.Error(9999, () => string.Format("Unhandled MsgPumpResult:{0}", e.Code));
                break;
            }
        }
예제 #3
0
 private void MsgPumpConnectResultEventHandler(object sender, MsgPumpResults e)
 {
     this.log.Info("MsgPumpConnectResultEventHandler", () => string.Format(
                       "Code:{0} SocketErr:{1} Msg:{2}",
                       e.Code, e.SocketErr, e.ErrorString));
     this.OnWifiConnectionAttemptCompleted?.Invoke(sender, e);
 }
예제 #4
0
        private void SerialConnectCompleteHandler(object sender, MsgPumpResults results)
        {
            ErrReport report;

            WrapErr.ToErrReport(out report, 2003015, "Failure on SerialConnectCompleteHandler", () => {
                this.OnSerialConnectionAttemptCompleted?.Invoke(sender, results);
            });
            this.RaiseIfException(report);
        }
예제 #5
0
        private void Ethernet_OnErrorHandler(object sender, MsgPumpResults e)
        {
            ErrReport report;

            WrapErr.ToErrReport(out report, 200105, "Failure on Ethernet_OnErrorHandler", () => {
                this.OnEthernetError?.Invoke(sender, e);
            });
            this.RaiseIfException(report);
        }
        private void Wrapper_OnEthernetErrorHandler(object sender, MsgPumpResults e)
        {
            this.Dispatcher.Invoke(() => {
                this.gridWait.Collapse();
                string err = string.Format("{0} ({1})", e.Code.ToString(), e.ErrorString.Length == 0 ? "--" : e.ErrorString);
                App.ShowMsg(err);

                //if (e.Code != WifiErrorCode.UserCanceled) {
                //    string err = string.Format("{0} ({1})", e.Code.ToString(), e.ExtraInfo.Length == 0 ? "--" : e.ExtraInfo);
                //    App.ShowMsg(err);
                //}
            });
        }
예제 #7
0
 private void onSerialConnectionAttemptCompleted(object sender, MsgPumpResults e)
 {
     this.Dispatcher.Invoke(() => {
         this.ui.IsBusy = false;
         if (e.Code == MsgPumpResultCode.Connected)
         {
             this.ui.SetConnected();
         }
         else
         {
             App.ShowMsg(string.Format("{0} '{1}'", e.Code, e.ErrorString));
         }
     });
 }
        private void Wrapper_OnWifiConnectionAttemptCompletedHandler(object sender, MsgPumpResults result)
        {
            this.Dispatcher.Invoke(() => {
                this.gridWait.Collapse();
                if (result.Code != MsgPumpResultCode.Connected)
                {
                    // TODO Put up appropriate error. Better yet have the language based text set in the wrapper

                    App.ShowMsg("Failed connection");
                }
                else
                {
                    this.btnWifiDisconnect.Show();
                }
            });
        }
 private void Wrapper_OnEthernetConnectionAttemptCompletedHandler(object sender, MsgPumpResults result)
 {
     this.Dispatcher.Invoke(() => {
         this.gridWait.Collapse();
         if (result.Code != MsgPumpResultCode.Connected)
         {
             string err = string.Format("{0} ({1})", result.Code.ToString(), result.ErrorString.Length == 0 ? "--" : result.ErrorString);
             App.ShowMsg(err);
         }
         else
         {
             this.btnEthernetDisconnect.Show();
         }
     });
 }
예제 #10
0
 private void MsgPump_ConnectResultEventHandler(object sender, MsgPumpResults e)
 {
     //throw new NotImplementedException();
     this.OnWifiConnectionAttemptCompleted?.Invoke(sender, e);
 }
예제 #11
0
 /// <summary>Handle the msg pump connect result</summary>
 private void MsgPump_ConnectResultEvent(object sender, MsgPumpResults results)
 {
     // TODO - make more generic
     this.Connected = results.Code == MsgPumpResultCode.Connected;
     this.ConnectionCompleted?.Invoke(this, this.Connected);
 }
예제 #12
0
        private void Ethernet_OnEthernetConnectionAttemptCompletedHandler(object sender, MsgPumpResults e)
        {
            ErrReport report;

            WrapErr.ToErrReport(out report, 200104, "Failure on Ethernet_OnEthernetConnectionAttemptCompletedHandler", () => {
                // Can do something here to save any pending IP entered
                this.log.Info("Ethernet_OnEthernetConnectionAttemptCompletedHandler",
                              () => string.Format("Connect attempt returned:{0}", e.Code));

                this.OnEthernetConnectionAttemptCompleted?.Invoke(sender, e);
            });
            this.RaiseIfException(report);
        }