Skip to content

Commit

Permalink
Add icon and fix order of local and remote hosts/ports
Browse files Browse the repository at this point in the history
  • Loading branch information
DcZipPL committed Apr 19, 2024
1 parent 8c5b485 commit 146806a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Binary file added Tonneru/Assets/tunnel.ico
Binary file not shown.
1 change: 1 addition & 0 deletions Tonneru/Tonneru.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<!--Avalonia doesen't support TrimMode=link currently,but we are working on that https://github.com/AvaloniaUI/Avalonia/issues/6892 -->
<TrimMode>copyused</TrimMode>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationIcon>Assets\tunnel.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\**"/>
Expand Down
6 changes: 3 additions & 3 deletions Tonneru/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public MainWindowViewModel()
this.Port = model.Ssh!.Port;
this.Username = model.Ssh!.Username;
this.Password = model.Ssh!.Password;
this.BoundHost = model.Tunnel!.LocalHost;
this.LocalHost = model.Tunnel!.LocalHost;
this.RemoteHost = model.Tunnel!.RemoteHost;
this.LocalPort = model.Tunnel!.LocalPort;
this.RemotePort = model.Tunnel!.RemotePort;
Expand Down Expand Up @@ -155,7 +155,7 @@ public void CreateClient()
{
client = new SshClient(Host, (ushort)Port, Username, Password);
client.ErrorOccurred += OnError;
portForwarder = new ForwardedPortRemote(BoundHost, (ushort)LocalPort, RemoteHost, (ushort)RemotePort);
portForwarder = new ForwardedPortRemote(RemoteHost, (ushort)RemotePort, LocalHost, (ushort)LocalPort);
}

public void Connect()
Expand Down Expand Up @@ -272,7 +272,7 @@ public string Password
set => this.RaiseAndSetIfChanged(ref _password, value);
}

public string BoundHost
public string LocalHost
{
get => _boundHost;
set => this.RaiseAndSetIfChanged(ref _boundHost, value);
Expand Down
10 changes: 5 additions & 5 deletions Tonneru/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="180"
x:Class="Tonneru.Views.MainWindow"
Icon="/Assets/avalonia-logo.ico"
Icon="/Assets/tunnel.ico"
Title="Tonneru" Width="{Binding Width}" Height="{Binding Height}" MaxHeight="400" MinHeight="80">

<Design.DataContext>
Expand All @@ -26,9 +26,9 @@
</StackPanel>
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="24, 0" Grid.Column="1" Spacing="12">
<StackPanel Orientation="Horizontal" Spacing="8" VerticalAlignment="Center">
<TextBlock Text="{Binding RemotePort}"/>
<TextBlock>-></TextBlock>
<TextBlock Text="{Binding LocalPort}"/>
<TextBlock>-></TextBlock>
<TextBlock Text="{Binding RemotePort}"/>
</StackPanel>
<Button Content="{Binding ConnectText}" Command="{Binding TryConnectCommand}"/>
<Button FontFamily="{StaticResource Lucide}" Command="{Binding ToggleEditCommand}"></Button>
Expand Down Expand Up @@ -81,12 +81,12 @@
<RowDefinition/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0">
Bound Host
Local Host
</Label>
<Label Grid.Row="0" Grid.Column="1" Margin="12,0,0,0">
Local Port
</Label>
<TextBox Grid.Row="1" Grid.Column="0" Text="{Binding BoundHost}" IsEnabled="{Binding CanEdit}" VerticalAlignment="Top"/>
<TextBox Grid.Row="1" Grid.Column="0" Text="{Binding LocalHost}" IsEnabled="{Binding CanEdit}" VerticalAlignment="Top"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding LocalPort}" Margin="12,0,0,0" Width="96" IsEnabled="{Binding CanEdit}" KeyDown="HandlePortInput"/>
</Grid>
<Grid>
Expand Down

0 comments on commit 146806a

Please sign in to comment.