mirror of
https://github.com/Stone-Red-Code/Decho.git
synced 2026-09-04 00:46:11 +02:00
Code cleanup
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user