| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663 |
- using System.Globalization;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media;
- using System.Windows.Media.Animation;
- using NetworkTool.Client.Models;
- using NetworkTool.Client.Services;
- namespace NetworkTool.Client;
- public partial class DeviceDetailsWindow : Window
- {
- private const int ApplyConfirmationTimeoutSeconds = 20;
- private readonly ServerApiService _serverApiService = new();
- private readonly string _baseAddress;
- private readonly string _localIPv4;
- private readonly string _password;
- private bool _configValidated;
- private bool _isBusy;
- private bool _suppressConfigChangeHandling;
- private CancellationTokenSource? _statusMessageCts;
- public DeviceDetailsWindow(string baseAddress, string localIPv4, string password)
- {
- InitializeComponent();
- _baseAddress = baseAddress;
- _localIPv4 = localIPv4;
- _password = password;
- Loaded += DeviceDetailsWindow_OnLoaded;
- }
- private async void DeviceDetailsWindow_OnLoaded(object sender, RoutedEventArgs e)
- {
- try
- {
- await LoadRemoteDetailsAsync();
- UpdateButtonStates();
- }
- catch (Exception ex)
- {
- ShowStatusMessage($"读取设备信息失败:{ex.Message}");
- SetBusyState(false);
- }
- }
- private async Task LoadRemoteDetailsAsync()
- {
- ClearDetails();
- var device = await _serverApiService.GetDeviceInfoAsync(_baseAddress, _password, _localIPv4);
- if (device is not null)
- {
- RemoteDeviceIdTextBlock.Text = device.DeviceId;
- RemoteHostnameTextBlock.Text = device.Hostname;
- RemoteOsVersionTextBlock.Text = device.OSVersion;
- RemoteServerVersionTextBlock.Text = device.ServerVersion;
- }
- var interfaces = await _serverApiService.GetInterfacesAsync(_baseAddress, _password, _localIPv4);
- if (interfaces is null)
- {
- ShowStatusMessage("设备已连接,但暂时无法读取 Linux 接口列表。");
- return;
- }
- ShowStatusMessage($"当前管理接口:{interfaces.ManagementInterface};建议目标接口:{interfaces.SuggestedTargetInterface};{(interfaces.RequiresTargetSelection ? "需要手动选择目标接口。" : "已自动识别建议目标接口。")}");
- var suggested = interfaces.Interfaces.FirstOrDefault(item => item.SystemName == interfaces.SuggestedTargetInterface)
- ?? interfaces.Interfaces.FirstOrDefault(item => item.IsSuggestedTarget)
- ?? interfaces.Interfaces.FirstOrDefault(item => !item.IsManagementInterface);
- RemoteTargetInterfaceComboBox.ItemsSource = interfaces.Interfaces;
- if (suggested is not null)
- {
- RemoteTargetInterfaceComboBox.SelectedItem = suggested;
- await LoadRemoteInterfaceConfigAsync(suggested.SystemName);
- }
- }
- private void ClearDetails()
- {
- RemoteDeviceIdTextBlock.Text = "-";
- RemoteHostnameTextBlock.Text = "-";
- RemoteOsVersionTextBlock.Text = "-";
- RemoteServerVersionTextBlock.Text = "-";
- RemoteTargetInterfaceComboBox.ItemsSource = null;
- RemoteConfigInterfaceTextBlock.Text = "-";
- RemoteConfigIpTextBlock.Text = "-";
- RemoteConfigGatewayTextBlock.Text = "-";
- RemoteConfigDnsTextBlock.Text = "-";
- NewIpTextBox.Text = string.Empty;
- NewMaskTextBox.Text = string.Empty;
- NewGatewayTextBox.Text = string.Empty;
- NewDnsTextBox.Text = string.Empty;
- _configValidated = false;
- }
- private async void RemoteTargetInterfaceComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- try
- {
- if (RemoteTargetInterfaceComboBox.SelectedItem is not RemoteInterfaceInfo selected)
- {
- UpdateButtonStates();
- return;
- }
- await LoadRemoteInterfaceConfigAsync(selected.SystemName, useBusyState: true);
- }
- catch (Exception ex)
- {
- ShowStatusMessage($"读取目标接口配置失败:{ex.Message}");
- SetBusyState(false);
- }
- }
- private async Task LoadRemoteInterfaceConfigAsync(string interfaceName, bool useBusyState = false)
- {
- if (useBusyState)
- {
- SetBusyState(true, "正在读取 Linux 端 IP 配置...");
- }
- try
- {
- var result = await _serverApiService.GetInterfaceConfigAsync(_baseAddress, _password, _localIPv4, interfaceName);
- if (!result.Success || result.Data is null)
- {
- RemoteConfigInterfaceTextBlock.Text = interfaceName;
- RemoteConfigIpTextBlock.Text = "读取失败";
- RemoteConfigGatewayTextBlock.Text = "读取失败";
- RemoteConfigDnsTextBlock.Text = "读取失败";
- ShowStatusMessage($"读取目标接口 {interfaceName} 配置失败:{result.Message}");
- return;
- }
- var config = result.Data;
- RemoteConfigInterfaceTextBlock.Text = config.Interface;
- RemoteConfigIpTextBlock.Text = FormatCurrentIp(config);
- RemoteConfigGatewayTextBlock.Text = string.IsNullOrWhiteSpace(config.Gateway) ? "无" : config.Gateway;
- RemoteConfigDnsTextBlock.Text = config.DnsSummary;
- _suppressConfigChangeHandling = true;
- Dhcp4CheckBox.IsChecked = false;
- NewIpTextBox.Text = config.IP;
- NewMaskTextBox.Text = PrefixToMask(config.Prefix);
- NewGatewayTextBox.Text = config.Gateway;
- NewDnsTextBox.Text = config.Dns?.FirstOrDefault() ?? string.Empty;
- _suppressConfigChangeHandling = false;
- _configValidated = false;
- ShowStatusMessage("已读取Linux端IP配置。");
- UpdateButtonStates();
- }
- finally
- {
- if (useBusyState)
- {
- SetBusyState(false);
- }
- }
- }
- private async void ReloadInterfaceConfigButton_OnClick(object sender, RoutedEventArgs e)
- {
- if (RemoteTargetInterfaceComboBox.SelectedItem is RemoteInterfaceInfo selected)
- {
- await LoadRemoteInterfaceConfigAsync(selected.SystemName);
- }
- }
- private async void ValidateConfigButton_OnClick(object sender, RoutedEventArgs e)
- {
- if (RemoteTargetInterfaceComboBox.SelectedItem is not RemoteInterfaceInfo selected)
- {
- return;
- }
- var request = BuildConfigRequest(selected.SystemName);
- if (request is null)
- {
- return;
- }
- SetBusyState(true, "正在校验配置,请稍候...");
- try
- {
- var result = await _serverApiService.ValidateInterfaceConfigAsync(_baseAddress, _password, _localIPv4, request);
- _configValidated = result.Success && result.Data?.Valid == true;
- if (result.Data is not null)
- {
- var warnings = result.Data.Warnings.Count > 0 ? $" 警告:{string.Join(";", result.Data.Warnings)}" : string.Empty;
- var errors = result.Data.Errors.Count > 0 ? $" 错误:{string.Join(";", result.Data.Errors)}" : string.Empty;
- ShowStatusMessage(_configValidated ? $"校验通过,可应用配置。{warnings}" : $"校验失败。{errors}{warnings}");
- }
- else
- {
- ShowStatusMessage($"校验失败:{result.Message}");
- }
- UpdateButtonStates();
- }
- finally
- {
- SetBusyState(false);
- }
- }
- private async void ApplyConfigButton_OnClick(object sender, RoutedEventArgs e)
- {
- if (RemoteTargetInterfaceComboBox.SelectedItem is not RemoteInterfaceInfo selected)
- {
- return;
- }
- var request = BuildConfigRequest(selected.SystemName);
- if (request is null)
- {
- return;
- }
- var confirmMessage = $"将要把以下配置应用到接口 {selected.SystemName}:\n\n" +
- $"模式:{(request.Dhcp4 ? "DHCP 自动获取" : "静态 IPv4")}\n" +
- $"IP:{(request.Dhcp4 ? "自动获取" : $"{request.IP}/{request.Prefix}")}\n" +
- $"网关:{(string.IsNullOrWhiteSpace(request.Gateway) ? "无" : request.Gateway)}\n" +
- $"DNS:{(request.Dns.Count == 0 ? "无" : string.Join(", ", request.Dns))}\n\n" +
- "请确认是否继续。";
- if (MessageBox.Show(this, confirmMessage, "确认应用配置", MessageBoxButton.OKCancel, MessageBoxImage.Question) != MessageBoxResult.OK)
- {
- return;
- }
- SetBusyState(true, "正在提交并应用配置,请稍候...");
- try
- {
- var applyResult = await _serverApiService.ApplyInterfaceConfigAsync(_baseAddress, _password, _localIPv4, request);
- if (!applyResult.Success || applyResult.Data is null)
- {
- ShowStatusMessage($"提交配置任务失败:{applyResult.Message}");
- return;
- }
- ShowStatusMessage("配置任务已提交,正在应用并等待连通确认...");
- await PollTaskAsync(applyResult.Data.TaskId);
- }
- finally
- {
- SetBusyState(false);
- }
- }
- private async Task PollTaskAsync(string taskId)
- {
- var transientFailureCount = 0;
- var confirmationRequested = false;
- for (var i = 0; i < 20; i++)
- {
- await Task.Delay(1000);
- var result = await _serverApiService.GetTaskAsync(_baseAddress, _password, _localIPv4, taskId);
- if (!result.Success || result.Data is null)
- {
- if (result.StatusCode is null)
- {
- transientFailureCount++;
- ShowStatusMessage($"设备连接短暂中断,正在重试({transientFailureCount})。");
- continue;
- }
- ShowStatusMessage($"读取任务状态失败:{result.Message}");
- return;
- }
- transientFailureCount = 0;
- var task = result.Data;
- ShowStatusMessage(FormatTaskStatusMessage(task));
- if (task.Status == "running" && task.Step == "confirming" && !confirmationRequested)
- {
- confirmationRequested = true;
- var confirm = ShowApplyConfirmationDialog(ApplyConfirmationTimeoutSeconds);
- if (confirm)
- {
- var confirmResult = await _serverApiService.ConfirmApplyTaskAsync(_baseAddress, _password, _localIPv4, taskId);
- ShowStatusMessage(confirmResult.Success ? "已发送保留配置确认。" : $"发送确认失败:{confirmResult.Message}");
- }
- else
- {
- var cancelResult = await _serverApiService.CancelApplyTaskAsync(_baseAddress, _password, _localIPv4, taskId);
- ShowStatusMessage(cancelResult.Success ? "已取消保留配置,正在回滚。" : $"发送取消失败:{cancelResult.Message}");
- }
- }
- if (task.Status is "success" or "failed" or "rolled_back")
- {
- ShowTaskCompletionDialog(task);
- if (RemoteTargetInterfaceComboBox.SelectedItem is RemoteInterfaceInfo selected)
- {
- await LoadRemoteInterfaceConfigAsync(selected.SystemName);
- }
- return;
- }
- }
- ShowStatusMessage($"任务 {taskId} 轮询超时,请稍后手动刷新。");
- }
- private bool ShowApplyConfirmationDialog(int timeoutSeconds)
- {
- var remaining = timeoutSeconds;
- var result = false;
- var messageTextBlock = new TextBlock
- {
- Width = 420,
- TextWrapping = TextWrapping.Wrap,
- FontSize = 13,
- Foreground = Brushes.Black,
- };
- var confirmButton = new Button
- {
- MinWidth = 88,
- MinHeight = 32,
- Margin = new Thickness(0, 0, 10, 0),
- Content = "确认保留",
- IsDefault = true,
- };
- var cancelButton = new Button
- {
- MinWidth = 88,
- MinHeight = 32,
- Content = "取消回滚",
- IsCancel = true,
- };
- var dialog = new Window
- {
- Title = "确认保留网络配置",
- Owner = this,
- WindowStartupLocation = WindowStartupLocation.CenterOwner,
- ResizeMode = ResizeMode.NoResize,
- SizeToContent = SizeToContent.WidthAndHeight,
- Content = new StackPanel
- {
- Margin = new Thickness(18),
- Children =
- {
- messageTextBlock,
- new StackPanel
- {
- Margin = new Thickness(0, 18, 0, 0),
- HorizontalAlignment = HorizontalAlignment.Right,
- Orientation = Orientation.Horizontal,
- Children = { confirmButton, cancelButton },
- },
- },
- },
- };
- void UpdateMessage()
- {
- messageTextBlock.Text = $"当前客户端仍可连接到设备。是否确认保留这次网络配置?\n\n剩余 {remaining} 秒;超时或取消时,Linux 端会自动回滚。";
- }
- var timer = new System.Windows.Threading.DispatcherTimer { Interval = TimeSpan.FromSeconds(1) };
- timer.Tick += (_, _) =>
- {
- remaining--;
- if (remaining <= 0)
- {
- timer.Stop();
- dialog.DialogResult = false;
- dialog.Close();
- return;
- }
- UpdateMessage();
- };
- confirmButton.Click += (_, _) =>
- {
- result = true;
- dialog.DialogResult = true;
- dialog.Close();
- };
- cancelButton.Click += (_, _) =>
- {
- dialog.DialogResult = false;
- dialog.Close();
- };
- dialog.Closed += (_, _) => timer.Stop();
- UpdateMessage();
- timer.Start();
- dialog.ShowDialog();
- return result;
- }
- private async void RebootButton_OnClick(object sender, RoutedEventArgs e)
- {
- await ExecuteSystemActionAsync(
- "重启设备",
- "设备将立即重启,当前窗口和连接可能马上中断。是否继续?",
- () => _serverApiService.RebootAsync(_baseAddress, _password, _localIPv4));
- }
- private async void ShutdownButton_OnClick(object sender, RoutedEventArgs e)
- {
- await ExecuteSystemActionAsync(
- "关闭设备",
- "设备将立即关机,当前窗口和连接可能马上中断。是否继续?",
- () => _serverApiService.ShutdownAsync(_baseAddress, _password, _localIPv4));
- }
- private async Task ExecuteSystemActionAsync(string title, string confirmMessage, Func<Task<ApiCallResult<RemoteSystemActionResponse>>> action)
- {
- if (MessageBox.Show(this, confirmMessage, title, MessageBoxButton.OKCancel, MessageBoxImage.Warning) != MessageBoxResult.OK)
- {
- return;
- }
- var result = await action();
- if (!result.Success || result.Data is null)
- {
- ShowStatusMessage($"{title}失败:{result.Message}");
- return;
- }
- ShowStatusMessage($"{title}任务已提交:{result.Data.TaskId}。命令已发出,设备可能立即断开。");
- }
- private RemoteInterfaceConfig? BuildConfigRequest(string interfaceName)
- {
- var dhcp4 = Dhcp4CheckBox.IsChecked == true;
- var prefix = 0;
- if (!dhcp4 && string.IsNullOrWhiteSpace(NewIpTextBox.Text))
- {
- ShowStatusMessage("IP 地址不能为空。");
- return null;
- }
- if (!dhcp4 && !TryMaskToPrefix(NewMaskTextBox.Text, out prefix))
- {
- ShowStatusMessage("子网掩码格式不正确。");
- return null;
- }
- var dns = string.IsNullOrWhiteSpace(NewDnsTextBox.Text) ? Array.Empty<string>() : new[] { NewDnsTextBox.Text.Trim() };
- return new RemoteInterfaceConfig
- {
- Interface = interfaceName,
- Dhcp4 = dhcp4,
- IP = dhcp4 ? string.Empty : NewIpTextBox.Text.Trim(),
- Prefix = prefix,
- Gateway = dhcp4 ? string.Empty : NewGatewayTextBox.Text.Trim(),
- Dns = dhcp4 ? Array.Empty<string>() : dns,
- };
- }
- private static string FormatCurrentIp(RemoteInterfaceConfig config)
- {
- if (string.IsNullOrWhiteSpace(config.IP))
- {
- return config.Dhcp4 ? "DHCP 自动获取,暂无 IPv4" : "无";
- }
- var text = $"{config.IP}/{config.Prefix}";
- return config.Dhcp4 ? $"{text} (DHCP)" : text;
- }
- private static string PrefixToMask(int prefix)
- {
- if (prefix < 0 || prefix > 32)
- {
- return string.Empty;
- }
- var mask = prefix == 0 ? 0u : uint.MaxValue << (32 - prefix);
- return string.Join('.', new[] { (mask >> 24) & 255, (mask >> 16) & 255, (mask >> 8) & 255, mask & 255 });
- }
- private static bool TryMaskToPrefix(string maskText, out int prefix)
- {
- prefix = 0;
- if (string.IsNullOrWhiteSpace(maskText))
- {
- return false;
- }
- var parts = maskText.Trim().Split('.');
- if (parts.Length != 4)
- {
- return false;
- }
- uint mask = 0;
- foreach (var part in parts)
- {
- if (!byte.TryParse(part, out var octet))
- {
- return false;
- }
- mask = (mask << 8) | octet;
- }
- var seenZero = false;
- for (var i = 31; i >= 0; i--)
- {
- var bit = (mask & (1u << i)) != 0;
- if (bit && seenZero)
- {
- return false;
- }
- if (bit)
- {
- prefix++;
- }
- else
- {
- seenZero = true;
- }
- }
- return true;
- }
- private void ConfigInputChanged_OnChanged(object sender, TextChangedEventArgs e)
- {
- if (_suppressConfigChangeHandling)
- {
- return;
- }
- _configValidated = false;
- ShowStatusMessage("配置内容已变更,请重新点击“2. 校验配置”。");
- UpdateButtonStates();
- }
- private void ConfigModeChanged_OnChanged(object sender, RoutedEventArgs e)
- {
- if (_suppressConfigChangeHandling)
- {
- UpdateButtonStates();
- return;
- }
- _configValidated = false;
- ShowStatusMessage("配置模式已变更,请重新点击“2. 校验配置”。");
- UpdateButtonStates();
- }
- private void ShowStatusMessage(string message)
- {
- ApplyStatusMessageStyle(message);
- StatusMessageTextBlock.Text = message;
- StatusMessageBorder.Opacity = 0;
- StatusMessageBorder.Visibility = Visibility.Visible;
- StatusMessageBorder.BeginAnimation(OpacityProperty, new DoubleAnimation(1, TimeSpan.FromMilliseconds(160)));
- _statusMessageCts?.Cancel();
- _statusMessageCts = new CancellationTokenSource();
- _ = HideStatusMessageAsync(_statusMessageCts.Token);
- }
- private async Task HideStatusMessageAsync(CancellationToken cancellationToken)
- {
- try
- {
- await Task.Delay(3000, cancellationToken);
- await Dispatcher.InvokeAsync(() =>
- {
- var animation = new DoubleAnimation(0, TimeSpan.FromMilliseconds(200));
- animation.Completed += (_, _) =>
- {
- if (!cancellationToken.IsCancellationRequested)
- {
- StatusMessageBorder.Visibility = Visibility.Collapsed;
- }
- };
- StatusMessageBorder.BeginAnimation(OpacityProperty, animation);
- });
- }
- catch (TaskCanceledException)
- {
- }
- }
- private void ApplyStatusMessageStyle(string message)
- {
- var (background, foreground) = GetStatusMessageBrushes(message);
- StatusMessageBorder.Background = background;
- StatusMessageTextBlock.Foreground = foreground;
- }
- private static (Brush Background, Brush Foreground) GetStatusMessageBrushes(string message)
- {
- if (ContainsAny(message, "失败", "错误", "拒绝", "超时", "不能为空", "不正确", "无法"))
- {
- return (new SolidColorBrush((Color)ColorConverter.ConvertFromString("#B91C1C")), Brushes.White);
- }
- if (ContainsAny(message, "未发现", "请", "重试", "警告", "需要"))
- {
- return (new SolidColorBrush((Color)ColorConverter.ConvertFromString("#C2410C")), Brushes.White);
- }
- if (ContainsAny(message, "成功", "已切换", "已刷新", "已读取", "已加载", "已发现", "已提交", "已回填"))
- {
- return (new SolidColorBrush((Color)ColorConverter.ConvertFromString("#047857")), Brushes.White);
- }
- return (new SolidColorBrush((Color)ColorConverter.ConvertFromString("#111827")), Brushes.White);
- }
- private static bool ContainsAny(string message, params string[] markers)
- {
- return markers.Any(marker => message.Contains(marker, StringComparison.Ordinal));
- }
- private static string FormatTaskStatusMessage(RemoteTaskResult task)
- {
- return task.Status switch
- {
- "success" => string.IsNullOrWhiteSpace(task.Detail) ? "配置已成功应用。" : task.Detail,
- "failed" => string.IsNullOrWhiteSpace(task.Detail) ? "配置应用失败。" : task.Detail,
- "rolled_back" => string.IsNullOrWhiteSpace(task.Detail) ? "配置应用失败,已自动回滚。" : task.Detail,
- _ => task.Step switch
- {
- "validating" => "正在校验配置...",
- "writing_netplan" => "正在写入 Linux 网络配置...",
- "applying" => "正在应用 Linux 网络配置...",
- "confirming" => string.IsNullOrWhiteSpace(task.Detail) ? "等待确认保留配置..." : task.Detail,
- "rolling_back" => "配置应用失败,正在自动回滚...",
- _ => string.IsNullOrWhiteSpace(task.Detail) ? "正在处理,请稍候..." : task.Detail,
- }
- };
- }
- private void ShowTaskCompletionDialog(RemoteTaskResult task)
- {
- var message = FormatTaskStatusMessage(task);
- var title = task.Status == "success" ? "应用配置成功" : "应用配置失败";
- var image = task.Status == "success" ? MessageBoxImage.Information : MessageBoxImage.Warning;
- MessageBox.Show(this, message, title, MessageBoxButton.OK, image);
- }
- private void UpdateButtonStates()
- {
- var hasSelectedInterface = RemoteTargetInterfaceComboBox.SelectedItem is RemoteInterfaceInfo;
- var canEdit = !_isBusy && hasSelectedInterface;
- RemoteTargetInterfaceComboBox.IsEnabled = !_isBusy && RemoteTargetInterfaceComboBox.Items.Count > 0;
- ReloadInterfaceConfigButton.IsEnabled = canEdit;
- ValidateConfigButton.IsEnabled = canEdit;
- ApplyConfigButton.IsEnabled = !_isBusy && _configValidated && hasSelectedInterface;
- Dhcp4CheckBox.IsEnabled = canEdit;
- NewIpTextBox.IsEnabled = canEdit && Dhcp4CheckBox.IsChecked != true;
- NewMaskTextBox.IsEnabled = canEdit && Dhcp4CheckBox.IsChecked != true;
- NewGatewayTextBox.IsEnabled = canEdit && Dhcp4CheckBox.IsChecked != true;
- NewDnsTextBox.IsEnabled = canEdit && Dhcp4CheckBox.IsChecked != true;
- RebootButton.IsEnabled = !_isBusy;
- ShutdownButton.IsEnabled = !_isBusy;
- }
- private void SetBusyState(bool isBusy, string? message = null)
- {
- _isBusy = isBusy;
- BusyOverlay.Visibility = isBusy ? Visibility.Visible : Visibility.Collapsed;
- BusyMessageTextBlock.Text = string.IsNullOrWhiteSpace(message) ? "正在处理,请稍候..." : message;
- UpdateButtonStates();
- }
- }
|