This commit is contained in:
sc committed 2024-10-28 23:13:10 +08:00
commit 8c351c792c
73 files changed
+11632 -1

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace DyeingComputer.ConvertMoels
{
internal class BoolRBConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool G =(Boolean) value;
// bool G = (bool)value;
if (!G)//判断单元格值是否为零
{
return "";//零返回
}
else
{
return "red";//非零返回红色
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return "";
}
}
}
+31
View File
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace DyeingComputer.ConvertMoels
{
internal class GramsSQLConvert: IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
string G = System.Convert.ToString(value);
if (G=="0")//判断单元格值是否为零
{
return "black";//零返回
}
else
{
return "red";//非零返回红色
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
}
+32
View File
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace DyeingComputer.ConvertMoels
{
internal class IORBConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
String G = value.ToString();
// bool G = (bool)value;
if ((G == "AI")||(G == "DO"))//判断单元格值是否为零
{
return "green";//零返回
}
else
{
return "blue";//非零返回红色
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
}
+59
View File
@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace DyeingComputer.ConvertMoels
{
/// <summary>
/// 原料类型数值转换器
/// 将类型数值转换为类型名称返回
/// </summary>
internal class ProductTypeSQLConvert : IValueConverter
{
/// <summary>
/// </summary>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
string ProductType = System.Convert.ToString(value);
if (ProductType == "1")//类型0:染料,1:助剂,2:粉体助剂,3:液体染料,其它:未知
{
return "染料";
}
else
{
if (ProductType == "2")
{
return "助剂";
}
else
{
if (ProductType == "3")
{
return "粉体助剂";
}
else
{
if (ProductType == "4")
{
return "液体染料";
}
else
{
return "未知类型";
}
}
}
}
}
/// <summary>
/// </summary>
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
}
+32
View File
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Data;
namespace DyeingComputer.ConvertMoels
{
/// <summary>
/// 序号转换器
/// 获取DataGrid的行号 , 转换为对应的序号
/// </summary>
internal class RowToIndexConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
DataGridRow row = value as DataGridRow;
if (row != null)
return row.GetIndex() + 1;
else
return -1;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
+45
View File
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace DyeingComputer.ConvertMoels
{
internal class StatenConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null)
{
return null;
}
else
{
string Staten = null;
string i = value.ToString();
if (i == "101") Staten = Properties.Resources.Ready;
else if (i == "102") Staten = Properties.Resources.Measure;
else if (i == "201") Staten = Properties.Resources.Auto;
else if (i == "202") Staten = Properties.Resources.LineUp;
else if (i == "203") Staten = Properties.Resources.Await;
else if (i == "301") Staten = Properties.Resources.Finish;
else if (i == "309") Staten = Properties.Resources.Abnormal;
else if (i == "800") Staten = Properties.Resources.Notimplementation;
else if (i == "801") Staten = Properties.Resources.Implementation;
else Staten = "null";
return Staten;
}
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}