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

Merge remote-tracking branch 'remotes/origin/dev6.0-kundig' into dev6.0

parents cda4d048 3db58062
...@@ -120,6 +120,9 @@ ...@@ -120,6 +120,9 @@
<Compile Include="UI.OSK\WdNumKeyboard.xaml.cs"> <Compile Include="UI.OSK\WdNumKeyboard.xaml.cs">
<DependentUpon>WdNumKeyboard.xaml</DependentUpon> <DependentUpon>WdNumKeyboard.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Prompt.xaml.cs">
<DependentUpon>Prompt.xaml</DependentUpon>
</Compile>
<Compile Include="WindowBigClose.cs" /> <Compile Include="WindowBigClose.cs" />
<Compile Include="Window_Tip.xaml.cs"> <Compile Include="Window_Tip.xaml.cs">
<DependentUpon>Window_Tip.xaml</DependentUpon> <DependentUpon>Window_Tip.xaml</DependentUpon>
...@@ -238,6 +241,10 @@ ...@@ -238,6 +241,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Prompt.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Window_Tip.xaml"> <Page Include="Window_Tip.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
......
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
<Rectangle Name="rectangle" Grid.ColumnSpan="2" Fill="#FF579aab"/> <Rectangle Name="rectangle" Grid.ColumnSpan="2" Fill="#FF579aab"/>
<TextBlock Grid.ColumnSpan="2" HorizontalAlignment="Center" FontSize="18" VerticalAlignment="Bottom" Grid.RowSpan="2"> <TextBlock Grid.ColumnSpan="2" HorizontalAlignment="Center" FontSize="18" VerticalAlignment="Bottom" Grid.RowSpan="2">
<TextBlock.Inlines> <TextBlock.Inlines>
<Run Name="run_title" Text="{Binding Title}" FontWeight="SemiBold" /> <Run Name="run_title" FontWeight="SemiBold" />
<Run Name="run_title2" Text="{Binding Title2}" Foreground="#FF585858" /> <Run Name="run_title2" Foreground="#FF585858" />
</TextBlock.Inlines> </TextBlock.Inlines>
</TextBlock> </TextBlock>
......
...@@ -515,26 +515,37 @@ namespace FLY.ControlLibrary ...@@ -515,26 +515,37 @@ namespace FLY.ControlLibrary
mRefresh.UpdateY = true; mRefresh.UpdateY = true;
CheckDataSourceEmpty(); CheckDataSourceEmpty();
run_title.Text = Title;
run_title2.Text = Title2;
} }
void GraphRange_PropertyChanged(object sender, PropertyChangedEventArgs e) void GraphRange_PropertyChanged(object sender, PropertyChangedEventArgs e)
{ {
if ((e.PropertyName == "Target") || if ((e.PropertyName == "Target") ||
(e.PropertyName == "Alarm") || (e.PropertyName == "Alarm") ||
(e.PropertyName == "YRangePercent") || (e.PropertyName == "YRangePercent") ||
(e.PropertyName == "AutoTarget") || (e.PropertyName == "AutoTarget") ||
(e.PropertyName == "IsAutoTarget") || (e.PropertyName == "IsAutoTarget") ||
(e.PropertyName == "IsPercent") || (e.PropertyName == "IsPercent") ||
(e.PropertyName == "Type")) (e.PropertyName == "Type"))
{ {
mRefresh.UpdateY = true; mRefresh.UpdateY = true;
mRefresh.UpdateData = true; mRefresh.UpdateData = true;
} }
else if ((e.PropertyName == "DataCnt")|| else if ((e.PropertyName == "DataCnt") ||
(e.PropertyName == "XAxisType")) (e.PropertyName == "XAxisType"))
{ {
mRefresh.UpdateX = true; mRefresh.UpdateX = true;
} }
else if (e.PropertyName == "Title") {
run_title.Text = Title;
}
else if (e.PropertyName == "Title2")
{
run_title2.Text = Title2;
}
} }
void InitializeComponent2() void InitializeComponent2()
......
<flyctrllib:WindowBigClose
x:Class="FLY.ControlLibrary.Prompt"
xmlns:flyctrllib="clr-namespace:FLY.ControlLibrary"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
SizeToContent="WidthAndHeight">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid TextBlock.FontSize="24" TextBlock.FontStyle="Normal" Background="WhiteSmoke">
<StackPanel Orientation="Vertical" Margin="5" MinWidth="400">
<TextBlock x:Name="textblock_message" Text="message" FontSize="40" Margin="10,40,10,10" />
<TextBox x:Name="textbox_input" Style="{StaticResource TextBoxStyle_FieldContent}" Tag="Full" Width="auto" Margin="10,10,10,40" />
<Button Style="{StaticResource ButtonStyle_apply}" Click="button_ok_Click"/>
</StackPanel>
</Grid>
</flyctrllib:WindowBigClose >
using System.Windows;
namespace FLY.ControlLibrary
{
/// <summary>
/// 提示输入文本框
/// </summary>
public partial class Prompt : WindowBigClose
{
public Prompt()
{
InitializeComponent();
}
public static bool Show(string message, ref string input)
{
Prompt mb = new Prompt();
mb.textblock_message.Text = message;
mb.textbox_input.Text = input;
mb.Owner = Application.Current.MainWindow;
if (mb.ShowDialog() == true)
{
input = mb.textbox_input.Text;
return true;
}
else
{
return false;
}
}
private void button_ok_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = true;
this.Close();
}
}
}
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
<Setter Property="Foreground" Value="#FF3B3B3B" /> <Setter Property="Foreground" Value="#FF3B3B3B" />
<Setter Property="FontWeight" Value="Bold" /> <Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="36" /> <Setter Property="FontSize" Value="36" />
<Setter Property="FontFamily" Value="Microsoft Sans Serif" /> <Setter Property="FontFamily" Value="Arial" />
<Setter Property="TextAlignment" Value="Left" /> <Setter Property="TextAlignment" Value="Left" />
</Style> </Style>
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<Setter Property="Foreground" Value="#FF3B3B3B" /> <Setter Property="Foreground" Value="#FF3B3B3B" />
<Setter Property="FontWeight" Value="Bold" /> <Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="36" /> <Setter Property="FontSize" Value="36" />
<Setter Property="FontFamily" Value="Microsoft Sans Serif" /> <Setter Property="FontFamily" Value="Arial" />
<Setter Property="TextAlignment" Value="Left" /> <Setter Property="TextAlignment" Value="Left" />
<Setter Property="MinWidth" Value="30" /> <Setter Property="MinWidth" Value="30" />
</Style> </Style>
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
<Style TargetType="TextBlock" x:Key="TextBlockStyle_FieldContent_mm_interval"> <Style TargetType="TextBlock" x:Key="TextBlockStyle_FieldContent_mm_interval">
<Setter Property="Foreground" Value="#FF888888" /> <Setter Property="Foreground" Value="#FF888888" />
<Setter Property="FontSize" Value="36" /> <Setter Property="FontSize" Value="36" />
<Setter Property="FontFamily" Value="Microsoft Sans Serif" /> <Setter Property="FontFamily" Value="Arial" />
<Setter Property="TextAlignment" Value="Left" /> <Setter Property="TextAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Bottom" /> <Setter Property="VerticalAlignment" Value="Bottom" />
</Style> </Style>
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
<Style TargetType="TextBlock" x:Key="TextBlockStyle_FieldContent_mm"> <Style TargetType="TextBlock" x:Key="TextBlockStyle_FieldContent_mm">
<Setter Property="Foreground" Value="#FF888888" /> <Setter Property="Foreground" Value="#FF888888" />
<Setter Property="FontSize" Value="22" /> <Setter Property="FontSize" Value="22" />
<Setter Property="FontFamily" Value="Microsoft Sans Serif" /> <Setter Property="FontFamily" Value="Arial" />
<Setter Property="TextAlignment" Value="Left" /> <Setter Property="TextAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Bottom" /> <Setter Property="VerticalAlignment" Value="Bottom" />
</Style> </Style>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<SolidColorBrush x:Key="Color_dark" Color="#8e9aa8"/> <SolidColorBrush x:Key="Color_dark" Color="#8e9aa8"/>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_abc"> <Style TargetType="TextBlock" x:Key="TextBlockStyle_abc">
<Setter Property="FontSize" Value="20" /> <Setter Property="FontSize" Value="20" />
<Setter Property="FontFamily" Value="Microsoft Sans Serif" /> <Setter Property="FontFamily" Value="Arial" />
</Style> </Style>
<Style TargetType="Button" x:Key="ButtonStyle_key"> <Style TargetType="Button" x:Key="ButtonStyle_key">
<Setter Property="Margin" Value="3"/> <Setter Property="Margin" Value="3"/>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<SolidColorBrush x:Key="Color_dark" Color="#8e9aa8"/> <SolidColorBrush x:Key="Color_dark" Color="#8e9aa8"/>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_abc"> <Style TargetType="TextBlock" x:Key="TextBlockStyle_abc">
<Setter Property="FontSize" Value="20" /> <Setter Property="FontSize" Value="20" />
<Setter Property="FontFamily" Value="Microsoft Sans Serif" /> <Setter Property="FontFamily" Value="Arial" />
</Style> </Style>
<Style TargetType="Button" x:Key="ButtonStyle_key"> <Style TargetType="Button" x:Key="ButtonStyle_key">
<Setter Property="Margin" Value="3"/> <Setter Property="Margin" Value="3"/>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FObjBase.Reflect
{
/// <summary>
/// 注册 event 返回类型;
/// 客户端,默认使用 Trigger_xxxx(xxxx为event名称),作为触发事件的函数,该函数的参数类型就是EventArgsType;
/// </summary>
public class PushAttribute : Attribute
{
public Type EventArgsType;
public string TriggerName;
public PushAttribute(Type eventArgsType)
{
EventArgsType = eventArgsType;
}
public PushAttribute(Type eventArgsType, string triggerName)
{
EventArgsType = eventArgsType;
TriggerName = triggerName;
}
}
/// <summary>
/// 注册远程调用返回类型
/// </summary>
public class CallAttribute : Attribute
{
public Type ReponseType;
public CallAttribute()
{
}
public CallAttribute(Type reponseType)
{
ReponseType = reponseType;
}
}
/// <summary>
/// 注册 它的PropertyChanged 事件,且枚举它的子属性,
/// 找到[PropertyPush] 递归 注册下去
/// </summary>
public class PropertyPushAttribute : Attribute
{
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{15F40C32-D546-4B2A-8D80-B3DDBCDAA690}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FObjBase.Reflect</RootNamespace>
<AssemblyName>FObjBase.Reflect</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CallAttribute.cs" />
<Compile Include="Reflect_OBJ_INTERFACE.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Reflect_Proxy.cs" />
<Compile Include="Reflect_SeviceClient.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FObjSys\FObjBase.csproj">
<Project>{abfe87d4-b692-4ae9-a8c0-1f470b8acbb8}</Project>
<Name>FObjBase</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.Misc\MISC\Misc.csproj">
<Project>{5ee61ac6-5269-4f0f-b8fa-4334fe4a678f}</Project>
<Name>Misc</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("FObjBaseReflect")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FObjBaseReflect")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("15f40c32-d546-4b2a-8d80-b3ddbcdaa690")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FObjBase.Reflect
{
public class Reflect_OBJ_INTERFACE
{
#region Push
public const UInt16 PUSH_Event = 101;
public const UInt16 PUSH_PropertyChanged = 102;
#endregion
#region CallFunction
public const UInt16 CALL_GetAllProperties = 100;
public const UInt16 CALL_SetProperty = 101;
public const UInt16 CALL_MethodInvoke = 102;
#endregion
public class ReflectData
{
public string name;
public JToken data;
}
}
}
This diff is collapsed.
This diff is collapsed.
...@@ -39,9 +39,14 @@ namespace FObjBase ...@@ -39,9 +39,14 @@ namespace FObjBase
public virtual int SendPacket(byte[] buffer) public virtual int SendPacket(byte[] buffer)
{ {
int len = buffer.Length; lock (out_buffer)
out_buffer.AddRange(buffer); {
return len; int len = buffer.Length;
out_buffer.AddRange(buffer);
return len;
}
} }
protected virtual int GetRecvInfoPacket() // return length of the packet protected virtual int GetRecvInfoPacket() // return length of the packet
...@@ -123,35 +128,37 @@ namespace FObjBase ...@@ -123,35 +128,37 @@ namespace FObjBase
} }
int Send_Poll() int Send_Poll()
{ {
int cnt_total = 0;
if (out_buffer.Count() == 0)//没数据,直接返回 if (out_buffer.Count() == 0)//没数据,直接返回
return 0; return 0;
lock (out_buffer) {
while (out_buffer.Count() > 0)//只有有数据发送,且能发送,没有 block, 就会一直循环 int cnt_total = 0;
{ while (out_buffer.Count() > 0)//只有有数据发送,且能发送,没有 block, 就会一直循环
int cnt;
try
{ {
cnt = sock.Send(out_buffer.ToArray()); int cnt;
} try
catch (System.Net.Sockets.SocketException e) {
{ cnt = sock.Send(out_buffer.ToArray());
if (e.SocketErrorCode == SocketError.WouldBlock)//当前发不了,退出循环,等下次!!!! }
break; catch (System.Net.Sockets.SocketException e)
return -1;//异常,断开连接!!! {
} if (e.SocketErrorCode == SocketError.WouldBlock)//当前发不了,退出循环,等下次!!!!
break;
return -1;//异常,断开连接!!!
}
if (cnt > 0) if (cnt > 0)
{ {
out_buffer.RemoveRange(0, cnt);//发送成功,删除!!! out_buffer.RemoveRange(0, cnt);//发送成功,删除!!!
cnt_total+=cnt; cnt_total+=cnt;
} }
else else
{ {
break; break;
}
} }
return cnt_total;//返回总发送量
} }
return cnt_total;//返回总发送量
} }
int Receive_Poll() int Receive_Poll()
...@@ -269,7 +276,10 @@ namespace FObjBase ...@@ -269,7 +276,10 @@ namespace FObjBase
logger.Error("TCPConn OnPoll 连接断开,清空接收缓存区"); logger.Error("TCPConn OnPoll 连接断开,清空接收缓存区");
in_buffer.Clear(); in_buffer.Clear();
out_buffer.Clear(); lock(out_buffer)
{
out_buffer.Clear();
}
Enable = false; Enable = false;
} }
return ret; return ret;
......
No preview for this file type
No preview for this file type
No preview for this file type
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