Code cleanup

This commit is contained in:
Stone_Red
2026-07-17 15:42:34 +02:00
parent a3607c377c
commit d77e6cf8bf
2 changed files with 9 additions and 10 deletions
+4 -5
View File
@@ -7,7 +7,6 @@ namespace Decho.ViewModels;
public sealed class UserViewModel(UserPresenceDto dto) : ViewModelBase
{
private UserStatus _status = dto.Status;
public string Username { get; } = dto.Username;
public string DisplayName { get; } = dto.DisplayName ?? dto.Username;
public string? NicknameColor { get; } = dto.NicknameColor;
@@ -16,20 +15,20 @@ public sealed class UserViewModel(UserPresenceDto dto) : ViewModelBase
public UserStatus Status
{
get => _status;
get;
set
{
if (_status == value)
if (field == value)
{
return;
}
_status = value;
field = value;
this.RaisePropertyChanged();
this.RaisePropertyChanged(nameof(StatusColor));
this.RaisePropertyChanged(nameof(StatusText));
}
}
} = dto.Status;
public string FullName => DisplayName ?? Username;
+5 -5
View File
@@ -59,9 +59,9 @@ public partial class MessageItemView : UserControl
tb.Inlines?.Clear();
var mentionMatches = MentionRegex.Matches(content).Cast<Match>();
var channelMatches = ChannelRegex.Matches(content).Cast<Match>();
var allMatches = mentionMatches.Concat(channelMatches)
IEnumerable<Match> mentionMatches = MentionRegex.Matches(content).Cast<Match>();
IEnumerable<Match> channelMatches = ChannelRegex.Matches(content).Cast<Match>();
List<Match> allMatches = mentionMatches.Concat(channelMatches)
.OrderBy(m => m.Index)
.ToList();
@@ -74,11 +74,11 @@ public partial class MessageItemView : UserControl
}
bool isMention = match.Value[0] == '@';
var container = new InlineUIContainer
InlineUIContainer container = new InlineUIContainer
{
BaselineAlignment = BaselineAlignment.Center,
};
var label = new TextBlock
TextBlock label = new TextBlock
{
Text = match.Value,
FontWeight = FontWeight.Bold,