示例#1
0
        /// <summary>
        /// Method used to Send Speed and position value to PLC if there value is changed
        /// </summary>

        private async void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == nameof(RoterJogSpeed))
            {
                await _plcService.WriteRoterJogSpeed((short)RoterJogSpeed);

                Properties.Mainpage.Default.RoterJogSpeed = RoterJogSpeed;
                Properties.Mainpage.Default.Save();
            }
            else if (e.PropertyName == nameof(RoterPositioningSpeed))
            {
                await _plcService.WriteRoterPositioningSpeed((short)RoterPositioningSpeed);

                Properties.Mainpage.Default.RoterPositioningSpeed = RoterPositioningSpeed;
                Properties.Mainpage.Default.Save();
            }
            else if (e.PropertyName == nameof(RoterCommendposition))
            {
                await _plcService.WriteRoterCommendposition((short)RoterCommendposition);

                Properties.Mainpage.Default.RoterCommendposition = RoterCommendposition;
                Properties.Mainpage.Default.Save();
            }
            else if (e.PropertyName == nameof(RoteryPosJogSpeed))
            {
                await _plcService.WriteRoteryPosJogSpeed((short)RoteryPosJogSpeed);

                Properties.Mainpage.Default.RoteryPosJogSpeed = RoteryPosJogSpeed;
                Properties.Mainpage.Default.Save();
            }
            else if (e.PropertyName == nameof(RoteryPosPositioningSpeed))
            {
                await _plcService.WriteRoteryPosPositioningSpeed((short)RoteryPosPositioningSpeed);

                Properties.Mainpage.Default.RoteryPosPositioningSpeed = RoteryPosPositioningSpeed;
                Properties.Mainpage.Default.Save();
            }
            else if (e.PropertyName == nameof(RoteryPosCommendposition))
            {
                await _plcService.WriteRoteryPosCommendposition((short)RoteryPosCommendposition);

                Properties.Mainpage.Default.RoteryPosCommendposition = RoteryPosCommendposition;
                Properties.Mainpage.Default.Save();
            }
            else if (e.PropertyName == nameof(ShorterJogSpeed))
            {
                await _plcService.WriteShorterJogSpeed((short)ShorterJogSpeed);

                Properties.Mainpage.Default.ShorterJogSpeed = ShorterJogSpeed;
                Properties.Mainpage.Default.Save();
            }
            else if (e.PropertyName == nameof(ShorterPositioningSpeed))
            {
                await _plcService.WriteShorterPositioningSpeed((short)ShorterPositioningSpeed);

                Properties.Mainpage.Default.ShorterPositioningSpeed = ShorterPositioningSpeed;
                Properties.Mainpage.Default.Save();
            }
            else if (e.PropertyName == nameof(ShorterCommendposition))
            {
                await _plcService.WriteShorterCommendposition((short)ShorterCommendposition);

                Properties.Mainpage.Default.ShorterCommendposition = ShorterCommendposition;
                Properties.Mainpage.Default.Save();
            }
        }