using HxEnum;
|
using System;
|
using System.Collections.ObjectModel;
|
using System.Linq;
|
using System.Windows;
|
using System.Windows.Controls;
|
using XHandler.Class;
|
using XHandler.Class.DataEx;
|
using XHandler.Controls;
|
using XImagingXhandler.XDAL;
|
|
namespace XHandler.View.Consumables
|
{
|
/// <summary>
|
/// LidSetting.xaml 的交互逻辑
|
/// </summary>
|
public partial class LidSetting : UserControl
|
{
|
public Labware labware { get; set; }
|
public ConsumableManagement consumableManagement;
|
public LidSetting()
|
{
|
InitializeComponent();
|
}
|
|
public LidSetting(Labware l)
|
{
|
InitializeComponent();
|
if (l.labware_type_id == EnumManagement.GetEnumValue(ConsumableTypeEnum.Rounddishlid).ToString()) // 圆形皿盖子
|
{
|
gdMainLidSetting.RowDefinitions[0].Height = new GridLength(0, GridUnitType.Pixel);
|
gdLidColor.RowDefinitions[1].Height = new GridLength(0, GridUnitType.Pixel);
|
gdLidColor.RowDefinitions[2].Height = new GridLength(0, GridUnitType.Pixel);
|
tbxBorderLine.Visibility = Visibility.Hidden;
|
btnLineColor.Visibility = Visibility.Hidden;
|
gridGapLabware.Visibility = Visibility.Hidden;
|
}
|
else
|
{
|
gdMainLidSetting.RowDefinitions[0].Height = new GridLength(40, GridUnitType.Pixel);
|
gdLidColor.RowDefinitions[1].Height = new GridLength(40, GridUnitType.Pixel);
|
gdLidColor.RowDefinitions[2].Height = new GridLength(40, GridUnitType.Pixel);
|
tbxBorderLine.Visibility = Visibility.Visible;
|
btnLineColor.Visibility = Visibility.Visible;
|
gridGapLabware.Visibility = Visibility.Visible;
|
}
|
labware = l;
|
this.DataContext = labware;
|
|
btnTopColor.RGB = labware.labware_color_top;
|
}
|
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
{
|
if (labware == null)
|
return;
|
checkboxWN.IsChecked = true;
|
|
btnLeftSideColor.RGB = labware.labware_color_lside; // 左侧
|
btnWideColor.RGB = labware.labware_color_front; // 前侧
|
btnTopColor.RGB = labware.labware_color_top; // 顶面
|
btnLineColor.RGB = labware.labware_color_line; // 边框线
|
}
|
|
private void CheckBox_Checked(object sender, RoutedEventArgs e)
|
{
|
CheckBox btn = (CheckBox)sender;
|
int nGap = 0;
|
if (checkboxWN.IsChecked == true)
|
{
|
nGap = nGap | GapLabware.WN;
|
}
|
if (checkboxWS.IsChecked == true)
|
{
|
nGap = nGap | GapLabware.WS;
|
}
|
if (checkboxEN.IsChecked == true)
|
{
|
nGap = nGap | GapLabware.EN;
|
}
|
if (checkboxES.IsChecked == true)
|
{
|
nGap = nGap | GapLabware.ES;
|
}
|
AddGapLabware(nGap);
|
}
|
|
private void AddGapLabware(int gap)
|
{
|
gridGapLabware.Children.Clear();
|
GapLabware labware = new GapLabware()
|
{
|
Width = 200,
|
GapWidth = 15,
|
LabwareGap = gap,
|
HorizontalAlignment = HorizontalAlignment.Left,
|
};
|
gridGapLabware.Children.Add(labware);
|
}
|
|
#region 宽边颜色
|
private void btnWideColor_SelectedColorChangedEvent(object sender, EventArgs e)
|
{
|
if (labware == null)
|
{
|
return;
|
}
|
|
labware.labware_color_front = btnWideColor.RGB;
|
if (consumableManagement != null)
|
{
|
consumableManagement.lvConsumable.SelectedItem = labware;
|
}
|
}
|
#endregion
|
|
#region 窄边颜色
|
private void btnLeftSideColor_SelectedColorChangedEvent(object sender, EventArgs e)
|
{
|
if (labware == null)
|
{
|
return;
|
}
|
|
labware.labware_color_lside = btnLeftSideColor.RGB;
|
if (consumableManagement != null)
|
{
|
consumableManagement.lvConsumable.SelectedItem = labware;
|
}
|
}
|
#endregion
|
|
#region 顶部颜色
|
private void btnTopColor_SelectedColorChangedEvent(object sender, EventArgs e)
|
{
|
if (labware == null)
|
{
|
return;
|
}
|
|
labware.labware_color_top = btnTopColor.RGB;
|
if (consumableManagement != null)
|
{
|
consumableManagement.lvConsumable.SelectedItem = labware;
|
}
|
}
|
#endregion
|
|
#region 边线颜色
|
private void btnLineColor_SelectedColorChangedEvent(object sender, EventArgs e)
|
{
|
if (labware == null)
|
{
|
return;
|
}
|
|
labware.labware_color_line = btnLineColor.RGB;
|
}
|
#endregion
|
}
|
}
|