<commit_before>﻿namespace Org.Cen.RobotManager.Pages
{
    using System.Windows;
    using System.Windows.Controls;
    using Devices.Motion.Simple.Com;
    using Devices.Motor.Com;

    /// <summary>
    /// Interaction logic for RunControl.xaml
    /// </summary>
    public partial class RunControl : UserControl
    {
        private MainWindow Main
        {
            get { return (MainWindow)Window.GetWindow(this); }
        }

        public RunControl()
        {
            InitializeComponent();
        }


        // forward

        public void ForwardButton_Click(object sender, RoutedEventArgs e)
        {
            int value = (int)ForwardSlider.Value;
            MotionSimpleForwardOutData outData = new MotionSimpleForwardOutData(value);
            string command = outData.GetMessage();
            Main.SendText(command);
        }

        private void ForwardSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            if (ForwardLabel == null)
            {
                return;
            }
            ForwardLabel.Content = (int)ForwardSlider.Value + " mm";
        }

        // backward

        public void BackwardButton_Click(object sender, RoutedEventArgs e)
        {
            int value = (int)BackwardSlider.Value;

            MotionSimpleBackwardOutData outData = new MotionSimpleBackwardOutData(value);
            string command = outData.GetMessage();
            Main.SendText(command);
        }

        private void BackwardSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            if (BackwardLabel == null)
            {
                return;
            }
            BackwardLabel.Content = (int)BackwardSlider.Value + " mm";
        }

        // left

        private void LeftSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            if (LeftLabel == null)
            {
                return;
            }
            LeftLabel.Content = (int)LeftSlider.Value / 10 + " °";
        }

        private void LeftButton_Click(object sender, RoutedEventArgs e)
        {
            int value = (int)LeftSlider.Value;

            MotionSimpleRotateLeftOutData outData = new MotionSimpleRotateLeftOutData(value);
            string command = outData.GetMessage();
            Main.SendText(command);
        }

        // Right

        private void RightSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            if (RightLabel == null)
            {
                return;
            }
            RightLabel.Content = (int)RightSlider.Value / 10 + " °";
        }

        private void RightButton_Click(object sender, RoutedEventArgs e)
        {
            int value = (int)RightSlider.Value;
            MotionSimpleRotateRightOutData outData = new MotionSimpleRotateRightOutData(value);
            string command = outData.GetMessage();
            Main.SendText(command);
        }

        private void StopButton_Click(object sender, RoutedEventArgs e)
        {
            MotionSimpleStopOutData outData = new MotionSimpleStopOutData();
            string command = outData.GetMessage();
            Main.SendText(command);
        }

        // Go

        private void MotorGoButton_Click(object sender, RoutedEventArgs e)
        {
            int leftValue = (int)MotorLeftSlider.Value;
            int rightValue = (int)MotorLeftSlider.Value;
            MotorWriteOutData outData = new MotorWriteOutData(leftValue, rightValue);

            string command = outData.GetMessage();
            Main.SendText(command);
        }

        private void MotorStopButton_Click(object sender, RoutedEventArgs e)
        {
            Main.receivedData.Clear();

            MotorStopOutData outData = new MotorStopOutData();
            string command = outData.GetMessage();
            Main.SendText(command);

            while (Main.receivedData.Length < 3)
            {
            }
            LeftLabel.Content = Main.receivedData.ToString();

            Main.receivedData.Clear();
        }

        private void MotorLeftSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            if (LeftValueLabel == null)<commit_msg>Run->Motor->Go #20<commit_after>﻿namespace Org.Cen.RobotManager.Pages
{
    using System.Windows;
    using System.Windows.Controls;
    using Devices.Motion.Simple.Com;
    using Devices.Motor.Com;

    /// <summary>
    /// Interaction logic for RunControl.xaml
    /// </summary>
    public partial class RunControl : UserControl
    {
        private MainWindow Main
        {
            get { return (MainWindow)Window.GetWindow(this); }
        }

        public RunControl()
        {
            InitializeComponent();
        }


        // forward

        public void ForwardButton_Click(object sender, RoutedEventArgs e)
        {
            int value = (int)ForwardSlider.Value;
            MotionSimpleForwardOutData outData = new MotionSimpleForwardOutData(value);
            string command = outData.GetMessage();
            Main.SendText(command);
        }

        private void ForwardSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            if (ForwardLabel == null)
            {
                return;
            }
            ForwardLabel.Content = (int)ForwardSlider.Value + " mm";
        }

        // backward

        public void BackwardButton_Click(object sender, RoutedEventArgs e)
        {
            int value = (int)BackwardSlider.Value;

            MotionSimpleBackwardOutData outData = new MotionSimpleBackwardOutData(value);
            string command = outData.GetMessage();
            Main.SendText(command);
        }

        private void BackwardSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            if (BackwardLabel == null)
            {
                return;
            }
            BackwardLabel.Content = (int)BackwardSlider.Value + " mm";
        }

        // left

        private void LeftSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            if (LeftLabel == null)
            {
                return;
            }
            LeftLabel.Content = (int)LeftSlider.Value / 10 + " °";
        }

        private void LeftButton_Click(object sender, RoutedEventArgs e)
        {
            int value = (int)LeftSlider.Value;

            MotionSimpleRotateLeftOutData outData = new MotionSimpleRotateLeftOutData(value);
            string command = outData.GetMessage();
            Main.SendText(command);
        }

        // Right

        private void RightSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            if (RightLabel == null)
            {
                return;
            }
            RightLabel.Content = (int)RightSlider.Value / 10 + " °";
        }

        private void RightButton_Click(object sender, RoutedEventArgs e)
        {
            int value = (int)RightSlider.Value;
            MotionSimpleRotateRightOutData outData = new MotionSimpleRotateRightOutData(value);
            string command = outData.GetMessage();
            Main.SendText(command);
        }

        private void StopButton_Click(object sender, RoutedEventArgs e)
        {
            MotionSimpleStopOutData outData = new MotionSimpleStopOutData();
            string command = outData.GetMessage();
            Main.SendText(command);
        }

        // Go

        private void MotorGoButton_Click(object sender, RoutedEventArgs e)
        {
            int leftValue = (int)MotorLeftSlider.Value;
            int rightValue = (int)MotorRightSlider.Value;
            MotorWriteOutData outData = new MotorWriteOutData(leftValue, rightValue);

            string command = outData.GetMessage();
            Main.SendText(command);
        }

        private void MotorStopButton_Click(object sender, RoutedEventArgs e)
        {
            Main.receivedData.Clear();

            MotorStopOutData outData = new MotorStopOutData();
            string command = outData.GetMessage();
            Main.SendText(command);

            while (Main.receivedData.Length < 3)
            {
            }
            LeftLabel.Content = Main.receivedData.ToString();

            Main.receivedData.Clear();
        }

        private void MotorLeftSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            if (LeftValueLabel == null)
{'fraction_non_alphanumeric': 0.08188556868195507, 'fraction_numerical': 0.001389854065323141, 'mean_word_length': 1.8706781914893618, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '523501', 'n_tokens_mistral': 2252, 'n_tokens_neox': 2142, 'n_words': 444}