Exemple #1
0
        private async void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            if (isLoading)
            {
                return;
            }
            var slider    = sender as Slider;
            var textblock = TextBlocks[Sliders.IndexOf(slider)];

            textblock.Text = slider.Value.ToString();
            handAngles[(int)slider.Tag - 1] = (int)slider.Value;
            var command = new PipeCommands.SetHandAngle {
                HandAngles = handAngles
            };

            if (LeftHandRadioButton.IsChecked == true)
            {
                command.LeftEnable = true;
            }
            if (RightHandRadioButton.IsChecked == true)
            {
                command.RightEnable = true;
            }
            if (BothHandRadioButton.IsChecked == true)
            {
                command.LeftEnable = command.RightEnable = true;
            }
            await Globals.Client.SendCommandAsync(command);

            CustomNameTextBox.Text = "カスタム";
        }
Exemple #2
0
        private async void PresetComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (PresetComboBox.SelectedItem == null)
            {
                return;
            }
            var path = Globals.GetCurrentAppDir() + PresetDirectory + "\\" + PresetComboBox.SelectedItem.ToString() + ".json";

            handAngles = Json.Serializer.Deserialize <List <int> >(File.ReadAllText(path));
            isLoading  = true;
            if (handAngles.Where(d => d < -90 || d > 10).Any())
            {
                AngleLimitCheckBox.IsChecked = false;
            }
            for (int i = 0; i < handAngles.Count; i++)
            {
                Sliders[i].Value   = handAngles[i];
                TextBlocks[i].Text = handAngles[i].ToString();
            }
            isLoading = false;
            var command = new PipeCommands.SetHandAngle {
                HandAngles = handAngles
            };

            if (LeftHandRadioButton.IsChecked == true)
            {
                command.LeftEnable = true;
            }
            if (RightHandRadioButton.IsChecked == true)
            {
                command.RightEnable = true;
            }
            if (BothHandRadioButton.IsChecked == true)
            {
                command.LeftEnable = command.RightEnable = true;
            }
            await Globals.Client.SendCommandAsync(command);

            CustomNameTextBox.Text = "";
        }