Commit 1b294c14 authored by 潘栩锋's avatar 潘栩锋 🚴

1. 添加 [PropertyPush] 支持数组, 但只支持root下的数组。 子属性 下不能再有 [PropertyPush] 数组

2. 修改 属性的推送,设置,读取, 的数据通讯格式(使用 路径+json 表示)
parent 2f4b8a4c
......@@ -7,8 +7,8 @@
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<StackPanel VerticalAlignment="Center">
<StackPanel HorizontalAlignment="Center" DataContext="{Binding Foo}" >
<StackPanel Margin="5">
<StackPanel DataContext="{Binding Foo}" Margin="5">
<TextBlock>
IsConnected=<Run Text="{Binding IsConnected,Mode=OneWay}"/>
</TextBlock>
......@@ -18,8 +18,45 @@
<TextBlock>
AddFuncTime=<Run Text="{Binding AddFuncTime,Mode=OneWay}"/>
</TextBlock>
<GroupBox Header="Bars">
<ItemsControl ItemsSource="{Binding Bars}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<GroupBox Margin="5">
<StackPanel>
<TextBlock Text="Number"/>
<TextBox Text="{Binding Number}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
</GroupBox>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</GroupBox>
<GroupBox Header="Param" Margin="5" DataContext="{Binding Param}">
<StackPanel Orientation="Horizontal">
<StackPanel Margin="5">
<TextBlock Text="PName"/>
<TextBox Text="{Binding PName}"/>
</StackPanel>
<StackPanel Margin="5">
<TextBlock Text="Target"/>
<TextBox Text="{Binding Target}"/>
</StackPanel>
<GroupBox Header="Bar" Margin="5" DataContext="{Binding Bar}">
<StackPanel>
<TextBlock Text="Number"/>
<TextBox Text="{Binding Number}"/>
</StackPanel>
</GroupBox>
</StackPanel>
</GroupBox>
</StackPanel>
<StackPanel Orientation="Horizontal" >
<TextBlock Text="a("/>
<TextBox Text="{Binding A}" MinWidth="100"/>
<TextBlock Text=")+b("/>
......
......@@ -8,16 +8,53 @@
Title="MainWindow" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" >
<StackPanel Margin="5">
<TextBlock>
Number=<Run Text="{Binding Number,Mode=OneWay}"/>
</TextBlock>
<TextBlock>
AddFuncTime=<Run Text="{Binding AddFuncTime,Mode=OneWay}"/>
</TextBlock>
<GroupBox Header="Bars" Margin="5">
<ItemsControl ItemsSource="{Binding Bars}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<GroupBox Header="Bar" Margin="5">
<StackPanel>
<TextBlock Text="Number"/>
<TextBox Text="{Binding Number}"/>
</StackPanel>
</GroupBox>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</GroupBox>
<GroupBox Header="Param" Margin="5" DataContext="{Binding Param}">
<StackPanel Orientation="Horizontal">
<StackPanel Margin="5">
<TextBlock Text="PName"/>
<TextBox Text="{Binding PName}"/>
</StackPanel>
<StackPanel Margin="5">
<TextBlock Text="Target"/>
<TextBox Text="{Binding Target}"/>
</StackPanel>
<GroupBox Header="Bar" Margin="5" DataContext="{Binding Bar}">
<StackPanel>
<TextBlock Text="Number"/>
<TextBox Text="{Binding Number}"/>
</StackPanel>
</GroupBox>
</StackPanel>
</GroupBox>
</StackPanel>
<Grid Grid.Row="1" Margin="5">
<Grid.RowDefinitions>
......
......@@ -35,7 +35,8 @@ namespace WSCF.Test.IService
[PropertyPush]
ProfileParam Param { get; }
[PropertyPush]
Bar[] Bars { get; }
/// <summary>
/// 只要是event, 只能是 EventHandler类,
/// EventArgs e, 通过 Push() 声明
......@@ -89,9 +90,17 @@ namespace WSCF.Test.IService
#endregion
[PropertyPush]
public Bar Bar { get; set; } = new Bar();
/// <summary>
///
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
}
public class Bar : INotifyPropertyChanged
{
public int Number { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
}
}
......@@ -18,7 +18,7 @@ namespace WSCF.Test.Server
public int[] Abc { get; protected set; }
public ProfileParam Param { get; } = new ProfileParam();
public Bar[] Bars { get; private set; }
public event PropertyChangedEventHandler PropertyChanged;
public event EventHandler DataChanged;
......@@ -26,6 +26,10 @@ namespace WSCF.Test.Server
public DispatcherTimer timer = new DispatcherTimer();
public Foo()
{
Bars = new Bar[3];
for (int i = 0; i < Bars.Count(); i++) {
Bars[i] = new Bar() { Number = i*10 };
}
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
......@@ -51,7 +55,9 @@ namespace WSCF.Test.Server
Time = DateTime.Now,
Msg = "hello " + Msg
}); ;
});
}
}
......
......@@ -23,7 +23,7 @@ namespace WSCF.Test.ServiceClient
public int[] Abc { get; set; }
public ProfileParam Param { get; } = new ProfileParam();
public Bar[] Bars { get; set; }
public FooServiceClient(string serverName, bool isByConnName, string addrOrConnName):base(serverName, isByConnName, addrOrConnName)
{
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -9,7 +9,7 @@
<PackageProjectUrl>http://private.flyautomation.net:82/panruising/wscf</PackageProjectUrl>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Version>1.0.2</Version>
<Version>2.0.0</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
......@@ -21,8 +21,6 @@
<Compile Include="..\WSCF\CallAttribute.cs" Link="CallAttribute.cs" />
<Compile Include="..\WSCF\FObjServiceClientManager.cs" Link="FObjServiceClientManager.cs" />
<Compile Include="..\WSCF\ReflectData.cs" Link="ReflectData.cs" />
<Compile Include="..\WSCF\Reflect_Proxy.cs" Link="Reflect_Proxy.cs" />
<Compile Include="..\WSCF\Reflect_SeviceClient.cs" Link="Reflect_SeviceClient.cs" />
<Compile Include="..\WSCF\WebSocketClient.cs" Link="WebSocketClient.cs" />
</ItemGroup>
......
This diff is collapsed.
......@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("佛山市枫莱尔自动化技术有限公司")]
[assembly: AssemblyProduct("WSCF")]
[assembly: AssemblyCopyright("Copyright © 2020 FlyAutomation")]
[assembly: AssemblyCopyright("Copyright © 2021 FlyAutomation")]
[assembly: AssemblyTrademark("FlyAutomation")]
[assembly: AssemblyCulture("")]
......
This diff is collapsed.
This diff is collapsed.
......@@ -46,6 +46,7 @@
<ItemGroup>
<Compile Include="AsyncCBHandler.cs" />
<Compile Include="CallAttribute.cs" />
<Compile Include="COMMON.cs" />
<Compile Include="FObjServiceClientManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ReflectData.cs" />
......
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