Files
AndroidDeviceStreaming/desktop/Ads.Desktop/MainWindow.axaml
T

55 lines
5.5 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Ads.Desktop.MainWindow" Title="ADS · Android 设备工作台" Width="1180" Height="820" MinWidth="900" MinHeight="640" Background="#10151F">
<Window.Styles>
<Style Selector="TextBox"><Setter Property="Margin" Value="0,4,0,10"/></Style>
<Style Selector="Button"><Setter Property="Padding" Value="16,10"/><Setter Property="Margin" Value="0,0,8,0"/></Style>
<Style Selector="TextBlock.label"><Setter Property="Foreground" Value="#9CAFC7"/></Style>
</Window.Styles>
<Grid RowDefinitions="Auto,*,Auto" Margin="28">
<Grid ColumnDefinitions="*,Auto" Margin="0,0,0,22">
<StackPanel><TextBlock Text="ANDROID DEVICE STREAMING" Foreground="#66D9C0" FontSize="12" LetterSpacing="3"/><TextBlock Text="设备工作台" FontSize="30" FontWeight="Bold" Margin="0,8,0,4"/><TextBlock Text="远程连接 · 本地调试 · 手机控制" Classes="label"/></StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center"><Button Content="刷新设备" Command="{Binding RefreshCommand}"/><Button Content="保存配置" Command="{Binding SaveCommand}"/></StackPanel>
</Grid>
<TabControl Grid.Row="1">
<TabItem Header="设备与连接">
<Grid ColumnDefinitions="2*,3*" Margin="0,16,0,0">
<Border Background="#192230" CornerRadius="12" Padding="18" Margin="0,0,16,0">
<Grid RowDefinitions="Auto,*,Auto"><TextBlock Text="在线设备" FontSize="18" FontWeight="SemiBold"/>
<ListBox Grid.Row="1" ItemsSource="{Binding Devices}" SelectedItem="{Binding SelectedDevice}" Margin="0,16,0,12" Background="Transparent">
<ListBox.ItemTemplate><DataTemplate><StackPanel Margin="6,10"><TextBlock Text="{Binding Id}" FontSize="17"/><TextBlock Text="{Binding Description}" Foreground="#9CAFC7" Margin="0,6,0,0"/></StackPanel></DataTemplate></ListBox.ItemTemplate>
</ListBox>
<TextBlock Grid.Row="2" Text="{Binding DeviceSummary}" Classes="label" TextWrapping="Wrap"/>
</Grid>
</Border>
<ScrollViewer Grid.Column="1"><StackPanel Spacing="12">
<TextBlock Text="连接管理" FontSize="22" FontWeight="SemiBold"/>
<TextBlock Text="{Binding Status}" Foreground="#66D9C0" FontSize="16" TextWrapping="Wrap"/>
<TextBlock Text="{Binding ActiveEndpoint}" Classes="label"/>
<StackPanel Orientation="Horizontal"><Button Content="连接所选设备" Command="{Binding ConnectCommand}"/><Button Content="断开连接" Command="{Binding DisconnectCommand}"/></StackPanel>
<Border Background="#192230" CornerRadius="12" Padding="20" Margin="0,12,0,0"><StackPanel Spacing="12">
<TextBlock Text="scrcpy 手机控制" FontSize="19" FontWeight="SemiBold"/>
<TextBlock Text="连接成功并完成手机 USB 调试授权后,在独立窗口中显示与操作手机。" TextWrapping="Wrap" Classes="label"/>
<Grid ColumnDefinitions="*,*"><StackPanel><TextBlock Text="最大分辨率"/><TextBox Text="{Binding MaxSize}"/></StackPanel><StackPanel Grid.Column="1" Margin="12,0,0,0"><TextBlock Text="最大帧率"/><TextBox Text="{Binding MaxFps}"/></StackPanel></Grid>
<CheckBox Content="传输手机音频" IsChecked="{Binding Audio}"/>
<CheckBox Content="只看画面(禁止控制输入)" IsChecked="{Binding ViewOnly}"/>
<StackPanel Orientation="Horizontal"><Button Content="打开手机控制" Command="{Binding StartScrcpyCommand}"/><Button Content="停止投屏" Command="{Binding StopScrcpyCommand}"/></StackPanel>
</StackPanel></Border>
<TextBlock Text="提示:unauthorized 表示需要在手机上允许调试;设备被占用时需要先释放其他客户端的连接。" TextWrapping="Wrap" Classes="label"/>
</StackPanel></ScrollViewer>
</Grid>
</TabItem>
<TabItem Header="连接配置"><ScrollViewer><StackPanel Margin="4,18" MaxWidth="780" HorizontalAlignment="Stretch">
<TextBlock Text="中继服务器(WSS)"/><TextBox Text="{Binding Server}" Watermark="wss://ads.ttstd.com"/>
<TextBlock Text="客户端令牌(仅当前进程使用,不写入配置)"/><TextBox Text="{Binding Token}" PasswordChar="●"/>
<TextBlock Text="ads-client 可执行文件"/><TextBox Text="{Binding ClientPath}"/>
<TextBlock Text="ADB 可执行文件"/><TextBox Text="{Binding AdbPath}"/>
<TextBlock Text="scrcpy 可执行文件(选择官方发行包中的程序)"/><TextBox Text="{Binding ScrcpyPath}"/>
<TextBlock Text="本地 ADB 隧道端口"/><TextBox Text="{Binding Port}"/>
<CheckBox Content="关闭窗口时保留连接并最小化到托盘" IsChecked="{Binding MinimizeToTray}" Margin="0,12"/>
<TextBlock Text="配置修改在下一次连接时生效。令牌也可通过 ADS_CLIENT_TOKEN 环境变量提供。" TextWrapping="Wrap" Classes="label"/>
</StackPanel></ScrollViewer></TabItem>
<TabItem Header="运行日志"><Grid RowDefinitions="Auto,*" Margin="0,16,0,0"><StackPanel Orientation="Horizontal"><Button Content="清空日志" Command="{Binding ClearLogsCommand}"/><Button Content="导出日志" Command="{Binding ExportLogsCommand}"/></StackPanel><ListBox Grid.Row="1" ItemsSource="{Binding Logs}" Margin="0,12,0,0" FontFamily="Cascadia Mono,Consolas" FontSize="12"><ListBox.ItemTemplate><DataTemplate><TextBlock Text="{Binding}" TextWrapping="Wrap"/></DataTemplate></ListBox.ItemTemplate></ListBox></Grid></TabItem>
</TabControl>
<TextBlock Grid.Row="2" Text="{Binding Notice}" Foreground="#A8B7CC" Margin="0,18,0,0" TextWrapping="Wrap"/>
</Grid>
</Window>