XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

LumaTunnel

【WinUI】LumaTunnel 是一个面向个人多设备的 Windows 代理系统。客户端在本机提供 HTTP/HTTPS CONNECT 与 SOCKS5 TCP 代理,并通过一个受信任 TLS 证书保护的 WSS 会话,将多个 TCP 流复用到自建 Windows Server 节点。

公开
关注 0 Fork 0 Star 0
UTF-8
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using Windows.Graphics;

namespace LumaTunnel.Client;

public sealed partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
        ExtendsContentIntoTitleBar = true;
        AppWindow.SetIcon(Path.Combine(AppContext.BaseDirectory, "Assets", "LumaTunnel.ico"));
        AppWindow.Resize(new SizeInt32(1120, 760));
        AppWindow.Closing += OnClosing;
        AppServices.RootNavigation.Initialize(RootFrame);
    }

    public void ShowFromTray()
    {
        AppWindow.Show();
        Activate();
    }

    private void OnClosing(AppWindow sender, AppWindowClosingEventArgs args)
    {
        if (!App.CurrentApp.IsExiting && AppServices.Profile.CloseToTray)
        {
            args.Cancel = true;
            sender.Hide();
            return;
        }
        if (!App.CurrentApp.IsExiting)
        {
            args.Cancel = true;
            _ = App.CurrentApp.RequestExitAsync();
        }
    }
}