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