mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 02:10:21 +08:00
feat: 为连接历史记录添加删除按钮 (#3899)
This commit is contained in:
@@ -24,6 +24,7 @@ using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interop;
|
||||
using MaaWpfGui.Helper;
|
||||
using MaaWpfGui.MaaHotKeys;
|
||||
@@ -1842,6 +1843,12 @@ namespace MaaWpfGui
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveAddress_Click(string address)
|
||||
{
|
||||
ConnectAddressHistory.Remove(address);
|
||||
ViewStatusStorage.Set("Connect.AddressHistory", JsonConvert.SerializeObject(ConnectAddressHistory));
|
||||
}
|
||||
|
||||
private string _adbPath = ViewStatusStorage.Get("Connect.AdbPath", string.Empty);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -92,7 +92,30 @@
|
||||
IsEnabled="{c:Binding !AutoDetectConnection}"
|
||||
ItemsSource="{Binding ConnectAddressHistory}"
|
||||
Text="{Binding ConnectAddress, UpdateSourceTrigger=LostFocus}"
|
||||
ToolTip="{DynamicResource ConnectionAddressTip}" />
|
||||
ToolTip="{DynamicResource ConnectionAddressTip}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Width="{c:Binding ActualWidth - 20, RelativeSource={RelativeSource AncestorType=ComboBox}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Grid.Column="0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding}" />
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
Command="{s:Action RemoveAddress_Click}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="×"
|
||||
FontWeight="Bold" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<maa:TextBlock
|
||||
Grid.Row="3"
|
||||
|
||||
Reference in New Issue
Block a user