38 lines
1015 B
C#
38 lines
1015 B
C#
using System;
|
|||
|
|
using System.Diagnostics;
|
||
|
|
|
||
|
|
namespace StandardScene.Utils
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// 车辆远程访问辅助工具。
|
||
|
|
/// </summary>
|
||
|
|
public static class CarRemoteHelper
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// 使用系统默认浏览器打开车辆 Web 管理页面。
|
||
|
|
/// </summary>
|
||
|
|
/// <param name="ip">车辆 IP 地址</param>
|
||
|
|
/// <param name="port">Web 服务端口,默认 8081</param>
|
||
|
|
public static void OpenVehicleWebPage(string ip, int port = 8081)
|
||
|
|
{
|
||
|
|
if (string.IsNullOrWhiteSpace(ip))
|
||
|
|
{
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
try
|
||
|
|
{
|
||
|
|
Process.Start(new ProcessStartInfo
|
||
|
|
{
|
||
|
|
FileName = $"http://{ip}:{port}",
|
||
|
|
UseShellExecute = true
|
||
|
|
});
|
||
|
|
}
|
||
|
|
catch (Exception ex)
|
||
|
|
{
|
||
|
|
Console.WriteLine($"打开车辆 Web 页面失败: {ex.Message}");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|