<UserControl x:Class="BPASmartClient.Control.DataVView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:BPASmartClient.Control"
             mc:Ignorable="d" 
             d:DesignHeight="550" d:DesignWidth="800">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
                <ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.8*"></ColumnDefinition>
            <ColumnDefinition Width="2*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
       
        
        <StackPanel Grid.Column="0" Margin="10">
            <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
                <TextBlock  Width="80" FontSize="12">API查询地址:</TextBlock>
                <TextBox x:Name="apiurl" Margin="10,0,0,0" Width="200" Text="{Binding ApiURL}"/>
                <Button Tag="SetUrl" 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" FontSize="12">客户端ID:</TextBlock>
                <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" FontSize="12">devicename:</TextBlock>
                <TextBox x:Name="devicename" Margin="10,0,0,0" Width="200" Text="{Binding device.devicename, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox>
            </StackPanel>

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

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

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

            <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
                <TextBlock Width="80" FontSize="12">经度:</TextBlock>
                <TextBox x:Name="jd" Margin="10,0,0,0" Width="200" Text="{Binding device.jd, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox>
            </StackPanel>

            <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
                <TextBlock Width="80" FontSize="12">纬度:</TextBlock>
                <TextBox x:Name="wd" Margin="10,0,0,0" Width="200" Text="{Binding device.wd, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox>
            </StackPanel>

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

            <StackPanel Orientation="Horizontal" Margin="0,10,0,0" >
                <Button Margin="80,0,0,0" Tag="Add" Click="Button_Click" Width="45">增加</Button>
                <Button Margin="20,0,0,0" Tag="Update" Click="Button_Click"  Width="45">修改</Button>
                <Button Margin="20,0,0,0" Tag="Delete" Click="Button_Click"  Width="45">删除</Button>

            </StackPanel>

            <StackPanel Orientation="Horizontal" Margin="0,20,0,0" >
                <Button Margin="80,0,0,0" Tag="Save" Click="Button_Click" >保存text</Button>
                <Button Margin="20,0,0,0" Tag="Insert" Click="Button_Click" >导入text</Button>
            </StackPanel>

        </StackPanel>

        <Grid Grid.Column="1" Margin="10">
            <DataGrid HorizontalScrollBarVisibility="Visible"  Margin="10"  SelectedItem="{Binding deviceTableSelectedItem, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding deviceTable, UpdateSourceTrigger=PropertyChanged}" Grid.Row="1" MouseDoubleClick="DataGrid_MouseDoubleClick">
                <DataGrid.Columns>
                    <DataGridTemplateColumn Header="客户端ID" Width="2*">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock HorizontalAlignment="Center" Text="{Binding ClientId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" />
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="云名称" Width="5*">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock HorizontalAlignment="Center" Text="{Binding devicename, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" />
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="云key" Width="6*">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock HorizontalAlignment="Center" Text="{Binding productkey, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" />
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="云secret" Width="12*">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock HorizontalAlignment="Center" Text="{Binding devicesecret, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" />
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="类型" Width="4*">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock HorizontalAlignment="Center" Text="{Binding devtype, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" />
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="经度" Width="4.4*">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock HorizontalAlignment="Center" Text="{Binding jd, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" />
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="纬度" Width="4.4*">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock HorizontalAlignment="Center" Text="{Binding wd, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" />
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="备注" Width="5.4*">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock HorizontalAlignment="Center" Text="{Binding remark, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" />
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                </DataGrid.Columns>
            </DataGrid>

        </Grid>

        <Grid x:Name="Pass" Grid.ColumnSpan="2" Background="#99020202">
            <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
                <TextBlock  Width="80" FontSize="16" Margin="0,0,0,5">密码解锁:</TextBlock>
                <PasswordBox x:Name="passbox" Width="180" Height="22" ></PasswordBox>
                <Button HorizontalAlignment="Right" Margin="0,5,0,0" Tag="OkPass" Click="Button_Click"  IsDefault="True">确定</Button>
            </StackPanel>
        </Grid>
    </Grid>
</UserControl>
