Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Avalonia 11 #74

Merged
merged 26 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
63cb4ce
Update nugets
chkr1011 Nov 9, 2022
a202e96
Merge branch 'main' into update-avalonia
chkr1011 Jun 3, 2023
177ec57
Upgrade style to new avalonia version
chkr1011 Jun 15, 2023
97e8aa1
Remove not needed libraries
chkr1011 Jun 25, 2023
18b6c7c
Merge branch 'main' into update-avalonia
chkr1011 Jul 2, 2023
bd520ef
Update mqttMultimeter.csproj
chkr1011 Jul 2, 2023
6a0a1a5
Fix breaking changes
chkr1011 Jul 22, 2023
5a3e84d
Update nugets
chkr1011 Jul 29, 2023
c6ec144
Update mqttMultimeter.csproj
chkr1011 Aug 13, 2023
5577e4d
Update mqttMultimeter.csproj
chkr1011 Nov 1, 2023
70e5c83
Fix default null values
chkr1011 Nov 1, 2023
9577dea
Merge branch 'main' into update-avalonia
chkr1011 Feb 17, 2024
56fcace
Convert obsolete method to supported one.
chkr1011 Feb 17, 2024
c9a9ff7
Refactor code.
chkr1011 Feb 17, 2024
079efa2
Merge branch 'main' into update-avalonia
chkr1011 Feb 18, 2024
aa1dc01
Fix icon size in packet inspector.
chkr1011 Feb 18, 2024
47f62fc
Change default fonts to get around Avalonia bug.
chkr1011 Feb 18, 2024
b6199ef
Improve user properties view.
chkr1011 Feb 18, 2024
6e02418
Support monospace font in Ubuntu.
chkr1011 Feb 18, 2024
d548925
Update project file.
chkr1011 Feb 18, 2024
3ffc38d
Improve error box layout.
chkr1011 Feb 18, 2024
17b17e3
Update nugets.
chkr1011 Feb 18, 2024
03810c3
Exclude files from bin directory in release mode.
chkr1011 Feb 18, 2024
ede5c0e
Fix typos.
chkr1011 Feb 18, 2024
6fe31c2
Fix margins and font in server page.
chkr1011 Feb 18, 2024
ff79012
Fix hex box
chkr1011 Feb 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Source/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
<ResourceInclude Source="/Assets/VectorIcons.axaml" />
</ResourceDictionary.MergedDictionaries>

<!--
Monospace fonts per OS:
- Linux = Ubuntu Mono
- Windows = Lucida Console
- macOS = SF Mono
- Fallback = Courier New
-->
<FontFamily x:Key="MonospaceFontFamily">Ubuntu Mono,Lucida Console,SF Mono,Courier New</FontFamily>

<SolidColorBrush x:Key="AppLightGreen">#2200EE00</SolidColorBrush>

<system:Double x:Key="ControlContentThemeFontSize">12</system:Double>
Expand All @@ -18,9 +27,9 @@
</ResourceDictionary>
</Application.Resources>
<Application.Styles>
<FluentTheme Mode="Dark" />
<StyleInclude Source="avares://AvaloniaEdit/AvaloniaEdit.xaml" />

<FluentTheme />
<StyleInclude Source="avares://AvaloniaEdit/Themes/Fluent/AvaloniaEdit.xaml" />
<StyleInclude Source="/Styles/GridSplitter.axaml" />
<StyleInclude Source="/Styles/Badges.axaml" />
<StyleInclude Source="/Styles/Button.axaml" />
Expand Down
3 changes: 3 additions & 0 deletions Source/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using Avalonia.Styling;
using Microsoft.Extensions.DependencyInjection;
using mqttMultimeter.Common;
using mqttMultimeter.Controls;
Expand Down Expand Up @@ -64,6 +65,8 @@ public override void Initialize()

public override void OnFrameworkInitializationCompleted()
{
Current!.RequestedThemeVariant = ThemeVariant.Dark;

if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
var mainWindow = new MainWindow
Expand Down
3 changes: 3 additions & 0 deletions Source/Assets/VectorIcons.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,7 @@
<StreamGeometry x:Key="text_wrap_regular">M2.75 5C2.33579 5 2 5.33579 2 5.75C2 6.16421 2.33579 6.5 2.75 6.5H21.25C21.6642 6.5 22 6.16421 22 5.75C22 5.33579 21.6642 5 21.25 5H2.75Z M2.75 11.5C2.33579 11.5 2 11.8358 2 12.25C2 12.6642 2.33579 13 2.75 13H19C20.3807 13 21.5 14.1193 21.5 15.5C21.5 16.8807 20.3807 18 19 18H14.5607L15.2803 17.2803C15.5732 16.9874 15.5732 16.5126 15.2803 16.2197C14.9874 15.9268 14.5126 15.9268 14.2197 16.2197L12.2197 18.2197C11.9268 18.5126 11.9268 18.9874 12.2197 19.2803L14.2197 21.2803C14.5126 21.5732 14.9874 21.5732 15.2803 21.2803C15.5732 20.9874 15.5732 20.5126 15.2803 20.2197L14.5607 19.5H19C21.2091 19.5 23 17.7091 23 15.5C23 13.2909 21.2091 11.5 19 11.5H2.75Z M2 18.75C2 18.3358 2.33579 18 2.75 18H9.25C9.66421 18 10 18.3358 10 18.75C10 19.1642 9.66421 19.5 9.25 19.5H2.75C2.33579 19.5 2 19.1642 2 18.75Z</StreamGeometry>

<StreamGeometry x:Key="warning_regular">M10.9093922,2.78216375 C11.9491636,2.20625071 13.2471955,2.54089334 13.8850247,3.52240345 L13.9678229,3.66023048 L21.7267791,17.6684928 C21.9115773,18.0021332 22.0085303,18.3772743 22.0085303,18.7586748 C22.0085303,19.9495388 21.0833687,20.9243197 19.9125791,21.003484 L19.7585303,21.0086748 L4.24277801,21.0086748 C3.86146742,21.0086748 3.48641186,20.9117674 3.15282824,20.7270522 C2.11298886,20.1512618 1.7079483,18.8734454 2.20150311,17.8120352 L2.27440063,17.668725 L10.0311968,3.66046274 C10.2357246,3.291099 10.5400526,2.98673515 10.9093922,2.78216375 Z M20.4146132,18.3952808 L12.6556571,4.3870185 C12.4549601,4.02467391 11.9985248,3.89363262 11.6361802,4.09432959 C11.5438453,4.14547244 11.4637001,4.21532637 11.4006367,4.29899869 L11.3434484,4.38709592 L3.58665221,18.3953582 C3.385998,18.7577265 3.51709315,19.2141464 3.87946142,19.4148006 C3.96285732,19.4609794 4.05402922,19.4906942 4.14802472,19.5026655 L4.24277801,19.5086748 L19.7585303,19.5086748 C20.1727439,19.5086748 20.5085303,19.1728883 20.5085303,18.7586748 C20.5085303,18.6633247 20.4903516,18.5691482 20.455275,18.4811011 L20.4146132,18.3952808 L12.6556571,4.3870185 L20.4146132,18.3952808 Z M12.0004478,16.0017852 C12.5519939,16.0017852 12.9991104,16.4489016 12.9991104,17.0004478 C12.9991104,17.5519939 12.5519939,17.9991104 12.0004478,17.9991104 C11.4489016,17.9991104 11.0017852,17.5519939 11.0017852,17.0004478 C11.0017852,16.4489016 11.4489016,16.0017852 12.0004478,16.0017852 Z M11.9962476,8.49954934 C12.3759432,8.49924613 12.689964,8.78114897 12.7399193,9.14718469 L12.7468472,9.24894974 L12.750448,13.7505438 C12.7507788,14.1647572 12.4152611,14.5008121 12.0010476,14.5011439 C11.621352,14.5014471 11.3073312,14.2195442 11.257376,13.8535085 L11.250448,13.7517435 L11.2468472,9.25014944 C11.2465164,8.83593601 11.5820341,8.49988112 11.9962476,8.49954934 Z</StreamGeometry>

<StreamGeometry x:Key="zoom_out_regular">M10,2.75 C14.0041,2.75 17.25,5.99594 17.25,10 C17.25,11.6236562 16.7162402,13.1225957 15.8146692,14.3310347 L15.6295,14.5688 L20.5303,19.4697 C20.8232,19.7626 20.8232,20.2374 20.5303,20.5303 C20.2936778,20.7670111 19.938142,20.8124333 19.6558506,20.6665667 L19.5538,20.6029 L19.4697,20.5303 L14.5688,15.6295 C13.3219,16.6427 11.7319,17.25 10,17.25 C5.99593,17.25 2.75,14.0041 2.75,10 C2.75,5.99594 5.99593,2.75 10,2.75 Z M10,4.25 C6.82436,4.25 4.25,6.82436 4.25,10 C4.25,13.1756 6.82436,15.75 10,15.75 C13.1756,15.75 15.75,13.1756 15.75,10 C15.75,6.82436 13.1756,4.25 10,4.25 Z M12.75,9.25 C13.1642,9.25 13.5,9.58579 13.5,10 C13.5,10.4142 13.1642,10.75 12.75,10.75 L7.25,10.75 C6.83578,10.75 6.5,10.4142 6.5,10 C6.5,9.58579 6.83578,9.25 7.25,9.25 L12.75,9.25 Z</StreamGeometry>
<StreamGeometry x:Key="zoom_in_regular">M10,2.75 C14.0041,2.75 17.25,5.99594 17.25,10 C17.25,11.7319 16.6427,13.3219 15.6295,14.5688 L20.5303,19.4697 C20.8232,19.7626 20.8232,20.2374 20.5303,20.5303 C20.2641,20.7966 19.8474,20.8208 19.5538,20.6029 L19.4697,20.5303 L14.5688,15.6295 C13.3219,16.6427 11.7319,17.25 10,17.25 C5.99593,17.25 2.75,14.0041 2.75,10 C2.75,5.99594 5.99593,2.75 10,2.75 Z M10,4.25 C6.82436,4.25 4.25,6.82436 4.25,10 C4.25,13.1756 6.82436,15.75 10,15.75 C13.1756,15.75 15.75,13.1756 15.75,10 C15.75,6.82436 13.1756,4.25 10,4.25 Z M10,6.5 C10.3796833,6.5 10.6934889,6.78215687 10.7431531,7.14823019 L10.75,7.25 L10.75,9.25 L12.75,9.25 C13.1642,9.25 13.5,9.58579 13.5,10 C13.5,10.3796833 13.2178347,10.6934889 12.8517677,10.7431531 L12.75,10.75 L10.75,10.75 L10.75,12.75 C10.75,13.1642 10.4142,13.5 10,13.5 C9.62029833,13.5 9.30650806,13.2178347 9.25684649,12.8517677 L9.25,12.75 L9.25,10.75 L7.25,10.75 C6.83578,10.75 6.5,10.4142 6.5,10 C6.5,9.6203075 6.78214847,9.30650958 7.14822809,9.25684668 L7.25,9.25 L9.25,9.25 L9.25,7.25 C9.25,6.83579 9.58578,6.5 10,6.5 Z</StreamGeometry>
</ResourceDictionary>
9 changes: 7 additions & 2 deletions Source/Common/ViewLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ sealed class ViewLocator : IDataTemplate
{
readonly Dictionary<string, Type> _viewTypeCache = new();

public IControl Build(object viewModel)
public Control Build(object? viewModel)
{
if (viewModel == null)
{
return new TextBlock();
}

var viewModelTypeName = viewModel.GetType().FullName!;

if (!_viewTypeCache.TryGetValue(viewModelTypeName, out var viewType))
Expand Down Expand Up @@ -43,7 +48,7 @@ public IControl Build(object viewModel)
};
}

public bool Match(object data)
public bool Match(object? data)
{
return data is BaseViewModel;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Controls/AutoGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static void SetIsNextRow(AvaloniaObject element, bool value)
element.SetValue(IsNextRowProperty, value);
}

protected override void ChildrenChanged(object sender, NotifyCollectionChangedEventArgs e)
protected override void ChildrenChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
base.ChildrenChanged(sender, e);

Expand Down
57 changes: 32 additions & 25 deletions Source/Controls/BufferEditor/BufferEditor.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,12 @@
<ControlTemplate TargetType="{x:Type controls:BufferEditor}">
<Border BorderThickness="{DynamicResource TextControlBorderThemeThickness}"
Background="{DynamicResource TextControlBackground}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid RowDefinitions="Auto,*">

<!-- The tool bar. -->
<Grid Grid.Row="0"
Classes="tool_bar">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
Classes="tool_bar"
ColumnDefinitions="Auto,*,Auto">

<!-- The buttons -->
<StackPanel Orientation="Horizontal">
Expand All @@ -47,38 +39,53 @@
<PathIcon Data="{StaticResource text_wrap_regular}"
ToolTip.Tip="Toggle word wrap" />
</ToggleButton>

<Separator Classes="tool_bar_separator" />


<!-- The Reformat button -->
<Button Classes="tool_bar_button"
x:Name="ReformatButton">
<PathIcon Data="{StaticResource code_regular}"
ToolTip.Tip="Reformat" />
</Button>

<!-- The Copy button -->
<Button Classes="tool_bar_button"
x:Name="CopyToClipboardButton">
<PathIcon Data="{StaticResource copy_regular}"
ToolTip.Tip="Copy to clipboard" />
</Button>

<!-- The Save button -->
<Button Classes="tool_bar_button"
x:Name="SaveToFileButton">
<PathIcon Data="{StaticResource save_regular}"
ToolTip.Tip="Save to file" />
</Button>

<Separator Classes="tool_bar_separator" />

<!-- The open button -->
<Button Classes="tool_bar_button"
x:Name="LoadFromFileButton"
ToolTip.Tip="Load from file">
<PathIcon Data="{StaticResource folder_open_regular}" />
</Button>

<!-- The Save button -->
<Button Classes="tool_bar_button"
x:Name="SaveToFileButton">
<PathIcon Data="{StaticResource save_regular}"
ToolTip.Tip="Save to file" />
</Button>

<Separator Classes="tool_bar_separator" />

<!-- The Reformat button -->
<!-- The zoom in button -->
<Button Classes="tool_bar_button"
x:Name="ReformatButton">
<PathIcon Data="{StaticResource code_regular}"
ToolTip.Tip="Reformat" />
x:Name="IncreaseFontSizeButton">
<PathIcon Data="{StaticResource zoom_in_regular}"
ToolTip.Tip="Increase font size" />
</Button>

<!-- The zoom out button -->
<Button Classes="tool_bar_button"
x:Name="DecreaseFontSizeButton">
<PathIcon Data="{StaticResource zoom_out_regular}"
ToolTip.Tip="Decrease font size" />
</Button>

</StackPanel>

<!-- The format -->
Expand Down
Loading
Loading