Commit 7b1d8f8b authored by 潘栩锋's avatar 潘栩锋 🚴

1.修复 AD盒 设置授权码界面

2.修复 显示 IO信息 界面
parent ed3cf0e5
...@@ -75,7 +75,7 @@ namespace ThickTcpUiInWindow ...@@ -75,7 +75,7 @@ namespace ThickTcpUiInWindow
private void button_iotip_click(object sender, RoutedEventArgs e) private void button_iotip_click(object sender, RoutedEventArgs e)
{ {
Window w; Window w;
if (wdIoTipType == null && wdIoTipType.IsAssignableFrom(typeof(Window))) if (wdIoTipType != null && wdIoTipType.IsAssignableFrom(typeof(Window)))
{ {
w = Activator.CreateInstance(wdIoTipType) as Window; w = Activator.CreateInstance(wdIoTipType) as Window;
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:ThickTcpUiInWindow" xmlns:local="clr-namespace:ThickTcpUiInWindow"
Title="Window_graphfix" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Title="Window_graphfix" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
SizeToContent="WidthAndHeight"> SizeToContent="WidthAndHeight" d:DataContext="{d:DesignInstance local:WdFlyADAccessVm}">
<Window.Resources> <Window.Resources>
<ResourceDictionary> <ResourceDictionary>
<local:BytesConverter x:Key="bytesconv"/> <local:BytesConverter x:Key="bytesconv"/>
...@@ -20,22 +20,22 @@ ...@@ -20,22 +20,22 @@
<Grid TextBlock.FontSize="24" TextBlock.FontStyle="Normal" > <Grid TextBlock.FontSize="24" TextBlock.FontStyle="Normal" >
<StackPanel Orientation="Vertical" Margin="5,20"> <StackPanel Orientation="Vertical" Margin="5,20">
<StackPanel Orientation="Vertical" Margin="5"> <StackPanel Orientation="Vertical" Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeader}" Text="{DynamicResource strSequenceCode}" /> <TextBlock Style="{StaticResource TextBlockStyle_FieldHeader}" Text="{DynamicResource strSequenceCode}" />
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}" Text="{Binding Code, Converter={StaticResource ResourceKey=bytesconv}}" Tag="Full" MinWidth="400" /> <TextBlock Style="{StaticResource TextBlockStyle_FieldContent}" Text="{Binding Code, Converter={StaticResource bytesconv}}" Tag="Full" MinWidth="400" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
<StackPanel Orientation="Vertical" Margin="5"> <StackPanel Orientation="Vertical" Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strAuthorizationCode}" /> <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strAuthorizationCode}" />
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Access, Converter={StaticResource ResourceKey=bytesconv}}" Tag="Full"/> <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding Access, Converter={StaticResource bytesconv}}" Tag="Full"/>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
<Button Style="{StaticResource ButtonStyle2}" Content="{DynamicResource strApply}" Margin="5" Width="auto" Click="button_apply_Click" /> <Button Style="{StaticResource ButtonStyle2}" Content="{DynamicResource strApply}" Margin="5" Width="auto" Command="{Binding ApplyCmd}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
......
...@@ -19,16 +19,48 @@ using FLY.Thick.Base.Common; ...@@ -19,16 +19,48 @@ using FLY.Thick.Base.Common;
using FLY.Thick.Base.Client; using FLY.Thick.Base.Client;
using FLY.Thick.Base.IService; using FLY.Thick.Base.IService;
using FObjBase; using FObjBase;
using GalaSoft.MvvmLight.Command;
namespace ThickTcpUiInWindow namespace ThickTcpUiInWindow
{ {
/// <summary> /// <summary>
/// Window_FlyADAccess.xaml 的交互逻辑 /// WdFlyADAccess.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class WdFlyADAccess : FLY.ControlLibrary.WindowBigClose, INotifyPropertyChanged public partial class WdFlyADAccess : FLY.ControlLibrary.WindowBigClose
{
WdFlyADAccessVm viewModel;
/// <summary>
///
/// </summary>
public WdFlyADAccess()
{
InitializeComponent();
viewModel = new WdFlyADAccessVm();
this.DataContext = viewModel;
}
/// <summary>
///
/// </summary>
/// <param name="flyADService"></param>
public void Init(FlyADServiceClient flyADService)
{
viewModel.Init(flyADService);
}
}
/// <summary>
/// WdFlyADAccess 的 ViewModel
/// </summary>
public class WdFlyADAccessVm : INotifyPropertyChanged
{ {
FlyADServiceClient mFlyADService = null; FlyADServiceClient mFlyADService = null;
public event PropertyChangedEventHandler PropertyChanged;
/// <summary> /// <summary>
/// 使用码 /// 使用码
/// </summary> /// </summary>
...@@ -41,30 +73,47 @@ namespace ThickTcpUiInWindow ...@@ -41,30 +73,47 @@ namespace ThickTcpUiInWindow
[PropertyChanged.DoNotCheckEquality] [PropertyChanged.DoNotCheckEquality]
public byte[] Code { get; set; } = new byte[7]; public byte[] Code { get; set; } = new byte[7];
public RelayCommand ApplyCmd { get; private set; }
public WdFlyADAccessVm()
{
ApplyCmd = new RelayCommand(Apply);
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public WdFlyADAccess() /// <param name="flyADService"></param>
public void Init(FlyADServiceClient flyADService)
{ {
InitializeComponent(); mFlyADService = flyADService;
}
mFlyADService.GetAccessInfo(
new AsyncCBHandler(
delegate (object AsyncState, object retData)
{
AccessInfo a = (AccessInfo)retData;
Access = a.access;
Code = a.code;
}), null);
}
private void button_apply_Click(object sender, RoutedEventArgs e) void Apply()
{ {
if ((Access == null) || (Access.Length != 8)) if ((Access == null) || (Access.Length != 8))
{ {
FLY.ControlLibrary.Window_Tip.Show("错误","长度不对,需要 8位 byte!!", FLY.ControlLibrary.Window_Tip.Show("错误", "长度不对,需要 8位 byte!!",
TimeSpan.FromSeconds(2)); TimeSpan.FromSeconds(2));
return; return;
} }
if (mFlyADService == null) if (mFlyADService == null)
return; return;
mFlyADService.SetAccess( mFlyADService.SetAccess(
Access, Access,
new AsyncCBHandler( new AsyncCBHandler(
delegate(object AsyncState, object retData) delegate (object AsyncState, object retData)
{ {
AccessInfo a = (AccessInfo)retData; AccessInfo a = (AccessInfo)retData;
Access = a.access; Access = a.access;
...@@ -75,55 +124,25 @@ namespace ThickTcpUiInWindow ...@@ -75,55 +124,25 @@ namespace ThickTcpUiInWindow
{ {
FLY.ControlLibrary.Window_Tip.Show("成功", "设置成功!!", FLY.ControlLibrary.Window_Tip.Show("成功", "设置成功!!",
TimeSpan.FromSeconds(2)); TimeSpan.FromSeconds(2));
} break; }
break;
case AREA_ERR.DUP_ACCESS: case AREA_ERR.DUP_ACCESS:
{ {
FLY.ControlLibrary.Window_Tip.Show("错误", "授权码重复!!", FLY.ControlLibrary.Window_Tip.Show("错误", "授权码重复!!",
TimeSpan.FromSeconds(2)); TimeSpan.FromSeconds(2));
} break; }
break;
case AREA_ERR.ERR_ACCESS: case AREA_ERR.ERR_ACCESS:
{ {
FLY.ControlLibrary.Window_Tip.Show("错误", "授权码不正确!!", FLY.ControlLibrary.Window_Tip.Show("错误", "授权码不正确!!",
TimeSpan.FromSeconds(2)); TimeSpan.FromSeconds(2));
} break; }
break;
} }
}), null); }), null);
FLY.ControlLibrary.Window_Tip.Show("通知", "请等待。。。。。。", FLY.ControlLibrary.Window_Tip.Show("通知", "请等待。。。。。。",
TimeSpan.FromSeconds(2)); TimeSpan.FromSeconds(2));
} }
/// <summary>
///
/// </summary>
/// <param name="flyADService"></param>
public void Init(FlyADServiceClient flyADService)
{
mFlyADService = flyADService;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.DataContext = this;
mFlyADService.GetAccessInfo(
new AsyncCBHandler(
delegate(object AsyncState, object retData)
{
AccessInfo a = (AccessInfo)retData;
Access = a.access;
Code = a.code;
}), null);
}
#region INotifyPropertyChanged 成员
/// <summary>
///
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
#endregion
} }
/// <summary> /// <summary>
/// ///
......
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