init
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace GroupChannelList.Converters
|
||||
{
|
||||
public class BooleanToWidthConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (null == value) return 0;
|
||||
double width = double.NaN;
|
||||
if (parameter != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
width = double.Parse(parameter.ToString());
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
return (bool)value ? width : 0;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace GroupChannelList.Converters
|
||||
{
|
||||
public class SensorIdBackgroundConverter : IValueConverter
|
||||
{
|
||||
private static SolidColorBrush SensorIdBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0xE3, 0xFB, 0xE1));
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (null == value)
|
||||
{
|
||||
return Brushes.Transparent;
|
||||
}
|
||||
try
|
||||
{
|
||||
var bSensorId = (bool)value;
|
||||
if (bSensorId)
|
||||
{
|
||||
SensorIdBrush.Freeze();
|
||||
return SensorIdBrush;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Trace.WriteLine(ex.Message);
|
||||
}
|
||||
return Brushes.Transparent;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user