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

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

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