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 public sealed class UserViewModel(UserPresenceDto dto) : ViewModelBase
{ {
private UserStatus _status = dto.Status;
public string Username { get; } = dto.Username; public string Username { get; } = dto.Username;
public string DisplayName { get; } = dto.DisplayName ?? dto.Username; public string DisplayName { get; } = dto.DisplayName ?? dto.Username;
public string? NicknameColor { get; } = dto.NicknameColor; public string? NicknameColor { get; } = dto.NicknameColor;
@@ -16,20 +15,20 @@ public sealed class UserViewModel(UserPresenceDto dto) : ViewModelBase
public UserStatus Status public UserStatus Status
{ {
get => _status; get;
set set
{ {
if (_status == value) if (field == value)
{ {
return; return;
} }
_status = value; field = value;
this.RaisePropertyChanged(); this.RaisePropertyChanged();
this.RaisePropertyChanged(nameof(StatusColor)); this.RaisePropertyChanged(nameof(StatusColor));
this.RaisePropertyChanged(nameof(StatusText)); this.RaisePropertyChanged(nameof(StatusText));
} }
} } = dto.Status;
public string FullName => DisplayName ?? Username; public string FullName => DisplayName ?? Username;
+5 -5
View File
@@ -59,9 +59,9 @@ public partial class MessageItemView : UserControl
tb.Inlines?.Clear(); tb.Inlines?.Clear();
var mentionMatches = MentionRegex.Matches(content).Cast<Match>(); IEnumerable<Match> mentionMatches = MentionRegex.Matches(content).Cast<Match>();
var channelMatches = ChannelRegex.Matches(content).Cast<Match>(); IEnumerable<Match> channelMatches = ChannelRegex.Matches(content).Cast<Match>();
var allMatches = mentionMatches.Concat(channelMatches) List<Match> allMatches = mentionMatches.Concat(channelMatches)
.OrderBy(m => m.Index) .OrderBy(m => m.Index)
.ToList(); .ToList();
@@ -74,11 +74,11 @@ public partial class MessageItemView : UserControl
} }
bool isMention = match.Value[0] == '@'; bool isMention = match.Value[0] == '@';
var container = new InlineUIContainer InlineUIContainer container = new InlineUIContainer
{ {
BaselineAlignment = BaselineAlignment.Center, BaselineAlignment = BaselineAlignment.Center,
}; };
var label = new TextBlock TextBlock label = new TextBlock
{ {
Text = match.Value, Text = match.Value,
FontWeight = FontWeight.Bold, FontWeight = FontWeight.Bold,