74 lines
2.5 KiB
C#
74 lines
2.5 KiB
C#
/*
|
|
* Copyright (c) 2022 LG Electronics Inc.
|
|
* SPDX-License-Identifier: LicenseRef-LGE-Proprietary
|
|
*/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
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>
|
|
/// UCLedLight.xaml에 대한 상호 작용 논리
|
|
/// </summary>
|
|
public partial class UCLedLight : UserControl
|
|
{
|
|
public UCLedLight()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public bool LedStatusVal {
|
|
get { return (bool)GetValue(LedStatusValProperty); }
|
|
set { SetValue(LedStatusValProperty, value); }
|
|
}
|
|
|
|
// Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc...
|
|
public static readonly DependencyProperty LedStatusValProperty =
|
|
DependencyProperty.Register(nameof(LedStatusVal), typeof(bool), typeof(UCLedLight), new FrameworkPropertyMetadata(
|
|
false,
|
|
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
|
|
}
|
|
|
|
public class LedLightConverter : IValueConverter
|
|
{
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
Color redColor = (Color)ColorConverter.ConvertFromString("#FF0075");
|
|
SolidColorBrush RedColor = new SolidColorBrush(redColor);
|
|
|
|
Color greenColor = (Color)ColorConverter.ConvertFromString("#77D970");
|
|
SolidColorBrush GreenColor = new SolidColorBrush(greenColor);
|
|
|
|
Color blackColor = (Color)ColorConverter.ConvertFromString("#000000");
|
|
SolidColorBrush BlackColor = new SolidColorBrush(blackColor);
|
|
|
|
bool LedStatusVal = (bool)value;
|
|
if (LedStatusVal == false) { return RedColor; }
|
|
if (LedStatusVal == true) { return GreenColor; }
|
|
|
|
// 여기서 적절한 조건에 따라 색상을 선택하거나 계산하세요.
|
|
return blackColor;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
}
|
|
}
|