Exemple #1
0
 private void Port_ConnectionStatusChanged(object sender, ConnectionStatusChangedArgs e)
 {
     if (e.OldStatus && !e.NewStatus)
     {
         // obsłużyć rozłączenie
     }
 }
 private void OnConnectivityChanged(object sender, ConnectionStatusChangedArgs e)
 {
     if (!e.IsNowConnected)
     {
         toastMessageService.ShortAlert("Internet Connection Lost. An internet connection is necessary for this app to work!");
     }
 }
Exemple #3
0
 private void Plc_ConnectionStatusChanged(object sender, ConnectionStatusChangedArgs e)
 {
     OnPropertyChanged("ConnectionStatus");
     OnPropertyChanged("ButtonConnectDisconnectContent");
     OnPropertyChanged("CanEditConnectionSetting");
     OnPropertyChanged("NadsError");
     //switch (e)
     //{
     //    case ConnectionStatusEnum.CONNECTED:
     //        //TODO
     //        //Czyszczenie serii?
     //        //If series != null, plot.Axes[0].Minimum = plot.Axes[0].DataMinimum?
     //        getValuesTimer.Interval = ConnectionViewModel.Interval * 1000;
     //        getValuesTimer.Enabled = true;
     //        break;
     //    default:
     //        getValuesTimer.Enabled = false;
     //        if (prevReadDMOK)
     //        {
     //            ConnectionRefusedTimes.Add(DateTime.Now); //start
     //            ConnectionRefusedTimes.Add(DateTime.Now); //stop
     //        }
     //        else
     //        {
     //            ConnectionRefusedTimes[ConnectionRefusedTimes.Count - 1] = (DateTime.Now);
     //        }
     //        prevReadDMOK = false;
     //        break;
     //}
 }
Exemple #4
0
        //TODO dorobić ciągłe rysowanie jak jest łączenie
        public void ConnectionStatusChanged(object sender, ConnectionStatusChangedArgs e)
        {
            DateTime now = DateTime.Now;

            Console.WriteLine($"ConnectionStatusChanged {e.Actual} {now}");
            switch (e.Actual)
            {
            case ConnectionStatusEnum.CONNECTED:
            case ConnectionStatusEnum.DISCONNECTED:
                if (connectionRefusedAreas.Count > 0)
                {
                    connectionRefusedAreas.Last().MaximumX = DateTimeAxis.ToDouble(now);
                }
                break;

            case ConnectionStatusEnum.CONNECTION_LOST:
                RectangleAnnotation ra = new RectangleAnnotation
                {
                    MinimumX = DateTimeAxis.ToDouble(now),
                    MaximumX = DateTimeAxis.ToDouble(now),
                    Fill     = OxyColor.FromAColor(80, OxyColors.Red)
                };
                connectionRefusedAreas.Add(ra);
                break;
            }
            ChartMove();
            Plot.InvalidatePlot(true);
        }
        //TODO dorobić ciągłe rysowanie jak jest łączenie
        public void ConnectionStatusChanged(object sender, ConnectionStatusChangedArgs e)
        {
            DateTime now = DateTime.Now;

            switch (e.Actual)
            {
            case ConnectionStatusEnum.CONNECTED:
                Console.WriteLine("Połączono" + now);
                if (connectionRefusedAreas.Count > 0)
                {
                    connectionRefusedAreas.Last().MaximumX = DateTimeAxis.ToDouble(now);
                }
                break;

            case ConnectionStatusEnum.CONNECTION_LOST:
            case ConnectionStatusEnum.DISCONNECTING:
                Console.WriteLine("Połączenie utracone " + now);
                RectangleAnnotation ra = new RectangleAnnotation
                {
                    MinimumX = DateTimeAxis.ToDouble(now),
                    MaximumX = DateTimeAxis.ToDouble(now),
                    Fill     = OxyColor.FromAColor(80, OxyColors.Red)
                };
                connectionRefusedAreas.Add(ra);
                break;
            }
        }
 /// <summary>
 /// Ports the connection status changed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 private void Port_ConnectionStatusChanged(object sender, ConnectionStatusChangedArgs e)
 {
     if (e.OldStatus == true && e.NewStatus == false)
     {
         Manipulator.Port.DataReceived -= Port_DataReceived;
         ConnectionToggleIsChecked      = false;
         SelectedCOMPort = null;
     }
 }
Exemple #7
0
        private void OnConnectivityChanged(object sender, ConnectivityChangedEventArgs e)
        {
            ConnectionStatusChangedArgs args;

            if (e.IsConnected)
            {
                args = ConnectionStatusChangedArgs.ConnectionGained();
            }
            else
            {
                args = ConnectionStatusChangedArgs.ConnectionLost();
            }

            ConnectivityChanged?.Invoke(this, args);
        }
Exemple #8
0
        //SeriesVievModel



        private void Plc_ConnectionStatusChanged(object sender, ConnectionStatusChangedArgs e)
        {
            switch (e.Actual)
            {
            case ConnectionStatusEnum.CONNECTED:
                //TODO
                //Czyszczenie serii?
                //If series != null, plot.Axes[0].Minimum = plot.Axes[0].DataMinimum?
                getValuesTimer.Interval = ConnectionViewModel.Interval * 1000;
                getValuesTimer.Enabled  = true;
                break;

            default:
                getValuesTimer.Enabled = false;
                break;
            }
        }
 private void Plc_ConnectionStatusChanged(object sender, ConnectionStatusChangedArgs e)
 {
     OnPropertyChanged("ConnectionStatus");
     OnPropertyChanged("ButtonConnectDisconnectContent");
     OnPropertyChanged("CanEditConnectionSetting");
 }