コード例 #1
0
ファイル: Form1.cs プロジェクト: m4te0/Roboty
 private void Port_ConnectionStatusChanged(object sender, ConnectionStatusChangedArgs e)
 {
     if (e.OldStatus && !e.NewStatus)
     {
         // obsłużyć rozłączenie
     }
 }
コード例 #2
0
 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!");
     }
 }
コード例 #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;
     //}
 }
コード例 #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);
        }
コード例 #5
0
        //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;
            }
        }
コード例 #6
0
 /// <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;
     }
 }
コード例 #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);
        }
コード例 #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;
            }
        }
コード例 #9
0
 private void Plc_ConnectionStatusChanged(object sender, ConnectionStatusChangedArgs e)
 {
     OnPropertyChanged("ConnectionStatus");
     OnPropertyChanged("ButtonConnectDisconnectContent");
     OnPropertyChanged("CanEditConnectionSetting");
 }