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 @@
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Style="{StaticResource ButtonStyle_empty}" Background="{Binding Background}" Tag="{Binding .}" Click="button_componentNew_Click" Margin="5" BorderBrush="#FF0C0C0C">
<StackPanel Orientation="Vertical" Margin="10">
<TextBlock Text="{Binding Header}" FontSize="20" TextWrapping = "Wrap" />
<TextBlock Text="{Binding Count}" FontSize="15" Margin="0,20,0,0"/>
<StackPanel Margin="10">
<TextBlock Text="{Binding Header}" FontSize="18" TextWrapping = "Wrap" />
<TextBlock Text="{Binding Count}" FontSize="12" Margin="0,20,0,0"/>
</StackPanel>
</Button>
</DataTemplate>
......
......@@ -6,29 +6,36 @@ using System.Windows.Data;
namespace FLY.ControlLibrary.Converter
{
/// <summary>
/// 3个输入,
/// [0]比例分子;
/// [1]比例分母;
/// [2]控件最大长度
/// </summary>
public class RatioConverter: IMultiValueConverter
public class RatioConverter : 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)
{
if (values.Length == 3 && (values[0] is int) && (values[1] is int) && (values[2] is double))//必须要检查,不然 界面生成器 会错误,提示转换异常
if (values.Length != 3) //必须要检查,不然 界面生成器 会错误,提示转换异常
{
double ratio ;
int value = (int)values[0];
if (value == 99999998)
value = 0;
int max = (int)values[1];
double ActualWidth = (double)values[2];
return 100;
}
double ratio;
double value = getValue(values[0]);
double max = getValue(values[1]);
double ActualWidth = getValue(values[2]);
if(max <=0)
if (max <= 0)
ratio = 0;
else
ratio = (double)value / max;
......@@ -37,14 +44,8 @@ namespace FLY.ControlLibrary.Converter
ratio = 0;
else if (ratio > 1)
ratio = 1;
return ActualWidth * ratio;
}
else
{
return 100;
}
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
{
......
using FLY.OBJComponents.Common;
using FLY.OBJComponents.IService;
using FLY.OBJComponents.OBJ_INTERFACE;
using FObjBase;
using Newtonsoft.Json;
......@@ -6,6 +7,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
namespace FLY.OBJComponents.Client
......@@ -71,6 +73,23 @@ namespace FLY.OBJComponents.Client
/// <param name="e"></param>
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();
Dictionary<string, Dictionary<string, object>> DsDso = new Dictionary<string, Dictionary<string, object>>
......
......@@ -25,10 +25,16 @@ namespace FLY.OBJComponents.Common
{
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 (v.GetType() == property.PropertyType)
{
property.SetValue(obj, v, null);
}
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