Commit 2302ee64 authored by 潘栩锋's avatar 潘栩锋 🚴

和美安装包_v6.21.7

parent 174df306
......@@ -2,4 +2,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:FLY.Weight2.UI.Client.Converter">
<local:RatioConverter x:Key="rconv" />
<local:NumberFloorConverter x:Key="floorConv"/>
<local:PercentConverter x:Key="percentConv"/>
</ResourceDictionary>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Forms;
using System.Windows.Navigation;
namespace FLY.Weight2.UI.Client.Converter
{
public class NumberFloorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
int digit = 0;
if (parameter is string)
{
if (int.TryParse((string)parameter, out digit))
{
}
}
else if (parameter is int)
{
digit = (int)parameter;
}
double d = 0;
if (value is double)
{
d = (double)value;
d = Floor(d, digit);
}
else if (value is float)
{
d = (float)value;
d = Floor(d, digit);
}
return d.ToString($"F{digit}");
}
double Floor(double d, int digit)
{
double pow = Math.Pow(10, digit);
return Math.Floor(d * pow) / pow;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace FLY.Weight2.UI.Client.Converter
{
public class PercentConverter : IValueConverter
{
#region IValueConverter 成员
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
double percent = (double)value;
return (percent * 100).ToString("F1");
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
double percent = 0;
if (double.TryParse(value as string, out percent))
{
return percent / 100.0;
}
else
{
return 0;
}
}
#endregion
}
}
......@@ -72,7 +72,9 @@
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Converter\NumberFloorConverter.cs" />
<Compile Include="Converter\OpacityConverter.cs" />
<Compile Include="Converter\PercentConverter.cs" />
<Compile Include="Converter\RatioConverter.cs" />
<Compile Include="Converter\ReverseConverter.cs" />
<Compile Include="UiModule\DynAreaWeight.xaml.cs">
......
和美安装包_v6.21.7 -20210126
1. 修复 单组份出错
和美安装包_v6.21.6 -20210120
1. 修复 ad盒1min多次重连
1. 修复 TCPCONN, FLYAD7 的超时使用stopwatch
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment