首次上传
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace MECF.Framework.UI.Client.Ctrlib.Converter
|
||||
{
|
||||
public class Bit2Bool : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if (!(value is int))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int tempValue = (int)value;
|
||||
return tempValue == 1;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if (!(value is bool))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool tempValue = (bool)value;
|
||||
return tempValue == true ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class Null2Bool : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
return value == null;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class String2Double : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
return 0.0;
|
||||
|
||||
double tempValue = 0.0;
|
||||
double.TryParse(value.ToString(), out tempValue);
|
||||
|
||||
return tempValue;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class Float2String : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
return string.Empty;
|
||||
|
||||
if (double.IsNaN((double)value))
|
||||
return string.Empty;
|
||||
else
|
||||
return value;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace MECF.Framework.UI.Client.Ctrlib.Converter
|
||||
{
|
||||
public class DisplayNameConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is string s1)
|
||||
{
|
||||
int idx = s1.IndexOf('_');
|
||||
return s1.Substring(idx + 1);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace MECF.Framework.UI.Client.Ctrlib.Converter
|
||||
{
|
||||
public class FOUPStatusConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
return string.Empty;
|
||||
|
||||
string result = string.Empty;
|
||||
int iValue;
|
||||
if (int.TryParse(value.ToString(), out iValue))
|
||||
{
|
||||
if (iValue == 0)
|
||||
result = "Loaded";
|
||||
else if (iValue == 1)
|
||||
result = "Mapped";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace MECF.Framework.UI.Client.Ctrlib.Converter
|
||||
{
|
||||
public class HideNullConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using OpenSEMI.Ctrlib.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace OpenSEMI.Ctrlib.Converter
|
||||
{
|
||||
internal class SlotBorderConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if (value is SlotBorderStatus)
|
||||
{
|
||||
//deal with the priority
|
||||
SlotBorderStatus status = (SlotBorderStatus)value;
|
||||
|
||||
if (status.HasFlag(SlotBorderStatus.MouseOver))
|
||||
return SlotBorderStatus.MouseOver;
|
||||
else if (status.HasFlag(SlotBorderStatus.TransferSource))
|
||||
return SlotBorderStatus.TransferSource;
|
||||
else if (status.HasFlag(SlotBorderStatus.TransferTarget))
|
||||
return SlotBorderStatus.TransferTarget;
|
||||
else if (status.HasFlag(SlotBorderStatus.Selected))
|
||||
return SlotBorderStatus.Selected;
|
||||
else
|
||||
return SlotBorderStatus.None;
|
||||
}
|
||||
return SlotBorderStatus.None;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Windows.Data;
|
||||
using OpenSEMI.Ctrlib.Controls;
|
||||
|
||||
namespace MECF.Framework.UI.Client.Ctrlib.Converter
|
||||
{
|
||||
public class UnitOnlineBorderColorConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if (value is bool)
|
||||
{
|
||||
if ((bool) value)
|
||||
return "LimeGreen";// "#AFC2D3";
|
||||
else
|
||||
{
|
||||
return "Gray";
|
||||
}
|
||||
}
|
||||
return "Transparent";
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Windows.Data;
|
||||
using OpenSEMI.Ctrlib.Controls;
|
||||
|
||||
namespace MECF.Framework.UI.Client.Ctrlib.Converter
|
||||
{
|
||||
public class UnitStatusBackgroundColorConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if (value is string)
|
||||
{
|
||||
string status = (string) value;
|
||||
if (!string.IsNullOrEmpty(status))
|
||||
status = status.Trim().ToLower();
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case "error":
|
||||
return "OrangeRed";
|
||||
case "idle":
|
||||
return "LightBlue";
|
||||
case "init":
|
||||
case "notconnect":
|
||||
return "Yellow";
|
||||
default:
|
||||
return "LawnGreen";
|
||||
}
|
||||
}
|
||||
|
||||
return "Transparent";
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace MECF.Framework.UI.Client.Ctrlib.Converter
|
||||
{
|
||||
public class VisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
int target = 1;
|
||||
if (parameter != null)
|
||||
{
|
||||
target = int.Parse(parameter.ToString());
|
||||
}
|
||||
return (int)value == target ? Visibility.Visible : Visibility.Hidden;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace MECF.Framework.UI.Client.Ctrlib.Converter
|
||||
{
|
||||
public class WaferStatusConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
var status = (int)value;
|
||||
if (status == 0)
|
||||
{ return false; }
|
||||
else
|
||||
{ return true; }
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace MECF.Framework.UI.Client.Ctrlib.Converter
|
||||
{
|
||||
public class WaferTrayStatusConvert : IMultiValueConverter
|
||||
{
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (values[0] != null && values[1] != null)
|
||||
{
|
||||
int waferStatus = (Int32)values[0];
|
||||
int trayStatus = (Int32)values[1];
|
||||
return (trayStatus != 0 && waferStatus==0) ? trayStatus+10 : waferStatus;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user