Skip to content

Commit 7c495ed

Browse files
committed
Fixed UI view while switch between languages
1 parent cc6313c commit 7c495ed

4 files changed

Lines changed: 36 additions & 12 deletions

File tree

app/Wissance.Zerial/Wissance.Zerial.Desktop/ViewModels/MainWindowViewModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,8 @@ public async Task ExecuteLanguageSetAsync(object languageItem)
402402
UpdateSelectedOptions(serialDevice);
403403
if (serialDevice == null)
404404
serialDevice = new SerialDeviceModel();
405+
ConnectButtonText = serialDevice.Connected ? Localizer.Get(ConnectButtonDisconnectTextKey) : Localizer.Get(ConnectButtonConnectTextKey);
406+
this.RaisePropertyChanged(nameof(ConnectButtonText));
405407
UpdateStatusbar(serialDevice);
406408
ReLoadDeviceConfigs();
407409
}

app/Wissance.Zerial/Wissance.Zerial.Desktop/Views/MainWindow.axaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
Resized="OnWindowResized"
1414
Title="{l:Localize Zerial_Main_Title}"
1515
Closing="OnWindowClose"
16-
Height="660" Width="880" MinHeight="660" MinWidth="880">
16+
Height="660" Width="940" MinHeight="660" MinWidth="940">
1717

1818
<Design.DataContext>
1919
<!-- This only sets the DataContext for the previewer in an IDE,
@@ -79,9 +79,9 @@
7979
<!-- RS232 Settings selection: Byte Length && Stop Bits -->
8080
<StackPanel Orientation="Vertical" Margin="0, 0,0,0" Name="SerialDeviceByteLengthAndStopBitsOptionsPanel">
8181
<Border Classes="ConnOptGroupBorder" Margin="2 0 0 0">
82-
<StackPanel>
82+
<StackPanel MinWidth="200">
8383
<StackPanel Orientation="Horizontal" Margin="10" HorizontalAlignment="Right"
84-
VerticalAlignment="Bottom" >
84+
VerticalAlignment="Bottom">
8585
<Label Name="ByteLengthLabel" Classes="ConnOptLabel" VerticalAlignment="Center" Content="{l:Localize Zerial_Byte_Length_Label}"/>
8686
<ComboBox Name="ByteLengthList" ItemsSource="{Binding Path=SerialOptions.ByteLengthOptions}"
8787
SelectedItem="{Binding SelectedByteLength}"
@@ -99,7 +99,8 @@
9999
<!-- RS232 Settings selection: Parity && Flow Control -->
100100
<StackPanel>
101101
<Border Classes="ConnOptGroupBorder" Margin="2 0 0 0">
102-
<StackPanel Orientation="Horizontal" Margin="0, 0,0,0" Name="SerialDeviceParityAndFlowControlOptionsPanel">
102+
<StackPanel Orientation="Horizontal" Margin="0, 0,0,0" Name="SerialDeviceParityAndFlowControlOptionsPanel"
103+
MinWidth="320">
103104
<StackPanel Orientation="Vertical">
104105
<StackPanel Orientation="Horizontal" Margin="10" HorizontalAlignment="Right" VerticalAlignment="Top">
105106
<Label Name="ParityLabel" Classes="ConnOptLabel" VerticalAlignment="Center" Content="{l:Localize Zerial_Parity_Label}"/>
@@ -129,7 +130,7 @@
129130
<!-- Connect && Disconnect button -->
130131
<StackPanel Orientation="Horizontal" Margin="0, 0,0,0" Name="SerialDeviceBtnConnOptionsPanel">
131132
<Border Classes="ConnOptGroupBorder" Margin="2 0 0 0">
132-
<StackPanel Orientation="Vertical" Margin="10" Width="100" Name="SerialDeviceBtnConnOptionsBtnContainerPanel">
133+
<StackPanel Orientation="Vertical" Margin="10" MinWidth="132" Name="SerialDeviceBtnConnOptionsBtnContainerPanel">
133134
<StackPanel HorizontalAlignment="Center">
134135
<Button Width = "100" HorizontalContentAlignment="Center"
135136
HorizontalAlignment="Stretch"
@@ -165,7 +166,7 @@
165166
</TreeView>
166167
</StackPanel>
167168
</Border>
168-
<Border Classes="ConnOptGroupBorder" Margin="2 0 0 0">
169+
<Border Classes="ConnOptGroupBorder" Margin="2 0 0 0" >
169170
<StackPanel Orientation="Vertical" Width="633" Name="TextEditorContainerPanel">
170171
<StackPanel Margin="10" Orientation="Horizontal" >
171172
<AvalonEdit:TextEditor Name="SerialDevicesMessageViewer" FontFamily="Cascadia Code,Consolas,Menlo,Monospace"

app/Wissance.Zerial/Wissance.Zerial.Desktop/Views/MainWindow.axaml.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
using System;
22
using System.Collections;
33
using System.Collections.Generic;
4+
using System.ComponentModel;
45
using System.Linq;
56
using System.Text;
7+
using Avalonia;
68
using Avalonia.Controls;
79
using Avalonia.Input;
810
using Avalonia.Interactivity;
11+
using Avalonia.Layout;
912
using Avalonia.Media;
1013
using AvaloniaEdit;
1114
using AvaloniaEdit.Document;
@@ -57,6 +60,24 @@ private void OnTreeItemTapped(object? sender, TappedEventArgs e)
5760
ExecuteUpdate(sender as TextBlock);
5861
}
5962

63+
/*private void OnConnectButtonTextChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
64+
{
65+
if (SerialDeviceBtnConnOptionsPanel != null && TextEditorContainerPanel != null)
66+
{
67+
// Set equal resize by edit Right as Width - Margin
68+
if (SerialDeviceBtnConnOptionsPanel.Bounds != null && SerialDeviceBtnConnOptionsPanel.Bounds.Right > 0)
69+
{
70+
double newWidth = Width - 20 - SerialDeviceBtnConnOptionsPanel.Bounds.Left;
71+
SerialDeviceBtnConnOptionsPanel.Width = newWidth;
72+
SerialDeviceBtnConnOptionsPanel.
73+
}
74+
// double newWidth = SerialDeviceBtnConnOptionsPanel.Bounds.Right - TextEditorContainerPanel.Bounds.Left;
75+
// double newWidth = TextEditorContainerPanel.Bounds.Right - SerialDeviceBtnConnOptionsPanel.Bounds.Left;
76+
// SerialDeviceBtnConnOptionsPanel.Width = newWidth;
77+
// TextEditorContainerPanel.Width = newWidth;
78+
}
79+
}*/
80+
6081
private void OnTreeItemPointerPressed(object? sender, PointerPressedEventArgs e)
6182
{
6283
ExecuteUpdate(sender as TextBlock);

app/Wissance.Zerial/Wissance.Zerial.Desktop/Wissance.Zerial.Desktop.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525

2626

2727
<ItemGroup>
28-
<PackageReference Include="Avalonia" Version="11.0.2"/>
29-
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.0.1" />
30-
<PackageReference Include="Avalonia.Desktop" Version="11.0.2"/>
28+
<PackageReference Include="Avalonia" Version="11.3.14" />
29+
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.4.1" />
30+
<PackageReference Include="Avalonia.Desktop" Version="11.3.14" />
3131
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.2"/>
32-
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.2"/>
32+
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.14" />
3333
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
34-
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.2"/>
35-
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.2"/>
34+
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.14" />
35+
<PackageReference Include="Avalonia.ReactiveUI" Version="11.3.8" />
3636
<PackageReference Include="Jeek.Avalonia.Localization" Version="1.3.1" />
3737
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
3838
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />

0 commit comments

Comments
 (0)