fyf пре 2 година
родитељ
комит
dbcddb07ec
2 измењених фајлова са 27 додато и 2 уклоњено
  1. +13
    -2
      BPASmartClient.IoT/DataVClient.cs
  2. +14
    -0
      BPASmartClient/Control/DataVView.xaml

+ 13
- 2
BPASmartClient.IoT/DataVClient.cs Прегледај датотеку

@@ -42,7 +42,7 @@ namespace BPASmartClient.IoT
DeviceSecret = System.Configuration.ConfigurationManager.AppSettings["DeviceSecret"].ToString();
StartupMode = System.Configuration.ConfigurationManager.AppSettings["StartupMode"].ToString();
BroadcastPubTopic = InternetInfo.BroadcastPubTopic;

//MaintainTable maintainTable = new MaintainTable();
//maintainTable.Id = Guid.NewGuid().ToString();
@@ -71,6 +71,7 @@ namespace BPASmartClient.IoT
/// 客户端ID
/// </summary>
public string ClientId { set; get; }
public List<int> ListDeviceId { set; get; } = new List<int>();
/// <summary>
/// MQTT上报集合
/// </summary>
@@ -200,7 +201,17 @@ namespace BPASmartClient.IoT
string message = string.Empty;
if (StartupMode == "API")
{
if (DeviceDataV.Initialize(DataVApiAddress, ClientId, "", ref message))
while (ListDeviceId.Count == 0)
{
Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.ForEach(device =>
{
if (device != null)
{
ListDeviceId.Add(device.DeviceId);
}
});
}
if (DeviceDataV.Initialize(DataVApiAddress, ClientId, ListDeviceId.Count==0?"": ListDeviceId?.First().ToString(), ref message))
{
ProductKey = DeviceDataV.deviceTable.productkey;
DeviceName = DeviceDataV.deviceTable.devicename;


+ 14
- 0
BPASmartClient/Control/DataVView.xaml Прегледај датотеку

@@ -33,12 +33,19 @@
<TextBox x:Name="chen" Margin="10,0,0,0" Width="200" >1</TextBox>
<Button Tag="Inquire" Margin="10,0,0,0" Click="Button_Click" Style="{DynamicResource CommonBtn_返回}" Width="45">查询</Button>
</StackPanel>

<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<TextBlock Width="80" HorizontalAlignment="Right" FontSize="12">客户端ID:</TextBlock>
<TextBox x:Name="clientId" Margin="10,0,0,0" Width="200" Text="{Binding device.ClientId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox>
</StackPanel>

<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<TextBlock Width="80" HorizontalAlignment="Right" FontSize="12">设备ID:</TextBlock>
<TextBox x:Name="sbId" Margin="10,0,0,0" Width="200" Text="{Binding device.DeviceId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox>
</StackPanel>

<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<TextBlock Width="80" FontSize="12">devicename:</TextBlock>
<TextBox x:Name="devicename" Margin="10,0,0,0" Width="200" Text="{Binding device.devicename, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox>
@@ -100,6 +107,13 @@
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="设备ID" Width="2*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock HorizontalAlignment="Center" Text="{Binding DeviceId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="云名称" Width="5*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>


Loading…
Откажи
Сачувај