This commit is contained in:
2024-12-18 15:50:21 +08:00
parent 684973e6b7
commit b2c54119ea
214 changed files with 65908 additions and 8461 deletions

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace CapMachine.Wpf.Converts
{
public class BoolOkStrConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return null;
return (bool)value==true?"正常": "失败";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
}

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace CapMachine.Wpf.Converts
{
public class BoolStateStrConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return null;
return (bool)value==true?"运行中": "未运行";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
}

View File

@@ -38,6 +38,13 @@ namespace CapMachine.Wpf.Converts
/// <returns></returns>
private string SecToString(int TotalSec)
{
//int hour = TotalSec / 3600;
//int minute = (TotalSec - hour * 3600) / 60;
//int second = TotalSec % 60;
//return string.Format("{0}:{1}:{2}", hour, minute, second);
////Console.WriteLine(result);
TimeSpan TimeInfo = TimeSpan.FromSeconds(TotalSec);
return TimeInfo.ToString();
}

View File

@@ -0,0 +1,45 @@
using Arction.RenderingDefinitions;
using MathNet.Numerics;
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.Data;
namespace CapMachine.Wpf.Converts
{
/// <summary>
/// 多值转换
/// </summary>
public class ValuePrecisionConverter : IMultiValueConverter
{
public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
{
if (value[0] is double doubleValue)
{
return Math.Round(doubleValue, int.Parse(value[1].ToString())).ToString();
//
//if (int.TryParse(precision, out int decimalPlaces))
//{
// return doubleValue.ToString($"F{decimalPlaces}", culture);
//}
}
//return value.All(v => (v is bool && (bool)v))
//? Visibility.Visible
//: Visibility.Hidden;
//return Math.Round(value[0], value[1]);
return value[0].ToString();
//return value[0];
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}