Skip to content

Force Proxy to any Windows/MacOS/Linux Application TCP and UDP traffic

Added GUI - public commit for GUI

Sourav Kalal6cebdb013113
diff --git a/.gitignore b/.gitignore
index 0a89c1d..38e5b06 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,5 +5,5 @@
*.py
build/**
*.pyc
-gui/target/**
-gui/**
\ No newline at end of file
+gui/bin/**
+gui/obj/**
\ No newline at end of file
diff --git a/gui/App.axaml b/gui/App.axaml
new file mode 100644
index 0000000..adcd980
--- /dev/null
+++ b/gui/App.axaml
@@ -0,0 +1,8 @@
+<Application xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ x:Class="ProxyBridge.GUI.App"
+ RequestedThemeVariant="Dark">
+ <Application.Styles>
+ <FluentTheme />
+ </Application.Styles>
+</Application>
diff --git a/gui/App.axaml.cs b/gui/App.axaml.cs
new file mode 100644
index 0000000..e80f6d3
--- /dev/null
+++ b/gui/App.axaml.cs
@@ -0,0 +1,28 @@
+using Avalonia;
+using Avalonia.Controls.ApplicationLifetimes;
+using Avalonia.Markup.Xaml;
+using ProxyBridge.GUI.ViewModels;
+using ProxyBridge.GUI.Views;
+
+namespace ProxyBridge.GUI;
+
+public class App : Application
+{
+ public override void Initialize()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+
+ public override void OnFrameworkInitializationCompleted()
+ {
+ if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+ {
+ desktop.MainWindow = new MainWindow
+ {
+ DataContext = new MainWindowViewModel()
+ };
+ }
+
+ base.OnFrameworkInitializationCompleted();
+ }
+}
diff --git a/gui/Assets/logo.ico b/gui/Assets/logo.ico
new file mode 100644
index 0000000..dae7d14
Binary files /dev/null and b/gui/Assets/logo.ico differ
diff --git a/gui/Interop/ProxyBridgeNative.cs b/gui/Interop/ProxyBridgeNative.cs
new file mode 100644
index 0000000..4ecba8d
--- /dev/null
+++ b/gui/Interop/ProxyBridgeNative.cs
@@ -0,0 +1,86 @@
+using System;
+using System.Runtime.InteropServices;
+using System.IO;
+using System.Reflection;
+
+namespace ProxyBridge.GUI.Interop;
+
+public static class ProxyBridgeNative
+{
+ private const string DllName = "ProxyBridgeCore.dll";
+
+ static ProxyBridgeNative()
+ {
+ var assemblyPath = AppContext.BaseDirectory;
+ if (!string.IsNullOrEmpty(assemblyPath))
+ {
+ var dllPath = Path.Combine(assemblyPath, DllName);
+ if (File.Exists(dllPath))
+ {
+ NativeLibrary.Load(dllPath);
+ }
+ }
+ }
+
+ public enum ProxyType
+ {
+ HTTP = 0,
+ SOCKS5 = 1
+ }
+
+ public enum RuleAction
+ {
+ PROXY = 0,
+ DIRECT = 1,
+ BLOCK = 2
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate void LogCallback([MarshalAs(UnmanagedType.LPStr)] string message);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate void ConnectionCallback(
+ [MarshalAs(UnmanagedType.LPStr)] string processName,
+ uint pid,
+ [MarshalAs(UnmanagedType.LPStr)] string destIp,
+ ushort destPort,
+ [MarshalAs(UnmanagedType.LPStr)] string proxyInfo);
+
+ [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern uint ProxyBridge_AddRule(
+ [MarshalAs(UnmanagedType.LPStr)] string processName,
+ RuleAction action);
+
+ [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ public static extern bool ProxyBridge_ClearRules();
+
+ [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ public static extern bool ProxyBridge_EnableRule(uint ruleId);
+
+ [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ public static extern bool ProxyBridge_DisableRule(uint ruleId);
+
+ [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ public static extern bool ProxyBridge_SetProxyConfig(
+ ProxyType type,
+ [MarshalAs(UnmanagedType.LPStr)] string proxyIp,
+ ushort proxyPort);
+
+ [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ProxyBridge_SetLogCallback(LogCallback callback);
+
+ [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ProxyBridge_SetConnectionCallback(ConnectionCallback callback);
+
+ [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ public static extern bool ProxyBridge_Start();
+
+ [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ public static extern bool ProxyBridge_Stop();
+}
diff --git a/gui/Program.cs b/gui/Program.cs
new file mode 100644
index 0000000..c41d535
--- /dev/null
+++ b/gui/Program.cs
@@ -0,0 +1,20 @@
+using Avalonia;
+using System;
+
+namespace ProxyBridge.GUI;
+
+class Program
+{
+ [STAThread]
+ public static void Main(string[] args)
+ {
+ BuildAvaloniaApp()
+ .StartWithClassicDesktopLifetime(args);
+ }
+
+ public static AppBuilder BuildAvaloniaApp()
+ => AppBuilder.Configure<App>()
+ .UsePlatformDetect()
+ .WithInterFont()
+ .LogToTrace();
+}
diff --git a/gui/ProxyBridge.GUI.csproj b/gui/ProxyBridge.GUI.csproj
new file mode 100644
index 0000000..6eb033d
--- /dev/null
+++ b/gui/ProxyBridge.GUI.csproj
@@ -0,0 +1,31 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <OutputType>WinExe</OutputType>
+ <TargetFramework>net9.0-windows</TargetFramework>
+ <Nullable>enable</Nullable>
+ <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
+ <ApplicationManifest>app.manifest</ApplicationManifest>
+ <AssemblyName>ProxyBridge</AssemblyName>
+ <RootNamespace>ProxyBridge.GUI</RootNamespace>
+ <Version>1.1.0</Version>
+ <ApplicationIcon>Assets\logo.ico</ApplicationIcon>
+ <!-- Native AOT Configuration -->
+ <PublishAot>true</PublishAot>
+ <InvariantGlobalization>false</InvariantGlobalization>
+ <IlcOptimizationPreference>Speed</IlcOptimizationPreference>
+ <IlcGenerateDgmlFile>false</IlcGenerateDgmlFile>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <AvaloniaResource Include="Assets\logo.ico" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Avalonia" Version="11.2.0" />
+ <PackageReference Include="Avalonia.Desktop" Version="11.2.0" />
+ <PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.0" />
+ <PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.0" />
+ <PackageReference Include="Avalonia.ReactiveUI" Version="11.2.0" />
+ <PackageReference Include="Avalonia.Diagnostics" Version="11.2.0" Condition="'$(Configuration)' == 'Debug'" />
+ </ItemGroup>
+</Project>
diff --git a/gui/Services/ProxyBridgeService.cs b/gui/Services/ProxyBridgeService.cs
new file mode 100644
index 0000000..4fc3f95
--- /dev/null
+++ b/gui/Services/ProxyBridgeService.cs
@@ -0,0 +1,93 @@
+using System;
+using ProxyBridge.GUI.Interop;
+
+namespace ProxyBridge.GUI.Services;
+
+public class ProxyBridgeService : IDisposable
+{
+ private ProxyBridgeNative.LogCallback? _logCallback;
+ private ProxyBridgeNative.ConnectionCallback? _connectionCallback;
+ private bool _isRunning;
+
+ public event Action<string>? LogReceived;
+ public event Action<string, uint, string, ushort, string>? ConnectionReceived;
+
+ public ProxyBridgeService()
+ {
+ _logCallback = OnLogReceived;
+ _connectionCallback = OnConnectionReceived;
+
+ ProxyBridgeNative.ProxyBridge_SetLogCallback(_logCallback);
+ ProxyBridgeNative.ProxyBridge_SetConnectionCallback(_connectionCallback);
+ }
+
+ private void OnLogReceived(string message)
+ {
+ LogReceived?.Invoke(message);
+ }
+
+ private void OnConnectionReceived(string processName, uint pid, string destIp, ushort destPort, string proxyInfo)
+ {
+ ConnectionReceived?.Invoke(processName, pid, destIp, destPort, proxyInfo);
+ }
+
+ public bool Start()
+ {
+ if (_isRunning)
+ return true;
+
+ _isRunning = ProxyBridgeNative.ProxyBridge_Start();
+ return _isRunning;
+ }
+
+ public bool Stop()
+ {
+ if (!_isRunning)
+ return true;
+
+ _isRunning = !ProxyBridgeNative.ProxyBridge_Stop();
+ return !_isRunning;
+ }
+
+ public bool SetProxyConfig(string type, string ip, ushort port)
+ {
+ var proxyType = type.ToUpper() == "HTTP"
+ ? ProxyBridgeNative.ProxyType.HTTP
+ : ProxyBridgeNative.ProxyType.SOCKS5;
+
+ return ProxyBridgeNative.ProxyBridge_SetProxyConfig(proxyType, ip, port);
+ }
+
+ public uint AddRule(string processName, string action)
+ {
+ var ruleAction = action.ToUpper() switch
+ {
+ "DIRECT" => ProxyBridgeNative.RuleAction.DIRECT,
+ "BLOCK" => ProxyBridgeNative.RuleAction.BLOCK,
+ _ => ProxyBridgeNative.RuleAction.PROXY
+ };
+
+ return ProxyBridgeNative.ProxyBridge_AddRule(processName, ruleAction);
+ }
+
+ public bool EnableRule(uint ruleId)
+ {
+ return ProxyBridgeNative.ProxyBridge_EnableRule(ruleId);
+ }
+
+ public bool DisableRule(uint ruleId)
+ {
+ return ProxyBridgeNative.ProxyBridge_DisableRule(ruleId);
+ }
+
+ public bool ClearRules()
+ {
+ return ProxyBridgeNative.ProxyBridge_ClearRules();
+ }
+
+ public void Dispose()
+ {
+ Stop();
+ GC.SuppressFinalize(this);
+ }
+}
diff --git a/gui/ViewModels/AboutViewModel.cs b/gui/ViewModels/AboutViewModel.cs
new file mode 100644
index 0000000..72d16c3
--- /dev/null
+++ b/gui/ViewModels/AboutViewModel.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Reflection;
+using System.Windows.Input;
+
+namespace ProxyBridge.GUI.ViewModels;
+
+public class AboutViewModel
+{
+ public string Version { get; }
+ public ICommand CloseCommand { get; }
+
+ public AboutViewModel(Action onClose)
+ {
+ var version = Assembly.GetExecutingAssembly().GetName().Version;
+ Version = version != null
+ ? $"Version {version.Major}.{version.Minor}.{version.Build}"
+ : "Version 1.0.0";
+
+ CloseCommand = new RelayCommand(onClose);
+ }
+}
diff --git a/gui/ViewModels/MainWindowViewModel.cs b/gui/ViewModels/MainWindowViewModel.cs
new file mode 100644
index 0000000..81b4a70
--- /dev/null
+++ b/gui/ViewModels/MainWindowViewModel.cs
@@ -0,0 +1,426 @@
+using System;
+using System.Collections.ObjectModel;
+using System.Windows.Input;
+using System.Linq;
+using Avalonia.Threading;
+using Avalonia.Controls;
+using ProxyBridge.GUI.Views;
+using ProxyBridge.GUI.Services;
+
+namespace ProxyBridge.GUI.ViewModels;
+
+public class MainWindowViewModel : ViewModelBase
+{
+ private string _title = "ProxyBridge v1.1";
+ private int _selectedTabIndex;
+ private string _connectionsLog = "";
+ private string _activityLog = "ProxyBridge initialized successfully\n";
+ private string _connectionsSearchText = "";
+ private string _activitySearchText = "";
+ private string _filteredConnectionsLog = "";
+ private string _filteredActivityLog = "";
+ private bool _isProxyRulesDialogOpen;
+ private bool _isProxySettingsDialogOpen;
+ private bool _isAddRuleViewOpen;
+ private string _newProcessName = "";
+ private string _newProxyAction = "PROXY";
+ private Window? _mainWindow;
+ private ProxyBridgeService? _proxyService;
+
+ public void SetMainWindow(Window window)
+ {
+ _mainWindow = window;
+
+ try
+ {
+ _proxyService = new ProxyBridgeService();
+ _proxyService.LogReceived += (msg) =>
+ {
+ Dispatcher.UIThread.Post(() =>
+ {
+ ActivityLog += $"[{DateTime.Now:HH:mm:ss}] {msg}\n";
+ });
+ };
+
+ _proxyService.ConnectionReceived += (processName, pid, destIp, destPort, proxyInfo) =>
+ {
+ Dispatcher.UIThread.Post(() =>
+ {
+ ConnectionsLog += $"[{DateTime.Now:HH:mm:ss}] {processName} (PID:{pid}) -> {destIp}:{destPort} via {proxyInfo}\n";
+ });
+ };
+
+ // Start the proxy bridge
+ if (_proxyService.Start())
+ {
+ ActivityLog += $"[{DateTime.Now:HH:mm:ss}] ProxyBridge service started successfully\n";
+ }
+ else
+ {
+ ActivityLog += $"[{DateTime.Now:HH:mm:ss}] ERROR: Failed to start ProxyBridge service\n";
+ }
+ }
+ catch (Exception ex)
+ {
+ ActivityLog += $"[{DateTime.Now:HH:mm:ss}] ERROR: {ex.Message}\n";
+ }
+ }
+
+ public string Title
+ {
+ get => _title;
+ set => SetProperty(ref _title, value);
+ }
+
+ public int SelectedTabIndex
+ {
+ get => _selectedTabIndex;
+ set => SetProperty(ref _selectedTabIndex, value);
+ }
+
+ public string ConnectionsLog
+ {
+ get => _connectionsLog;
+ set
+ {
+ SetProperty(ref _connectionsLog, value);
+ FilterConnectionsLog();
+ }
+ }
+
+ public string ActivityLog
+ {
+ get => _activityLog;
+ set
+ {
+ SetProperty(ref _activityLog, value);
+ FilterActivityLog();
+ }
+ }
+
+ public string ConnectionsSearchText
+ {
+ get => _connectionsSearchText;
+ set
+ {
+ SetProperty(ref _connectionsSearchText, value);
+ FilterConnectionsLog();
+ }
+ }
+
+ public string ActivitySearchText
+ {
+ get => _activitySearchText;
+ set
+ {
+ SetProperty(ref _activitySearchText, value);
+ FilterActivityLog();
+ }
+ }
+
+ public string FilteredConnectionsLog
+ {
+ get => _filteredConnectionsLog;
+ set => SetProperty(ref _filteredConnectionsLog, value);
+ }
+
+ public string FilteredActivityLog
+ {
+ get => _filteredActivityLog;
+ set => SetProperty(ref _filteredActivityLog, value);
+ }
+
+ public bool IsProxyRulesDialogOpen
+ {
+ get => _isProxyRulesDialogOpen;
+ set => SetProperty(ref _isProxyRulesDialogOpen, value);
+ }
+
+ public bool IsProxySettingsDialogOpen
+ {
+ get => _isProxySettingsDialogOpen;
+ set => SetProperty(ref _isProxySettingsDialogOpen, value);
+ }
+
+ public bool IsAddRuleViewOpen
+ {
+ get => _isAddRuleViewOpen;
+ set => SetProperty(ref _isAddRuleViewOpen, value);
+ }
+
+ public string NewProcessName
+ {
+ get => _newProcessName;
+ set => SetProperty(ref _newProcessName, value);
+ }
+
+ public string NewProxyAction
+ {
+ get => _newProxyAction;
+ set => SetProperty(ref _newProxyAction, value);
+ }
+
+ public ObservableCollection<ProxyRule> ProxyRules { get; } = new();
+
+ // Commands
+ public ICommand ShowProxySettingsCommand { get; }
+ public ICommand ShowProxyRulesCommand { get; }
+ public ICommand ShowAboutCommand { get; }
+ public ICommand CloseDialogCommand { get; }
+ public ICommand ClearConnectionsLogCommand { get; }
+ public ICommand ClearActivityLogCommand { get; }
+ public ICommand AddRuleCommand { get; }
+ public ICommand SaveNewRuleCommand { get; }
+ public ICommand CancelAddRuleCommand { get; }
+
+ public MainWindowViewModel()
+ {
+ ShowProxySettingsCommand = new RelayCommand(async () =>
+ {
+ var window = new ProxySettingsWindow();
+
+ var viewModel = new ProxySettingsViewModel(
+ onSave: (type, ip, port) =>
+ {
+ if (_proxyService != null && ushort.TryParse(port, out ushort portNum))
+ {
+ if (_proxyService.SetProxyConfig(type, ip, portNum))
+ {
+ ActivityLog += $"[{DateTime.Now:HH:mm:ss}] Saved proxy settings: {type} {ip}:{port}\n";
+ }
+ else
+ {
+ ActivityLog += $"[{DateTime.Now:HH:mm:ss}] ERROR: Failed to set proxy config\n";
+ }
+ }
+ window.Close();
+ },
+ onClose: () =>
+ {
+ window.Close();
+ }
+ );
+
+ window.DataContext = viewModel;
+
+ if (_mainWindow != null)
+ {
+ await window.ShowDialog(_mainWindow);
+ }
+ });
+
+ ShowProxyRulesCommand = new RelayCommand(async () =>
+ {
+ var window = new ProxyRulesWindow();
+
+ var viewModel = new ProxyRulesViewModel(
+ proxyRules: ProxyRules,
+ onAddRule: (rule) =>
+ {
+ if (_proxyService != null)
+ {
+ uint ruleId = _proxyService.AddRule(rule.ProcessName, rule.Action);
+ if (ruleId > 0)
+ {
+ rule.RuleId = ruleId;
+ rule.Index = ProxyRules.Count + 1;
+ ProxyRules.Add(rule);
+ ActivityLog += $"[{DateTime.Now:HH:mm:ss}] Added rule: {rule.ProcessName} -> {rule.Action} (ID: {ruleId})\n";
+ }
+ else
+ {
+ ActivityLog += $"[{DateTime.Now:HH:mm:ss}] ERROR: Failed to add rule\n";
+ }
+ }
+ },
+ onClose: () =>
+ {
+ window.Close();
+ },
+ proxyService: _proxyService
+ );
+
+ window.DataContext = viewModel;
+
+ if (_mainWindow != null)
+ {
+ await window.ShowDialog(_mainWindow);
+ }
+ });
+
+ ShowAboutCommand = new RelayCommand(async () =>
+ {
+ var viewModel = new AboutViewModel(() =>
+ {
+ // Window will be closed
+ });
+
+ var window = new Views.AboutWindow
+ {
+ DataContext = viewModel
+ };
+
+ if (_mainWindow != null)
+ {
+ await window.ShowDialog(_mainWindow);
+ }
+ });
+
+ CloseDialogCommand = new RelayCommand(CloseDialogs);
+
+ ClearConnectionsLogCommand = new RelayCommand(() =>
+ {
+ ConnectionsLog = "";
+ });
+
+ ClearActivityLogCommand = new RelayCommand(() =>
+ {
+ ActivityLog = "ProxyBridge initialized successfully\n";
+ });
+
+ AddRuleCommand = new RelayCommand(() =>
+ {
+ IsAddRuleViewOpen = true;
+ NewProcessName = "";
+ NewProxyAction = "PROXY";
+ });
+
+ SaveNewRuleCommand = new RelayCommand(() =>
+ {
+ if (string.IsNullOrWhiteSpace(NewProcessName))
+ {
+ return;
+ }
+
+ var rule = new ProxyRule
+ {
+ ProcessName = NewProcessName,
+ Action = NewProxyAction,
+ IsEnabled = true
+ };
+
+ if (_proxyService != null)
+ {
+ var ruleId = _proxyService.AddRule(NewProcessName, NewProxyAction);
+ if (ruleId > 0)
+ {
+ rule.RuleId = ruleId;
+ ProxyRules.Add(rule);
+ ActivityLog += $"[{DateTime.Now:HH:mm:ss}] Added rule: {NewProcessName} -> {NewProxyAction}\n";
+ IsAddRuleViewOpen = false;
+ NewProcessName = "";
+ }
+ else
+ {
+ ActivityLog += $"[{DateTime.Now:HH:mm:ss}] ERROR: Failed to add rule\n";
+ }
+ }
+ });
+
+ CancelAddRuleCommand = new RelayCommand(() =>
+ {
+ IsAddRuleViewOpen = false;
+ NewProcessName = "";
+ });
+ }
+
+ private void FilterConnectionsLog()
+ {
+ if (string.IsNullOrWhiteSpace(_connectionsSearchText))
+ {
+ FilteredConnectionsLog = _connectionsLog;
+ }
+ else
+ {
+ var lines = _connectionsLog.Split('\n', StringSplitOptions.RemoveEmptyEntries);
+ var filtered = lines.Where(line => line.Contains(_connectionsSearchText, StringComparison.OrdinalIgnoreCase));
+ FilteredConnectionsLog = string.Join('\n', filtered) + (filtered.Any() ? "\n" : "");
+ }
+ }
+
+ private void FilterActivityLog()
+ {
+ if (string.IsNullOrWhiteSpace(_activitySearchText))
+ {
+ FilteredActivityLog = _activityLog;
+ }
+ else
+ {
+ var lines = _activityLog.Split('\n', StringSplitOptions.RemoveEmptyEntries);
+ var filtered = lines.Where(line => line.Contains(_activitySearchText, StringComparison.OrdinalIgnoreCase));
+ FilteredActivityLog = string.Join('\n', filtered) + (filtered.Any() ? "\n" : "");
+ }
+ }
+
+ private void CloseDialogs()
+ {
+ IsProxyRulesDialogOpen = false;
+ IsProxySettingsDialogOpen = false;
+ }
+
+ public void Cleanup()
+ {
+ _proxyService?.Dispose();
+ _proxyService = null;
+ }
+}
+
+public class ProxyRule : ViewModelBase
+{
+ private string _processName = "";
+ private string _action = "PROXY";
+ private bool _isEnabled = true;
+ private int _index;
+ private uint _ruleId;
+
+ public int Index
+ {
+ get => _index;
+ set => SetProperty(ref _index, value);
+ }
+
+ public uint RuleId
+ {
+ get => _ruleId;
+ set => SetProperty(ref _ruleId, value);
+ }
+
+ public string ProcessName
+ {
+ get => _processName;
+ set => SetProperty(ref _processName, value);
+ }
+
+ public string Action
+ {
+ get => _action;
+ set => SetProperty(ref _action, value);
+ }
+
+ public bool IsEnabled
+ {
+ get => _isEnabled;
+ set => SetProperty(ref _isEnabled, value);
+ }
+}
+
+// Simple ICommand implementation
+public class RelayCommand : ICommand
+{
+ private readonly Action _execute;
+ private readonly Func<bool>? _canExecute;
+
+ public RelayCommand(Action execute, Func<bool>? canExecute = null)
+ {
+ _execute = execute ?? throw new ArgumentNullException(nameof(execute));
+ _canExecute = canExecute;
+ }
+
+ public event EventHandler? CanExecuteChanged;
+
+ public bool CanExecute(object? parameter) => _canExecute?.Invoke() ?? true;
+
+ public void Execute(object? parameter) => _execute();
+
+ public void RaiseCanExecuteChanged() => CanExecuteChanged?.Invoke(this, EventArgs.Empty);
+}
diff --git a/gui/ViewModels/ProxyRulesViewModel.cs b/gui/ViewModels/ProxyRulesViewModel.cs
new file mode 100644
index 0000000..e8e50ce
--- /dev/null
+++ b/gui/ViewModels/ProxyRulesViewModel.cs
@@ -0,0 +1,135 @@
+using System;
+using System.Collections.ObjectModel;
+using System.Windows.Input;
+using ProxyBridge.GUI.Services;
+
+namespace ProxyBridge.GUI.ViewModels;
+
+public class ProxyRulesViewModel : ViewModelBase
+{
+ private bool _isAddRuleViewOpen;
+ private string _newProcessName = "";
+ private string _newProxyAction = "PROXY";
+ private string _processNameError = "";
+ private Action<ProxyRule>? _onAddRule;
+ private Action? _onClose;
+ private ProxyBridgeService? _proxyService;
+
+ public ObservableCollection<ProxyRule> ProxyRules { get; }
+
+ public bool IsAddRuleViewOpen
+ {
+ get => _isAddRuleViewOpen;
+ set => SetProperty(ref _isAddRuleViewOpen, value);
+ }
+
+ public string NewProcessName
+ {
+ get => _newProcessName;
+ set
+ {
+ SetProperty(ref _newProcessName, value);
+ ProcessNameError = "";
+ }
+ }
+
+ public string NewProxyAction
+ {
+ get => _newProxyAction;
+ set => SetProperty(ref _newProxyAction, value);
+ }
+
+ public string ProcessNameError
+ {
+ get => _processNameError;
+ set => SetProperty(ref _processNameError, value);
+ }
+
+ public ICommand AddRuleCommand { get; }
+ public ICommand SaveNewRuleCommand { get; }
+ public ICommand CancelAddRuleCommand { get; }
+ public ICommand CloseCommand { get; }
+
+ public ProxyRulesViewModel(ObservableCollection<ProxyRule> proxyRules, Action<ProxyRule> onAddRule, Action onClose, ProxyBridgeService? proxyService = null)
+ {
+ ProxyRules = proxyRules;
+ _onAddRule = onAddRule;
+ _onClose = onClose;
+ _proxyService = proxyService;
+
+ foreach (var rule in ProxyRules)
+ {
+ rule.PropertyChanged += Rule_PropertyChanged;
+ }
+
+ AddRuleCommand = new RelayCommand(() =>
+ {
+ IsAddRuleViewOpen = true;
+ });
+
+ SaveNewRuleCommand = new RelayCommand(() =>
+ {
+ if (string.IsNullOrWhiteSpace(NewProcessName))
+ {
+ ProcessNameError = "Process name is required";
+ return;
+ }
+
+ // This could be an issue if app name contain char
+ if (!System.Text.RegularExpressions.Regex.IsMatch(NewProcessName, @"^[a-zA-Z0-9\s._\-*]+$"))
+ {
+ ProcessNameError = "Invalid characters in process name. Only letters, numbers, spaces, dots, dashes, underscores and * are allowed";
+ return;
+ }
+
+ if (NewProcessName != "*" && !NewProcessName.Equals("*", StringComparison.OrdinalIgnoreCase))
+ {
+ if (!NewProcessName.EndsWith(".exe", StringComparison.OrdinalIgnoreCase) &&
+ !NewProcessName.Contains(".exe ", StringComparison.OrdinalIgnoreCase))
+ {
+ NewProcessName += ".exe";
+ }
+ }
+
+ var newRule = new ProxyRule
+ {
+ ProcessName = NewProcessName,
+ Action = NewProxyAction,
+ IsEnabled = true
+ };
+
+ newRule.PropertyChanged += Rule_PropertyChanged;
+
+ _onAddRule?.Invoke(newRule);
+ NewProcessName = "";
+ NewProxyAction = "PROXY";
+ ProcessNameError = "";
+ IsAddRuleViewOpen = false;
+ }); CancelAddRuleCommand = new RelayCommand(() =>
+ {
+ NewProcessName = "";
+ NewProxyAction = "PROXY";
+ IsAddRuleViewOpen = false;
+ });
+
+ CloseCommand = new RelayCommand(() =>
+ {
+ _onClose?.Invoke();
+ });
+ }
+
+ private void Rule_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName == nameof(ProxyRule.IsEnabled) && sender is ProxyRule rule && _proxyService != null)
+ {
+ if (rule.IsEnabled)
+ {
+ _proxyService.EnableRule(rule.RuleId);
+ }
+ else
+ {
+ _proxyService.DisableRule(rule.RuleId);
+ }
+ }
+ }
+}
diff --git a/gui/ViewModels/ProxySettingsViewModel.cs b/gui/ViewModels/ProxySettingsViewModel.cs
new file mode 100644
index 0000000..7a645f0
--- /dev/null
+++ b/gui/ViewModels/ProxySettingsViewModel.cs
@@ -0,0 +1,112 @@
+using System;
+using System.Net;
+using System.Text.RegularExpressions;
+using System.Windows.Input;
+
+namespace ProxyBridge.GUI.ViewModels;
+
+public class ProxySettingsViewModel : ViewModelBase
+{
+ private string _proxyIp = "";
+ private string _proxyPort = "";
+ private string _proxyType = "SOCKS5";
+ private string _ipError = "";
+ private string _portError = "";
+ private Action<string, string, string>? _onSave;
+ private Action? _onClose;
+
+ public string ProxyIp
+ {
+ get => _proxyIp;
+ set
+ {
+ SetProperty(ref _proxyIp, value);
+ IpError = "";
+ }
+ }
+
+ public string ProxyPort
+ {
+ get => _proxyPort;
+ set
+ {
+ SetProperty(ref _proxyPort, value);
+ PortError = "";
+ }
+ }
+
+ public string ProxyType
+ {
+ get => _proxyType;
+ set => SetProperty(ref _proxyType, value);
+ }
+
+ public string IpError
+ {
+ get => _ipError;
+ set => SetProperty(ref _ipError, value);
+ }
+
+ public string PortError
+ {
+ get => _portError;
+ set => SetProperty(ref _portError, value);
+ }
+
+ public ICommand SaveCommand { get; }
+ public ICommand CancelCommand { get; }
+
+ private bool IsValidIpOrDomain(string input)
+ {
+ if (IPAddress.TryParse(input, out _))
+ {
+ return true;
+ }
+
+ var domainRegex = new Regex(@"^(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)*[a-zA-Z0-9](?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?$");
+ return domainRegex.IsMatch(input);
+ }
+
+ public ProxySettingsViewModel(Action<string, string, string> onSave, Action onClose)
+ {
+ _onSave = onSave;
+ _onClose = onClose;
+
+ SaveCommand = new RelayCommand(() =>
+ {
+ bool isValid = true;
+
+ if (string.IsNullOrWhiteSpace(ProxyIp))
+ {
+ IpError = "IP address or domain is required";
+ isValid = false;
+ }
+ else if (!IsValidIpOrDomain(ProxyIp))
+ {
+ IpError = "Invalid IP address or domain name";
+ isValid = false;
+ }
+
+ if (string.IsNullOrWhiteSpace(ProxyPort))
+ {
+ PortError = "Port is required";
+ isValid = false;
+ }
+ else if (!int.TryParse(ProxyPort, out int port) || port < 1 || port > 65535)
+ {
+ PortError = "Port must be between 1 and 65535";
+ isValid = false;
+ }
+
+ if (isValid)
+ {
+ _onSave?.Invoke(ProxyType, ProxyIp, ProxyPort);
+ }
+ });
+
+ CancelCommand = new RelayCommand(() =>
+ {
+ _onClose?.Invoke();
+ });
+ }
+}
diff --git a/gui/ViewModels/ViewModelBase.cs b/gui/ViewModels/ViewModelBase.cs
new file mode 100644
index 0000000..1bf657a
--- /dev/null
+++ b/gui/ViewModels/ViewModelBase.cs
@@ -0,0 +1,23 @@
+using System;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+
+namespace ProxyBridge.GUI.ViewModels;
+
+public class ViewModelBase : INotifyPropertyChanged
+{
+ public event PropertyChangedEventHandler? PropertyChanged;
+
+ protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ protected bool SetProperty<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
+ {
+ if (Equals(field, value)) return false;
+ field = value;
+ OnPropertyChanged(propertyName);
+ return true;
+ }
+}
diff --git a/gui/Views/AboutWindow.axaml b/gui/Views/AboutWindow.axaml
new file mode 100644
index 0000000..cb81d8e
--- /dev/null
+++ b/gui/Views/AboutWindow.axaml
@@ -0,0 +1,87 @@
+<Window xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:vm="using:ProxyBridge.GUI.ViewModels"
+ x:Class="ProxyBridge.GUI.Views.AboutWindow"
+ x:DataType="vm:AboutViewModel"
+ x:CompileBindings="True"
+ Title="About ProxyBridge"
+ Icon="/Assets/logo.ico"
+ Width="500" Height="400"
+ CanResize="False"
+ WindowStartupLocation="CenterOwner"
+ Background="#FF1E1E1E">
+
+ <Design.DataContext>
+ <vm:AboutViewModel/>
+ </Design.DataContext>
+
+ <Grid RowDefinitions="Auto,*">
+ <!-- Header -->
+ <Border Grid.Row="0" Background="#FF252526" BorderBrush="#FF007ACC" BorderThickness="0,0,0,1" Padding="20,16">
+ <StackPanel Orientation="Horizontal" Spacing="12">
+ <TextBlock Text="β„Ή" FontSize="24" Foreground="#FF007ACC" VerticalAlignment="Center"/>
+ <TextBlock Text="About ProxyBridge"
+ FontSize="18"
+ FontWeight="SemiBold"
+ VerticalAlignment="Center"/>
+ </StackPanel>
+ </Border>
+
+ <!-- Content -->
+ <StackPanel Grid.Row="1" Margin="32,24" Spacing="16">
+ <TextBlock Text="ProxyBridge"
+ FontSize="28"
+ FontWeight="Bold"
+ HorizontalAlignment="Center"
+ Foreground="#FF007ACC"/>
+
+ <TextBlock Text="{Binding Version}"
+ FontSize="14"
+ HorizontalAlignment="Center"
+ Foreground="#FFB0B0B0"/>
+
+ <TextBlock Text="Modern Windows Network Proxy"
+ FontSize="14"
+ HorizontalAlignment="Center"
+ Foreground="#FFB0B0B0"
+ TextWrapping="Wrap"
+ Margin="0,0,0,8"/>
+
+
+ <TextBlock Text="Author: Sourav Kalal / InterceptSuite"
+ FontSize="13"
+ HorizontalAlignment="Center"
+ Foreground="#FFB0B0B0"
+ Margin="0,4,0,0"/>
+
+ <!-- Clickable Links -->
+ <StackPanel Spacing="12">
+ <TextBlock HorizontalAlignment="Center">
+ <Run Text="Website: " Foreground="#FFB0B0B0"/>
+ <TextBlock Text="interceptsuite.com"
+ Foreground="#FF007ACC"
+ TextDecorations="Underline"
+ Cursor="Hand"
+ PointerPressed="OnWebsiteClick"/>
+ </TextBlock>
+
+ <TextBlock HorizontalAlignment="Center">
+ <Run Text="GitHub: " Foreground="#FFB0B0B0"/>
+ <TextBlock Text="github.com/InterceptSuite/ProxyBridge"
+ Foreground="#FF007ACC"
+ TextDecorations="Underline"
+ Cursor="Hand"
+ PointerPressed="OnGitHubClick"/>
+ </TextBlock>
+ </StackPanel>
+
+ <TextBlock Text="License: MIT"
+ FontSize="13"
+ HorizontalAlignment="Center"
+ Foreground="#FFB0B0B0"
+ Margin="0,8,0,0"/>
+
+
+ </StackPanel>
+ </Grid>
+</Window>
diff --git a/gui/Views/AboutWindow.axaml.cs b/gui/Views/AboutWindow.axaml.cs
new file mode 100644
index 0000000..675cff0
--- /dev/null
+++ b/gui/Views/AboutWindow.axaml.cs
@@ -0,0 +1,40 @@
+using Avalonia.Controls;
+using System.Diagnostics;
+using Avalonia.Input;
+using Avalonia.Interactivity;
+
+namespace ProxyBridge.GUI.Views;
+
+public partial class AboutWindow : Window
+{
+ public AboutWindow()
+ {
+ InitializeComponent();
+ }
+
+ private void OnWebsiteClick(object? sender, PointerPressedEventArgs e)
+ {
+ OpenUrl("https://interceptsuite.com");
+ }
+
+ private void OnGitHubClick(object? sender, PointerPressedEventArgs e)
+ {
+ OpenUrl("https://github.com/InterceptSuite/ProxyBridge");
+ }
+
+ private void OpenUrl(string url)
+ {
+ try
+ {
+ Process.Start(new ProcessStartInfo
+ {
+ FileName = url,
+ UseShellExecute = true
+ });
+ }
+ catch
+ {
+ // Silently fail if browser can't be opened
+ }
+ }
+}
diff --git a/gui/Views/MainWindow.axaml b/gui/Views/MainWindow.axaml
new file mode 100644
index 0000000..fce084a
--- /dev/null
+++ b/gui/Views/MainWindow.axaml
@@ -0,0 +1,447 @@
+<Window xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:vm="using:ProxyBridge.GUI.ViewModels"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ mc:Ignorable="d" d:DesignWidth="1100" d:DesignHeight="650"
+ x:Class="ProxyBridge.GUI.Views.MainWindow"
+ x:DataType="vm:MainWindowViewModel"
+ x:CompileBindings="True"
+ Title="{Binding Title}"
+ Icon="/Assets/logo.ico"
+ Width="1100" Height="650"
+ MinWidth="900" MinHeight="600"
+ Background="#1E1E1E"
+ TransparencyLevelHint="AcrylicBlur"
+ ExtendClientAreaToDecorationsHint="True">
+
+ <Design.DataContext>
+ <vm:MainWindowViewModel/>
+ </Design.DataContext>
+
+ <Window.Styles>
+ <!-- Modern Dark Theme -->
+ <Style Selector="Window">
+ <Setter Property="Background" Value="#FF1E1E1E"/>
+ </Style>
+
+ <!-- Menu Styling -->
+ <Style Selector="Menu">
+ <Setter Property="Background" Value="#FF2D2D30"/>
+ <Setter Property="Foreground" Value="#FFE0E0E0"/>
+ <Setter Property="Height" Value="30"/>
+ </Style>
+
+ <Style Selector="MenuItem">
+ <Setter Property="Foreground" Value="#FFE0E0E0"/>
+ <Setter Property="Padding" Value="12,6"/>
+ <Setter Property="Height" Value="30"/>
+ </Style>
+
+ <Style Selector="MenuItem:pointerover /template/ Border#PART_LayoutRoot">
+ <Setter Property="Background" Value="#FF3E3E42"/>
+ </Style>
+
+ <Style Selector="MenuItem:selected /template/ Border#PART_LayoutRoot">
+ <Setter Property="Background" Value="#FF094771"/>
+ </Style>
+
+ <!-- Tab Control -->
+ <Style Selector="TabControl">
+ <Setter Property="Background" Value="Transparent"/>
+ </Style>
+
+ <Style Selector="TabItem">
+ <Setter Property="Foreground" Value="#FF9E9E9E"/>
+ <Setter Property="FontSize" Value="13"/>
+ <Setter Property="Padding" Value="16,8"/>
+ <Setter Property="MinHeight" Value="36"/>
+ </Style>
+
+ <Style Selector="TabItem:selected">
+ <Setter Property="Foreground" Value="#FFFFFFFF"/>
+ <Setter Property="Background" Value="#FF2D2D30"/>
+ </Style>
+
+ <Style Selector="TabItem:pointerover">
+ <Setter Property="Foreground" Value="#FFCCCCCC"/>
+ </Style>
+
+ <!-- TextBox Styling -->
+ <Style Selector="TextBox">
+ <Setter Property="Background" Value="#FF1E1E1E"/>
+ <Setter Property="Foreground" Value="#FFD4D4D4"/>
+ <Setter Property="BorderBrush" Value="#FF3F3F46"/>
+ <Setter Property="BorderThickness" Value="1"/>
+ <Setter Property="Padding" Value="8"/>
+ <Setter Property="FontFamily" Value="Consolas,Courier New"/>
+ <Setter Property="FontSize" Value="13"/>
+ <Setter Property="SelectionBrush" Value="#FF264F78"/>
+ <Setter Property="SelectionForegroundBrush" Value="#FFFFFFFF"/>
+ </Style>
+
+ <Style Selector="TextBox:focus /template/ Border#PART_BorderElement">
+ <Setter Property="BorderBrush" Value="#FF007ACC"/>
+ <Setter Property="BorderThickness" Value="1"/>
+ </Style>
+
+ <Style Selector="TextBox:pointerover /template/ Border#PART_BorderElement">
+ <Setter Property="BorderBrush" Value="#FF555555"/>
+ </Style>
+
+ <!-- Button Styling -->
+ <Style Selector="Button">
+ <Setter Property="Background" Value="#FF0E639C"/>
+ <Setter Property="Foreground" Value="#FFFFFFFF"/>
+ <Setter Property="BorderThickness" Value="0"/>
+ <Setter Property="Padding" Value="16,8"/>
+ <Setter Property="FontSize" Value="13"/>
+ <Setter Property="CornerRadius" Value="3"/>
+ <Setter Property="Cursor" Value="Hand"/>
+ </Style>
+
+ <Style Selector="Button:pointerover /template/ ContentPresenter">
+ <Setter Property="Background" Value="#FF1177BB"/>
+ </Style>
+
+ <Style Selector="Button:pressed /template/ ContentPresenter">
+ <Setter Property="Background" Value="#FF005A9E"/>
+ </Style>
+
+ <Style Selector="Button.secondary">
+ <Setter Property="Background" Value="#FF3E3E42"/>
+ </Style>
+
+ <Style Selector="Button.secondary:pointerover /template/ ContentPresenter">
+ <Setter Property="Background" Value="#FF505050"/>
+ </Style>
+
+ <Style Selector="Button.close">
+ <Setter Property="Background" Value="Transparent"/>
+ <Setter Property="Padding" Value="8"/>
+ <Setter Property="FontSize" Value="14"/>
+ <Setter Property="Width" Value="36"/>
+ <Setter Property="Height" Value="36"/>
+ </Style>
+
+ <Style Selector="Button.close:pointerover /template/ ContentPresenter">
+ <Setter Property="Background" Value="#FFE81123"/>
+ </Style>
+
+ <!-- CheckBox -->
+ <Style Selector="CheckBox">
+ <Setter Property="Foreground" Value="#FFD4D4D4"/>
+ </Style>
+
+ <!-- ListBox -->
+ <Style Selector="ListBox">
+ <Setter Property="Background" Value="#FF252526"/>
+ <Setter Property="BorderBrush" Value="#FF3F3F46"/>
+ <Setter Property="BorderThickness" Value="1"/>
+ </Style>
+
+ <Style Selector="ListBoxItem">
+ <Setter Property="Padding" Value="12"/>
+ <Setter Property="MinHeight" Value="48"/>
+ </Style>
+
+ <Style Selector="ListBoxItem:selected /template/ ContentPresenter">
+ <Setter Property="Background" Value="#FF094771"/>
+ </Style>
+
+ <Style Selector="ListBoxItem:pointerover /template/ ContentPresenter">
+ <Setter Property="Background" Value="#FF2A2D2E"/>
+ </Style>
+
+ <!-- ComboBox -->
+ <Style Selector="ComboBox">
+ <Setter Property="Background" Value="#FF3C3C3C"/>
+ <Setter Property="Foreground" Value="#FFD4D4D4"/>
+ <Setter Property="BorderBrush" Value="#FF3F3F46"/>
+ <Setter Property="Padding" Value="8"/>
+ </Style>
+
+ <Style Selector="ComboBox:pointerover /template/ Border#Background">
+ <Setter Property="BorderBrush" Value="#FF555555"/>
+ </Style>
+
+ <Style Selector="ComboBox:focus /template/ Border#Background">
+ <Setter Property="BorderBrush" Value="#FF007ACC"/>
+ </Style>
+
+ <!-- TextBlock -->
+ <Style Selector="TextBlock">
+ <Setter Property="Foreground" Value="#FFD4D4D4"/>
+ </Style>
+
+ <Style Selector="TextBlock.label">
+ <Setter Property="FontWeight" Value="Medium"/>
+ <Setter Property="Margin" Value="0,0,0,4"/>
+ </Style>
+
+ <Style Selector="TextBlock.secondary">
+ <Setter Property="Foreground" Value="#FF9E9E9E"/>
+ </Style>
+ </Window.Styles>
+
+ <Grid>
+ <!-- Main Content -->
+ <DockPanel>
+ <!-- Title Bar (Custom) -->
+ <Border DockPanel.Dock="Top" Background="#FF2D2D30" Height="32" IsHitTestVisible="False">
+ <Grid>
+ <TextBlock Text="ProxyBridge"
+ Foreground="#FFE0E0E0"
+ FontSize="12"
+ VerticalAlignment="Center"
+ Margin="12,0,0,0"/>
+ </Grid>
+ </Border>
+
+ <!-- Menu Bar -->
+ <Menu DockPanel.Dock="Top" Background="#FF2D2D30">
+ <MenuItem Header="Proxy">
+ <MenuItem Header="Proxy Settings" Command="{Binding ShowProxySettingsCommand}"/>
+ <MenuItem Header="Proxy Rules" Command="{Binding ShowProxyRulesCommand}"/>
+ </MenuItem>
+ <MenuItem Header="About" Command="{Binding ShowAboutCommand}"/>
+ </Menu>
+
+ <!-- Tab Control -->
+ <TabControl SelectedIndex="{Binding SelectedTabIndex}" Background="#FF1E1E1E" Padding="0">
+ <TabItem Header="πŸ”Œ Connections">
+ <Border Background="#FF252526" Margin="8" CornerRadius="4" BorderBrush="#FF3F3F46" BorderThickness="1">
+ <DockPanel>
+ <!-- Search and Clear Bar -->
+ <Border DockPanel.Dock="Top" Background="#FF1E1E1E" Padding="8" BorderBrush="#FF3F3F46" BorderThickness="0,0,0,1">
+ <Grid ColumnDefinitions="*,Auto,Auto">
+ <TextBox Grid.Column="0"
+ Text="{Binding ConnectionsSearchText}"
+ Watermark="πŸ” Search connections..."
+ Margin="0,0,8,0"/>
+ <Button Grid.Column="1"
+ Content="Clear"
+ Classes="secondary"
+ Command="{Binding ClearConnectionsLogCommand}"
+ Padding="12,6"
+ Margin="0,0,8,0"/>
+ </Grid>
+ </Border>
+
+ <!-- Connections Log -->
+ <ScrollViewer>
+ <TextBox Text="{Binding FilteredConnectionsLog, Mode=OneWay}"
+ IsReadOnly="True"
+ AcceptsReturn="True"
+ TextWrapping="Wrap"
+ Background="Transparent"
+ BorderThickness="0"
+ Watermark="No active connections..."
+ MinHeight="500"/>
+ </ScrollViewer>
+ </DockPanel>
+ </Border>
+ </TabItem>
+ <TabItem Header="πŸ“‹ Activity Logs">
+ <Border Background="#FF252526" Margin="8" CornerRadius="4" BorderBrush="#FF3F3F46" BorderThickness="1">
+ <DockPanel>
+ <!-- Search and Clear Bar -->
+ <Border DockPanel.Dock="Top" Background="#FF1E1E1E" Padding="8" BorderBrush="#FF3F3F46" BorderThickness="0,0,0,1">
+ <Grid ColumnDefinitions="*,Auto,Auto">
+ <TextBox Grid.Column="0"
+ Text="{Binding ActivitySearchText}"
+ Watermark="πŸ” Search activity logs..."
+ Margin="0,0,8,0"/>
+ <Button Grid.Column="1"
+ Content="Clear"
+ Classes="secondary"
+ Command="{Binding ClearActivityLogCommand}"
+ Padding="12,6"
+ Margin="0,0,8,0"/>
+ </Grid>
+ </Border>
+
+ <!-- Activity Log -->
+ <ScrollViewer>
+ <TextBox Text="{Binding FilteredActivityLog, Mode=OneWay}"
+ IsReadOnly="True"
+ AcceptsReturn="True"
+ TextWrapping="Wrap"
+ Background="Transparent"
+ BorderThickness="0"
+ MinHeight="500"/>
+ </ScrollViewer>
+ </DockPanel>
+ </Border>
+ </TabItem>
+ </TabControl>
+ </DockPanel>
+
+ <!-- Proxy Rules Dialog -->
+ <Panel IsVisible="{Binding IsProxyRulesDialogOpen}" Background="#C0000000" ZIndex="100">
+ <Border Width="700" Height="500"
+ Background="#FF2D2D30"
+ BorderBrush="#FF007ACC"
+ BorderThickness="1"
+ CornerRadius="6"
+ BoxShadow="0 8 32 #80000000">
+ <DockPanel>
+ <!-- Dialog Header -->
+ <Border DockPanel.Dock="Top" Background="#FF1E1E1E" Padding="16" CornerRadius="6,6,0,0">
+ <Grid ColumnDefinitions="*,Auto,Auto">
+ <StackPanel Orientation="Horizontal" Spacing="8">
+ <TextBlock Text="βš™" FontSize="20" VerticalAlignment="Center"/>
+ <TextBlock Text="Process Rules"
+ FontSize="16"
+ FontWeight="SemiBold"
+ VerticalAlignment="Center"/>
+ </StackPanel>
+ <Button Grid.Column="1"
+ Content="βž• Add Rule"
+ Margin="0,0,8,0"
+ Padding="12,6"
+ Command="{Binding AddRuleCommand}"/>
+ <Button Grid.Column="2"
+ Content="βœ•"
+ Classes="close"
+ Command="{Binding CloseDialogCommand}"/>
+ </Grid>
+ </Border>
+
+ <!-- Rules List View -->
+ <Border Margin="16,16,16,16"
+ Background="#FF252526"
+ CornerRadius="4"
+ BorderBrush="#FF3F3F46"
+ BorderThickness="1"
+ IsVisible="{Binding !IsAddRuleViewOpen}">
+ <ListBox ItemsSource="{Binding ProxyRules}"
+ Background="Transparent"
+ BorderThickness="0">
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+ <Grid ColumnDefinitions="Auto,*,Auto">
+ <CheckBox Grid.Column="0"
+ IsChecked="{Binding IsEnabled}"
+ Margin="0,0,12,0"
+ VerticalAlignment="Center"/>
+ <StackPanel Grid.Column="1" Spacing="4">
+ <TextBlock Text="{Binding ProcessName}"
+ FontSize="14"
+ FontWeight="Medium"/>
+ <TextBlock Classes="secondary" FontSize="12">
+ <Run Text="Action:"/>
+ <Run Text="{Binding Action}" FontWeight="SemiBold"/>
+ </TextBlock>
+ </StackPanel>
+ <Button Grid.Column="2"
+ Content="πŸ—‘"
+ Classes="secondary"
+ Padding="8"
+ ToolTip.Tip="Delete rule"/>
+ </Grid>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+ </Border>
+
+ <!-- Add Rule Form View -->
+ <StackPanel Margin="24,20"
+ Spacing="16"
+ IsVisible="{Binding IsAddRuleViewOpen}">
+ <StackPanel Spacing="6">
+ <TextBlock Text="Process Name" Classes="label"/>
+ <TextBox Text="{Binding NewProcessName}"
+ Watermark="e.g., chrome.exe, firefox.exe"/>
+ </StackPanel>
+
+ <StackPanel Spacing="6">
+ <TextBlock Text="Action" Classes="label"/>
+ <ComboBox SelectedIndex="0"
+ HorizontalAlignment="Stretch">
+ <ComboBoxItem Content="PROXY"/>
+ <ComboBoxItem Content="DIRECT"/>
+ <ComboBoxItem Content="BLOCK"/>
+ </ComboBox>
+ </StackPanel>
+
+ <StackPanel Orientation="Horizontal"
+ HorizontalAlignment="Right"
+ Spacing="12"
+ Margin="0,24,0,0">
+ <Button Content="Cancel"
+ Classes="secondary"
+ Command="{Binding CancelAddRuleCommand}"
+ Width="100"/>
+ <Button Content="Save Rule"
+ Command="{Binding SaveNewRuleCommand}"
+ Width="130"/>
+ </StackPanel>
+ </StackPanel>
+ </DockPanel>
+ </Border>
+ </Panel>
+
+ <!-- Proxy Settings Dialog -->
+ <Panel IsVisible="{Binding IsProxySettingsDialogOpen}" Background="#C0000000" ZIndex="100">
+ <Border Width="500" Height="400"
+ Background="#FF2D2D30"
+ BorderBrush="#FF007ACC"
+ BorderThickness="1"
+ CornerRadius="6"
+ BoxShadow="0 8 32 #80000000">
+ <DockPanel>
+ <!-- Dialog Header -->
+ <Border DockPanel.Dock="Top" Background="#FF1E1E1E" Padding="16" CornerRadius="6,6,0,0">
+ <Grid ColumnDefinitions="*,Auto">
+ <StackPanel Orientation="Horizontal" Spacing="8">
+ <TextBlock Text="πŸ”§" FontSize="20" VerticalAlignment="Center"/>
+ <TextBlock Text="Proxy Settings"
+ FontSize="16"
+ FontWeight="SemiBold"
+ VerticalAlignment="Center"/>
+ </StackPanel>
+ <Button Grid.Column="1"
+ Content="βœ•"
+ Classes="close"
+ Command="{Binding CloseDialogCommand}"/>
+ </Grid>
+ </Border>
+
+ <!-- Settings Form -->
+ <StackPanel Margin="24,20" Spacing="16">
+ <StackPanel Spacing="6">
+ <TextBlock Text="Proxy Type" Classes="label"/>
+ <ComboBox SelectedIndex="0" HorizontalAlignment="Stretch">
+ <ComboBoxItem Content="SOCKS5"/>
+ <ComboBoxItem Content="HTTP"/>
+ </ComboBox>
+ </StackPanel>
+
+ <StackPanel Spacing="6">
+ <TextBlock Text="Proxy IP Address" Classes="label"/>
+ <TextBox Text="" Watermark="Enter IP address"/>
+ </StackPanel>
+
+ <StackPanel Spacing="6">
+ <TextBlock Text="Proxy Port" Classes="label"/>
+ <TextBox Text="" Watermark="Enter port number"/>
+ </StackPanel>
+
+ <StackPanel Orientation="Horizontal"
+ HorizontalAlignment="Right"
+ Spacing="12"
+ Margin="0,24,0,0">
+ <Button Content="Cancel"
+ Classes="secondary"
+ Command="{Binding CloseDialogCommand}"
+ Width="100"/>
+ <Button Content="Save Changes"
+ Width="130"/>
+ </StackPanel>
+ </StackPanel>
+ </DockPanel>
+ </Border>
+ </Panel>
+ </Grid>
+</Window>
diff --git a/gui/Views/MainWindow.axaml.cs b/gui/Views/MainWindow.axaml.cs
new file mode 100644
index 0000000..e8c33aa
--- /dev/null
+++ b/gui/Views/MainWindow.axaml.cs
@@ -0,0 +1,31 @@
+using Avalonia.Controls;
+using ProxyBridge.GUI.ViewModels;
+using System;
+
+namespace ProxyBridge.GUI.Views;
+
+public partial class MainWindow : Window
+{
+ public MainWindow()
+ {
+ InitializeComponent();
+
+ // Set window reference in ViewModel
+ this.Opened += (s, e) =>
+ {
+ if (DataContext is MainWindowViewModel vm)
+ {
+ vm.SetMainWindow(this);
+ }
+ };
+
+ // Cleanup on close
+ this.Closing += (s, e) =>
+ {
+ if (DataContext is MainWindowViewModel vm)
+ {
+ vm.Cleanup();
+ }
+ };
+ }
+}
diff --git a/gui/Views/ProxyRulesWindow.axaml b/gui/Views/ProxyRulesWindow.axaml
new file mode 100644
index 0000000..647a520
--- /dev/null
+++ b/gui/Views/ProxyRulesWindow.axaml
@@ -0,0 +1,242 @@
+<Window xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:vm="using:ProxyBridge.GUI.ViewModels"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ mc:Ignorable="d" d:DesignWidth="700" d:DesignHeight="550"
+ x:Class="ProxyBridge.GUI.Views.ProxyRulesWindow"
+ x:DataType="vm:ProxyRulesViewModel"
+ x:CompileBindings="True"
+ Title="Process Rules"
+ Icon="/Assets/logo.ico"
+ Width="700" Height="550"
+ MinWidth="600" MinHeight="400"
+ Background="#FF2D2D30"
+ WindowStartupLocation="CenterOwner">
+
+ <Window.Styles>
+ <Style Selector="TextBlock.label">
+ <Setter Property="Foreground" Value="#FFE0E0E0"/>
+ <Setter Property="FontSize" Value="13"/>
+ <Setter Property="FontWeight" Value="Medium"/>
+ </Style>
+
+ <Style Selector="TextBlock.secondary">
+ <Setter Property="Foreground" Value="#FF999999"/>
+ </Style>
+
+ <Style Selector="TextBox">
+ <Setter Property="Background" Value="#FF1E1E1E"/>
+ <Setter Property="Foreground" Value="#FFE0E0E0"/>
+ <Setter Property="BorderBrush" Value="#FF3F3F46"/>
+ <Setter Property="BorderThickness" Value="1"/>
+ <Setter Property="Padding" Value="10,8"/>
+ <Setter Property="FontFamily" Value="Consolas,monospace"/>
+ <Setter Property="FontSize" Value="13"/>
+ </Style>
+
+ <Style Selector="TextBox:focus">
+ <Setter Property="BorderBrush" Value="#FF007ACC"/>
+ </Style>
+
+ <Style Selector="ComboBox">
+ <Setter Property="Background" Value="#FF1E1E1E"/>
+ <Setter Property="Foreground" Value="#FFE0E0E0"/>
+ <Setter Property="BorderBrush" Value="#FF3F3F46"/>
+ <Setter Property="Padding" Value="10,8"/>
+ </Style>
+
+ <Style Selector="ListBox">
+ <Setter Property="Background" Value="#FF252526"/>
+ <Setter Property="BorderBrush" Value="#FF3F3F46"/>
+ </Style>
+
+ <Style Selector="ListBoxItem">
+ <Setter Property="Padding" Value="16,14"/>
+ <Setter Property="Margin" Value="0"/>
+ <Setter Property="MinHeight" Value="68"/>
+ </Style>
+
+ <Style Selector="ListBoxItem:selected /template/ ContentPresenter">
+ <Setter Property="Background" Value="#FF094771"/>
+ </Style>
+
+ <Style Selector="ListBoxItem:pointerover /template/ ContentPresenter">
+ <Setter Property="Background" Value="#FF2A2D2E"/>
+ </Style>
+
+ <Style Selector="CheckBox">
+ <Setter Property="Foreground" Value="#FFE0E0E0"/>
+ </Style>
+
+ <Style Selector="Button">
+ <Setter Property="Background" Value="#FF0E639C"/>
+ <Setter Property="Foreground" Value="White"/>
+ <Setter Property="BorderThickness" Value="0"/>
+ <Setter Property="Padding" Value="16,8"/>
+ <Setter Property="FontSize" Value="13"/>
+ <Setter Property="Cursor" Value="Hand"/>
+ </Style>
+
+ <Style Selector="Button:pointerover">
+ <Setter Property="Background" Value="#FF1177BB"/>
+ </Style>
+
+ <Style Selector="Button.secondary">
+ <Setter Property="Background" Value="#FF3E3E42"/>
+ </Style>
+
+ <Style Selector="Button.secondary:pointerover">
+ <Setter Property="Background" Value="#FF4E4E52"/>
+ </Style>
+ </Window.Styles>
+
+ <DockPanel>
+ <!-- Header -->
+ <Border DockPanel.Dock="Top" Background="#FF1E1E1E" Padding="20,16">
+ <Grid ColumnDefinitions="*,Auto">
+ <StackPanel Orientation="Horizontal" Spacing="10">
+ <TextBlock Text="βš™" FontSize="22" VerticalAlignment="Center"/>
+ <TextBlock Text="Process Rules"
+ FontSize="18"
+ FontWeight="SemiBold"
+ Foreground="#FFE0E0E0"
+ VerticalAlignment="Center"/>
+ </StackPanel>
+ <Button Grid.Column="1"
+ Content="βž• Add Rule"
+ Command="{Binding AddRuleCommand}"/>
+ </Grid>
+ </Border>
+
+ <!-- Rules List View -->
+ <Grid IsVisible="{Binding !IsAddRuleViewOpen}">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="*"/>
+ </Grid.RowDefinitions>
+
+ <!-- Table Header -->
+ <Border Grid.Row="0"
+ Background="#FF1E1E1E"
+ BorderBrush="#FF3F3F46"
+ BorderThickness="0,1,0,1"
+ Padding="20,12">
+ <Grid ColumnDefinitions="100,80,*,200">
+ <TextBlock Grid.Column="0"
+ Text="Enabled"
+ FontSize="13"
+ FontWeight="SemiBold"
+ Foreground="#FFB0B0B0"
+ Margin="0,0,20,0"/>
+ <TextBlock Grid.Column="1"
+ Text="SR"
+ FontSize="13"
+ FontWeight="SemiBold"
+ Foreground="#FFB0B0B0"
+ Margin="0,0,20,0"/>
+ <TextBlock Grid.Column="2"
+ Text="Process Name"
+ FontSize="13"
+ FontWeight="SemiBold"
+ Foreground="#FFB0B0B0"
+ Margin="0,0,20,0"/>
+ <TextBlock Grid.Column="3"
+ Text="Action"
+ FontSize="13"
+ FontWeight="SemiBold"
+ Foreground="#FFB0B0B0"/>
+ </Grid>
+ </Border>
+
+ <!-- Table Body -->
+ <ScrollViewer Grid.Row="1"
+ HorizontalScrollBarVisibility="Disabled"
+ VerticalScrollBarVisibility="Auto">
+ <ItemsControl ItemsSource="{Binding ProxyRules}" x:Name="RulesItemsControl">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Border Background="#FF252526"
+ BorderBrush="#FF3F3F46"
+ BorderThickness="0,0,0,1"
+ Padding="20,16">
+ <Grid ColumnDefinitions="100,80,*,200">
+ <CheckBox Grid.Column="0"
+ IsChecked="{Binding IsEnabled}"
+ VerticalAlignment="Center"
+ Margin="0,0,20,0"/>
+ <TextBlock Grid.Column="1"
+ Text="{Binding Index}"
+ FontSize="14"
+ Foreground="#FF999999"
+ VerticalAlignment="Center"
+ Margin="0,0,20,0"/>
+ <TextBlock Grid.Column="2"
+ Text="{Binding ProcessName}"
+ FontSize="14"
+ FontWeight="Medium"
+ Foreground="#FFE0E0E0"
+ VerticalAlignment="Center"
+ TextTrimming="CharacterEllipsis"
+ Margin="0,0,20,0"/>
+ <TextBlock Grid.Column="3"
+ Text="{Binding Action}"
+ FontSize="14"
+ FontWeight="SemiBold"
+ Foreground="#FF4EC9B0"
+ VerticalAlignment="Center"/>
+ </Grid>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </ScrollViewer>
+ </Grid>
+
+ <!-- Add Rule Form View -->
+ <StackPanel Margin="24,20"
+ Spacing="20"
+ IsVisible="{Binding IsAddRuleViewOpen}">
+ <StackPanel Spacing="6">
+ <TextBlock Text="Process Name" Classes="label"/>
+ <TextBox Text="{Binding NewProcessName}"
+ Watermark="e.g., chrome.exe, firefox.exe"/>
+ <TextBlock Text="{Binding ProcessNameError}"
+ IsVisible="{Binding ProcessNameError, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
+ Foreground="#FFFF6B6B"
+ FontSize="12"
+ Margin="0,4,0,0"/>
+ <TextBlock Text="Enter the application name you want to control (e.g., chrome, firefox.exe, notepad). You can use * to apply the rule to all system traffic."
+ FontSize="11"
+ Foreground="#FF999999"
+ TextWrapping="Wrap"
+ Margin="0,4,0,0"/>
+ </StackPanel>
+
+ <StackPanel Spacing="6">
+ <TextBlock Text="Action" Classes="label"/>
+ <ComboBox SelectedIndex="0"
+ HorizontalAlignment="Stretch"
+ x:Name="ActionComboBox"
+ SelectionChanged="ActionComboBox_SelectionChanged">
+ <ComboBoxItem Content="PROXY" Tag="PROXY"/>
+ <ComboBoxItem Content="DIRECT" Tag="DIRECT"/>
+ <ComboBoxItem Content="BLOCK" Tag="BLOCK"/>
+ </ComboBox>
+ </StackPanel>
+
+ <StackPanel Orientation="Horizontal"
+ HorizontalAlignment="Right"
+ Spacing="12"
+ Margin="0,16,0,0">
+ <Button Content="Cancel"
+ Classes="secondary"
+ Command="{Binding CancelAddRuleCommand}"
+ Width="100"/>
+ <Button Content="Save Rule"
+ Command="{Binding SaveNewRuleCommand}"
+ Width="130"/>
+ </StackPanel>
+ </StackPanel>
+ </DockPanel>
+</Window>
diff --git a/gui/Views/ProxyRulesWindow.axaml.cs b/gui/Views/ProxyRulesWindow.axaml.cs
new file mode 100644
index 0000000..8dee49e
--- /dev/null
+++ b/gui/Views/ProxyRulesWindow.axaml.cs
@@ -0,0 +1,24 @@
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+using ProxyBridge.GUI.ViewModels;
+
+namespace ProxyBridge.GUI.Views;
+
+public partial class ProxyRulesWindow : Window
+{
+ public ProxyRulesWindow()
+ {
+ InitializeComponent();
+ }
+
+ private void ActionComboBox_SelectionChanged(object? sender, SelectionChangedEventArgs e)
+ {
+ if (sender is ComboBox comboBox &&
+ comboBox.SelectedItem is ComboBoxItem item &&
+ item.Tag is string tag &&
+ DataContext is ProxyRulesViewModel vm)
+ {
+ vm.NewProxyAction = tag;
+ }
+ }
+}
\ No newline at end of file
diff --git a/gui/Views/ProxySettingsWindow.axaml b/gui/Views/ProxySettingsWindow.axaml
new file mode 100644
index 0000000..ddbee33
--- /dev/null
+++ b/gui/Views/ProxySettingsWindow.axaml
@@ -0,0 +1,135 @@
+<Window xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:vm="using:ProxyBridge.GUI.ViewModels"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
+ x:Class="ProxyBridge.GUI.Views.ProxySettingsWindow"
+ x:DataType="vm:ProxySettingsViewModel"
+ x:CompileBindings="True"
+ Title="Proxy Settings"
+ Icon="/Assets/logo.ico"
+ Width="500" Height="450"
+ CanResize="False"
+ Background="#FF2D2D30"
+ WindowStartupLocation="CenterOwner">
+
+ <Window.Styles>
+ <Style Selector="TextBlock.label">
+ <Setter Property="Foreground" Value="#FFE0E0E0"/>
+ <Setter Property="FontSize" Value="13"/>
+ <Setter Property="FontWeight" Value="Medium"/>
+ </Style>
+
+ <Style Selector="TextBlock.error">
+ <Setter Property="Foreground" Value="#FFF48771"/>
+ <Setter Property="FontSize" Value="12"/>
+ <Setter Property="Margin" Value="0,4,0,0"/>
+ </Style>
+
+ <Style Selector="TextBox">
+ <Setter Property="Background" Value="#FF1E1E1E"/>
+ <Setter Property="Foreground" Value="#FFE0E0E0"/>
+ <Setter Property="BorderBrush" Value="#FF3F3F46"/>
+ <Setter Property="BorderThickness" Value="1"/>
+ <Setter Property="Padding" Value="10,8"/>
+ <Setter Property="FontFamily" Value="Consolas,monospace"/>
+ <Setter Property="FontSize" Value="13"/>
+ </Style>
+
+ <Style Selector="TextBox:focus">
+ <Setter Property="BorderBrush" Value="#FF007ACC"/>
+ </Style>
+
+ <Style Selector="ComboBox">
+ <Setter Property="Background" Value="#FF1E1E1E"/>
+ <Setter Property="Foreground" Value="#FFE0E0E0"/>
+ <Setter Property="BorderBrush" Value="#FF3F3F46"/>
+ <Setter Property="Padding" Value="10,8"/>
+ </Style>
+
+ <Style Selector="Button">
+ <Setter Property="Background" Value="#FF0E639C"/>
+ <Setter Property="Foreground" Value="White"/>
+ <Setter Property="BorderThickness" Value="0"/>
+ <Setter Property="Padding" Value="16,8"/>
+ <Setter Property="FontSize" Value="13"/>
+ <Setter Property="Cursor" Value="Hand"/>
+ </Style>
+
+ <Style Selector="Button:pointerover">
+ <Setter Property="Background" Value="#FF1177BB"/>
+ </Style>
+
+ <Style Selector="Button.secondary">
+ <Setter Property="Background" Value="#FF3E3E42"/>
+ </Style>
+
+ <Style Selector="Button.secondary:pointerover">
+ <Setter Property="Background" Value="#FF4E4E52"/>
+ </Style>
+ </Window.Styles>
+
+ <DockPanel>
+ <!-- Header -->
+ <Border DockPanel.Dock="Top" Background="#FF1E1E1E" Padding="20,16">
+ <StackPanel Orientation="Horizontal" Spacing="10">
+ <TextBlock Text="πŸ”§" FontSize="22" VerticalAlignment="Center"/>
+ <TextBlock Text="Proxy Settings"
+ FontSize="18"
+ FontWeight="SemiBold"
+ Foreground="#FFE0E0E0"
+ VerticalAlignment="Center"/>
+ </StackPanel>
+ </Border>
+
+ <!-- Settings Form -->
+ <StackPanel Margin="24,20" Spacing="20">
+ <StackPanel Spacing="6">
+ <TextBlock Text="Proxy Type" Classes="label"/>
+ <ComboBox SelectedIndex="0"
+ HorizontalAlignment="Stretch"
+ x:Name="ProxyTypeComboBox">
+ <ComboBoxItem Content="SOCKS5" Tag="SOCKS5"/>
+ <ComboBoxItem Content="HTTP" Tag="HTTP"/>
+ </ComboBox>
+ </StackPanel>
+
+ <StackPanel Spacing="6">
+ <TextBlock Text="Proxy IP Address *" Classes="label"/>
+ <TextBox Text="{Binding ProxyIp}"
+ Watermark="e.g., 127.0.0.1"/>
+ <TextBlock Text="{Binding IpError}"
+ Classes="error"
+ IsVisible="{Binding IpError, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
+ </StackPanel>
+
+ <StackPanel Spacing="6">
+ <TextBlock Text="Proxy Port *" Classes="label"/>
+ <TextBox Text="{Binding ProxyPort}"
+ Watermark="e.g., 1080"/>
+ <TextBlock Text="{Binding PortError}"
+ Classes="error"
+ IsVisible="{Binding PortError, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
+ </StackPanel>
+
+ <TextBlock Text="* Required fields"
+ Foreground="#FF999999"
+ FontSize="12"
+ Margin="0,8,0,0"/>
+
+ <StackPanel Orientation="Horizontal"
+ HorizontalAlignment="Right"
+ Spacing="12"
+ Margin="0,16,0,0">
+ <Button Content="Cancel"
+ Classes="secondary"
+ Command="{Binding CancelCommand}"
+ Width="100"/>
+ <Button Content="Save Changes"
+ Command="{Binding SaveCommand}"
+ Width="130"/>
+ </StackPanel>
+ </StackPanel>
+ </DockPanel>
+</Window>
diff --git a/gui/Views/ProxySettingsWindow.axaml.cs b/gui/Views/ProxySettingsWindow.axaml.cs
new file mode 100644
index 0000000..dab3386
--- /dev/null
+++ b/gui/Views/ProxySettingsWindow.axaml.cs
@@ -0,0 +1,38 @@
+using Avalonia.Controls;
+using ProxyBridge.GUI.ViewModels;
+
+namespace ProxyBridge.GUI.Views;
+
+public partial class ProxySettingsWindow : Window
+{
+ public ProxySettingsWindow()
+ {
+ InitializeComponent();
+
+ // Handle save with proper ProxyType value
+ this.Opened += (s, e) =>
+ {
+ if (DataContext is ProxySettingsViewModel vm)
+ {
+ var originalSave = vm.SaveCommand;
+
+ // Override to get the actual selected type
+ this.FindControl<ComboBox>("ProxyTypeComboBox")!.SelectionChanged += (_, __) =>
+ {
+ var combo = this.FindControl<ComboBox>("ProxyTypeComboBox");
+ if (combo?.SelectedItem is ComboBoxItem item && item.Tag is string tag)
+ {
+ vm.ProxyType = tag;
+ }
+ };
+
+ // Set initial value
+ var comboBox = this.FindControl<ComboBox>("ProxyTypeComboBox");
+ if (comboBox?.SelectedItem is ComboBoxItem initialItem && initialItem.Tag is string initialTag)
+ {
+ vm.ProxyType = initialTag;
+ }
+ }
+ };
+ }
+}
diff --git a/gui/app.manifest b/gui/app.manifest
new file mode 100644
index 0000000..e87797c
--- /dev/null
+++ b/gui/app.manifest
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity
+ version="1.1.0.0"
+ processorArchitecture="*"
+ name="ProxyBridge"
+ type="win32"
+ />
+ <description>ProxyBridge - Network Traffic Proxy Control</description>
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <!-- Windows 10 and Windows 11 -->
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+ </application>
+ </compatibility>
+</assembly>
diff --git a/img/logo.png b/img/logo.png
index b5888f0..a85556d 100644
Binary files a/img/logo.png and b/img/logo.png differ