Skip to content

Commit

Permalink
Update Avalonia UI to 11.2 (#102)
Browse files Browse the repository at this point in the history
* Update nugets

* Fix breaking changes
  • Loading branch information
chkr1011 authored Nov 9, 2024
1 parent b3411f9 commit 1393f3f
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Source/Pages/Connection/ConnectResponseViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using mqttMultimeter.Common;
using mqttMultimeter.Controls;
using MQTTnet.Client;
using MQTTnet;
using ReactiveUI;

namespace mqttMultimeter.Pages.Connection;
Expand Down
7 changes: 4 additions & 3 deletions Source/Pages/Inflight/Export/InflightPageItemExportService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Buffers;
using System.Collections.Generic;
using System.IO;
using System.Text;
Expand Down Expand Up @@ -111,13 +112,13 @@ static InflightPageExportMessage CreateMessageModel(MqttApplicationMessage messa
Payload = null // Will be set later!
};

if (message.PayloadSegment.Count > 0)
if (message.Payload.Length > 0)
{
exportMessage.Payload = message.PayloadSegment.ToArray();
exportMessage.Payload = message.Payload.ToArray();
}
else
{
exportMessage.Payload = Array.Empty<byte>();
exportMessage.Payload = [];
}

return exportMessage;
Expand Down
5 changes: 3 additions & 2 deletions Source/Pages/Inflight/InflightPageItemViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Buffers;
using System.Collections.Generic;
using mqttMultimeter.Controls;
using MQTTnet;
Expand All @@ -12,9 +13,9 @@ public InflightPageItemViewModel(MqttApplicationMessage message)
{
Message = message ?? throw new ArgumentNullException(nameof(message));

if (message.PayloadSegment.Count > 0)
if (message.Payload.Length > 0)
{
Payload = message.PayloadSegment.ToArray();
Payload = message.Payload.ToArray();
}
else
{
Expand Down
1 change: 0 additions & 1 deletion Source/Pages/Inflight/InflightPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using mqttMultimeter.Pages.Inflight.Export;
using mqttMultimeter.Services.Mqtt;
using MQTTnet;
using MQTTnet.Client;
using ReactiveUI;

namespace mqttMultimeter.Pages.Inflight;
Expand Down
2 changes: 1 addition & 1 deletion Source/Pages/Info/InfoPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Avalonia.Threading;
using mqttMultimeter.Common;
using mqttMultimeter.Services.Updates;
using MQTTnet.Client;
using MQTTnet;
using ReactiveUI;

namespace mqttMultimeter.Pages.Info;
Expand Down
2 changes: 1 addition & 1 deletion Source/Pages/Log/LogPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Avalonia.Threading;
using mqttMultimeter.Common;
using mqttMultimeter.Services.Mqtt;
using MQTTnet.Diagnostics;
using MQTTnet.Diagnostics.Logger;
using ReactiveUI;

namespace mqttMultimeter.Pages.Log;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Avalonia.Threading;
using mqttMultimeter.Common;
using mqttMultimeter.Services.Mqtt;
using MQTTnet.Diagnostics;
using MQTTnet.Diagnostics.PacketInspection;
using ReactiveUI;

namespace mqttMultimeter.Pages.PacketInspector;
Expand Down
2 changes: 1 addition & 1 deletion Source/Pages/Publish/PublishResponseViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using mqttMultimeter.Common;
using mqttMultimeter.Controls;
using MQTTnet.Client;
using MQTTnet;
using ReactiveUI;

namespace mqttMultimeter.Pages.Publish;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Linq;
using mqttMultimeter.Common;
using mqttMultimeter.Controls;
using MQTTnet.Client;
using MQTTnet;
using ReactiveUI;

namespace mqttMultimeter.Pages.Subscriptions;
Expand Down
11 changes: 6 additions & 5 deletions Source/Pages/TopicExplorer/TopicExplorerItemMessageViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Buffers;
using System.Text;
using mqttMultimeter.Common;
using mqttMultimeter.Pages.Inflight;
Expand All @@ -16,8 +17,8 @@ public TopicExplorerItemMessageViewModel(DateTime timestamp, MqttApplicationMess
}

Timestamp = timestamp;
PayloadPreview = GeneratePayloadPreview(applicationMessage.PayloadSegment);
PayloadLength = applicationMessage.PayloadSegment.Count;
PayloadPreview = GeneratePayloadPreview(applicationMessage.Payload);
PayloadLength = applicationMessage.Payload.Length;
Retain = applicationMessage.Retain;

Delay = delay;
Expand All @@ -28,17 +29,17 @@ public TopicExplorerItemMessageViewModel(DateTime timestamp, MqttApplicationMess

public InflightPageItemViewModel InflightItem { get; init; }

public int PayloadLength { get; }
public long PayloadLength { get; }

public string PayloadPreview { get; }

public bool Retain { get; }

public DateTime Timestamp { get; }

static string GeneratePayloadPreview(ArraySegment<byte> payload)
static string GeneratePayloadPreview(ReadOnlySequence<byte> payload)
{
if (payload.Count == 0)
if (payload.Length == 0)
{
return string.Empty;
}
Expand Down
10 changes: 5 additions & 5 deletions Source/Pages/TopicExplorer/TopicExplorerItemViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ namespace mqttMultimeter.Pages.TopicExplorer;
public sealed class TopicExplorerItemViewModel : BaseViewModel
{
readonly TopicExplorerPageViewModel _ownerPage;
int _currentPayloadLength;

long _currentPayloadLength;
string? _currentPayloadPreview;
bool _hasPayload;
DateTime? _lastUpdateTimestamp;
TopicExplorerItemMessageViewModel? _selectedMessage;
int _totalPayloadLength;
long _totalPayloadLength;
bool _trackLatestMessage;

public TopicExplorerItemViewModel(TopicExplorerPageViewModel ownerPage)
Expand All @@ -28,7 +28,7 @@ public TopicExplorerItemViewModel(TopicExplorerPageViewModel ownerPage)
Messages.CollectionChanged += OnMessagesChanged;
}

public int CurrentPayloadLength
public long CurrentPayloadLength
{
get => _currentPayloadLength;
private set => this.RaiseAndSetIfChanged(ref _currentPayloadLength, value);
Expand Down Expand Up @@ -64,7 +64,7 @@ public TopicExplorerItemMessageViewModel? SelectedMessage
set => this.RaiseAndSetIfChanged(ref _selectedMessage, value);
}

public int TotalPayloadLength
public long TotalPayloadLength
{
get => _totalPayloadLength;
private set => this.RaiseAndSetIfChanged(ref _totalPayloadLength, value);
Expand Down Expand Up @@ -92,7 +92,7 @@ public void AddMessage(MqttApplicationMessage message)

var timestamp = DateTime.Now;

TotalPayloadLength += message.PayloadSegment.Count;
TotalPayloadLength += message.Payload.Length;
LastUpdateTimestamp = timestamp;

var duration = TimeSpan.Zero;
Expand Down
1 change: 0 additions & 1 deletion Source/Pages/TopicExplorer/TopicExplorerPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using mqttMultimeter.Pages.Inflight;
using mqttMultimeter.Services.Mqtt;
using MQTTnet;
using MQTTnet.Client;
using ReactiveUI;

namespace mqttMultimeter.Pages.TopicExplorer;
Expand Down
4 changes: 2 additions & 2 deletions Source/Services/Mqtt/MqttClientService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
using mqttMultimeter.Pages.Publish;
using mqttMultimeter.Pages.Subscriptions;
using MQTTnet;
using MQTTnet.Client;
using MQTTnet.Diagnostics;
using MQTTnet.Diagnostics.Logger;
using MQTTnet.Diagnostics.PacketInspection;
using MQTTnet.Exceptions;
using MQTTnet.Internal;

Expand Down
26 changes: 13 additions & 13 deletions Source/mqttMultimeter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@
<AvaloniaResource Include="Assets\**" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PackageReference Include="Avalonia.Diagnostics" Version="11.1.1" />
<PackageReference Include="Avalonia.Diagnostics" Version="11.2.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.1.1" />
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.0.6" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.1.1" />
<PackageReference Include="Avalonia.Desktop" Version="11.1.1" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.1.1" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.1.1" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.1.1" />
<PackageReference Include="AvaloniaEdit.TextMate" Version="11.0.6" />
<PackageReference Include="Google.Protobuf" Version="3.27.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="MQTTnet" Version="5.0.0.1145" />
<PackageReference Include="MessagePack" Version="2.5.172" />
<PackageReference Include="Avalonia" Version="11.2.0" />
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.1.0" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.2.0" />
<PackageReference Include="Avalonia.Desktop" Version="11.2.0" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.0" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.2.0" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.0" />
<PackageReference Include="AvaloniaEdit.TextMate" Version="11.1.0" />
<PackageReference Include="Google.Protobuf" Version="3.28.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="MQTTnet" Version="5.0.0.1223-RC" />
<PackageReference Include="MessagePack" Version="2.5.187" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions Source/mqttMultimeter.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002EMemberReordering_002EMigrations_002ECSharpFileLayoutPatternRemoveIsAttributeUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Avalonia/@EntryIndexedValue">True</s:Boolean>
Expand Down

0 comments on commit 1393f3f

Please sign in to comment.