2026-06-05 13:44:39 +09:00

133 lines
4.6 KiB
C#

/*
* Copyright (c) 2022 LG Electronics Inc.
* SPDX-License-Identifier: LicenseRef-LGE-Proprietary
*/
using Aurora;
using Aurora.Api;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace AuroraUIComponent.UserControls
{
/// <summary>
/// JogUnitPanel.xaml에 대한 상호 작용 논리
/// </summary>
public partial class JogUnitPanel : UserControl
{
public JogUnitPanel()
{
InitializeComponent();
JogVelIndex = 0;
JogVelocity = LowVelocity;
}
protected readonly Logger Log = new Logger("JogUnitPanel");
public double JogStep {
get => (double)GetValue(JogStepProperty);
set => SetValue(JogStepProperty, value);
}
public static readonly DependencyProperty JogStepProperty =
DependencyProperty.Register("JogStep", typeof(double), typeof(JogUnitPanel), new UIPropertyMetadata(0D, JogStepChanged));
public bool UseIndex {
get => (bool)GetValue(UseIndexProperty);
set => SetValue(UseIndexProperty, value);
}
public static readonly DependencyProperty UseIndexProperty =
DependencyProperty.Register("UseIndex", typeof(bool), typeof(JogUnitPanel), new UIPropertyMetadata(false));
public int JogVelIndex {
get => (int)GetValue(JogVelIndexProperty);
set => SetValue(JogVelIndexProperty, value);
}
public static readonly DependencyProperty JogVelIndexProperty =
DependencyProperty.Register("JogVelIndex", typeof(int), typeof(JogUnitPanel), new UIPropertyMetadata(0));
public double JogVelocity {
get => (double)GetValue(JogVelocityProperty);
set => SetValue(JogVelocityProperty, value);
}
public static readonly DependencyProperty JogVelocityProperty =
DependencyProperty.Register("JogVelocity", typeof(double), typeof(JogUnitPanel), new UIPropertyMetadata(0.0D));
public double LowVelocity {
get => (double)GetValue(LowVelocityProperty);
set => SetValue(LowVelocityProperty, value);
}
public static readonly DependencyProperty LowVelocityProperty =
DependencyProperty.Register("LowVelocity", typeof(double), typeof(JogUnitPanel), new UIPropertyMetadata(0.0D, VelChanged));
public double MidVelocity {
get => (double)GetValue(MidVelocityProperty);
set => SetValue(MidVelocityProperty, value);
}
public static readonly DependencyProperty MidVelocityProperty =
DependencyProperty.Register("MidVelocity", typeof(double), typeof(JogUnitPanel), new UIPropertyMetadata(0.0D));
public double HighVelocity {
get => (double)GetValue(HighVelocityProperty);
set => SetValue(HighVelocityProperty, value);
}
public static readonly DependencyProperty HighVelocityProperty =
DependencyProperty.Register("HighVelocity", typeof(double), typeof(JogUnitPanel), new UIPropertyMetadata(0.0D));
private static void JogStepChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
}
private static void VelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((JogUnitPanel)d).VelUpdate();
}
private void VelUpdate()
{
switch (JogVelIndex) {
case 0:
JogVelocity = LowVelocity;
break;
case 1:
JogVelocity = MidVelocity;
break;
case 2:
JogVelocity = HighVelocity;
break;
default:
break;
}
}
private void OnRbJogUnitLowClciked(object sender, RoutedEventArgs e)
{
JogVelIndex = 0;
JogVelocity = LowVelocity;
}
private void OnRbJogUnitMiddleClciked(object sender, RoutedEventArgs e)
{
JogVelIndex = 1;
JogVelocity = MidVelocity;
}
private void OnRbJogUnitHighClciked(object sender, RoutedEventArgs e)
{
JogVelIndex = 2;
JogVelocity = HighVelocity;
}
}
}