Commit abd54323 authored by 潘栩锋's avatar 潘栩锋 🚴

1.优化 PgMainEditDynArea.xaml 左边工具栏 的字体变小

2.优化 FLY.ControlLibrary/Converter/RatioConverter.cs 比例转换器,支持float
3.优化 SyncPropServiceClient 不需要同步的property,客户端不会发送给 服务器
4.优化 PropertiesManager SetValue 不能set的,弹出提示
parent 3754da26
...@@ -202,9 +202,9 @@ ...@@ -202,9 +202,9 @@
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<Button Style="{StaticResource ButtonStyle_empty}" Background="{Binding Background}" Tag="{Binding .}" Click="button_componentNew_Click" Margin="5" BorderBrush="#FF0C0C0C"> <Button Style="{StaticResource ButtonStyle_empty}" Background="{Binding Background}" Tag="{Binding .}" Click="button_componentNew_Click" Margin="5" BorderBrush="#FF0C0C0C">
<StackPanel Orientation="Vertical" Margin="10"> <StackPanel Margin="10">
<TextBlock Text="{Binding Header}" FontSize="20" TextWrapping = "Wrap" /> <TextBlock Text="{Binding Header}" FontSize="18" TextWrapping = "Wrap" />
<TextBlock Text="{Binding Count}" FontSize="15" Margin="0,20,0,0"/> <TextBlock Text="{Binding Count}" FontSize="12" Margin="0,20,0,0"/>
</StackPanel> </StackPanel>
</Button> </Button>
</DataTemplate> </DataTemplate>
......
...@@ -6,44 +6,45 @@ using System.Windows.Data; ...@@ -6,44 +6,45 @@ using System.Windows.Data;
namespace FLY.ControlLibrary.Converter namespace FLY.ControlLibrary.Converter
{ {
/// <summary> public class RatioConverter : IMultiValueConverter
/// 3个输入,
/// [0]比例分子;
/// [1]比例分母;
/// [2]控件最大长度
/// </summary>
public class RatioConverter: IMultiValueConverter
{ {
#region IMultiValueConverter 成员 #region IMultiValueConverter 成员
double getValue(object value)
{
if ((value is int) && (!Misc.MyBase.ISVALIDATA((int)value)))
return 0;
try
{
return System.Convert.ToDouble(value);
}
catch
{
return 0;
}
}
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{ {
if (values.Length == 3 && (values[0] is int) && (values[1] is int) && (values[2] is double))//必须要检查,不然 界面生成器 会错误,提示转换异常 if (values.Length != 3) //必须要检查,不然 界面生成器 会错误,提示转换异常
{ {
double ratio ; return 100;
int value = (int)values[0]; }
if (value == 99999998)
value = 0;
int max = (int)values[1];
double ActualWidth = (double)values[2];
if(max <=0) double ratio;
ratio = 0; double value = getValue(values[0]);
else double max = getValue(values[1]);
ratio = (double)value / max; double ActualWidth = getValue(values[2]);
if (ratio < 0) if (max <= 0)
ratio = 0; ratio = 0;
else if (ratio > 1) else
ratio = 1; ratio = (double)value / max;
return ActualWidth * ratio; if (ratio < 0)
} ratio = 0;
else else if (ratio > 1)
{ ratio = 1;
return 100; return ActualWidth * ratio;
}
} }
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
......
using FLY.OBJComponents.Common; using FLY.OBJComponents.Common;
using FLY.OBJComponents.IService;
using FLY.OBJComponents.OBJ_INTERFACE; using FLY.OBJComponents.OBJ_INTERFACE;
using FObjBase; using FObjBase;
using Newtonsoft.Json; using Newtonsoft.Json;
...@@ -6,6 +7,7 @@ using System; ...@@ -6,6 +7,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Text; using System.Text;
namespace FLY.OBJComponents.Client namespace FLY.OBJComponents.Client
...@@ -71,6 +73,23 @@ namespace FLY.OBJComponents.Client ...@@ -71,6 +73,23 @@ namespace FLY.OBJComponents.Client
/// <param name="e"></param> /// <param name="e"></param>
void Data_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) void Data_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{ {
PropertyInfo property = sender.GetType().GetProperty(e.PropertyName);
if (!property.CanWrite) {
return;
}
if (sender is IPropertyOpt)
{
var opt = (IPropertyOpt)sender;
string[] nosync = opt.GetNoSyncPropNames();
if (nosync != null && nosync.Count()!=0) {
if (nosync.Contains(e.PropertyName)) {
//这个不需要同步
return;
}
}
}
string objname = (from kv in ObjNames where kv.Value == sender select kv.Key).First(); string objname = (from kv in ObjNames where kv.Value == sender select kv.Key).First();
Dictionary<string, Dictionary<string, object>> DsDso = new Dictionary<string, Dictionary<string, object>> Dictionary<string, Dictionary<string, object>> DsDso = new Dictionary<string, Dictionary<string, object>>
......
...@@ -25,10 +25,16 @@ namespace FLY.OBJComponents.Common ...@@ -25,10 +25,16 @@ namespace FLY.OBJComponents.Common
{ {
throw new Exception("PropertiesManager_JSON 类型="+obj.GetType().ToString()+" 不能找到 属性名=" + propertyName, e); throw new Exception("PropertiesManager_JSON 类型="+obj.GetType().ToString()+" 不能找到 属性名=" + propertyName, e);
} }
if (!property.CanWrite) {
throw new Exception("PropertiesManager_JSON 类型=" + obj.GetType().ToString() + " 属性名=" + propertyName +" 不能set");
}
if (property != null) if (property != null)
{ {
if (v.GetType() == property.PropertyType) if (v.GetType() == property.PropertyType)
{ {
property.SetValue(obj, v, null); property.SetValue(obj, v, null);
} }
else else
......
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