Skip to content

Commit a1a8683

Browse files
committed
fix(*.cs): Refactor notification unread property and update UI binding
Renamed 'isUnread' to 'IsUnread' in NotificationModel for consistency with C# naming conventions and updated all references in the ViewModel. Modified NotificationView.xaml to use IsEnabled instead of Visibility for the mark-as-read button, removing the BooleanToVisibilityConverter resource.
1 parent 7d70fca commit a1a8683

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

FinTrack/Models/Notification/NotificationModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ public partial class NotificationModel : ObservableObject
1818
private NotificationType type;
1919

2020
[ObservableProperty]
21-
[NotifyPropertyChangedFor(nameof(isUnread))]
21+
[NotifyPropertyChangedFor(nameof(IsUnread))]
2222
private bool isRead = false;
2323

24-
public bool isUnread => !IsRead;
24+
public bool IsUnread => !IsRead;
2525

2626
public NotificationModel(string title, string message, string? timestamp, NotificationType type, bool _isRead = false)
2727
{
2828
Title = title;
2929
Message = message;
3030
Type = type;
3131
Timestamp = timestamp ?? DateTime.Now.ToString();
32-
isRead = _isRead;
32+
IsRead = _isRead;
3333
}
3434
}
3535
}

FinTrack/ViewModels/NotificationViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private void MarkAllAsRead()
5757
{
5858
foreach (var notification in Notifications)
5959
{
60-
if (notification.isUnread)
60+
if (notification.IsUnread)
6161
{
6262
notification.IsRead = true;
6363
_logger.LogInformation($"Notification '{notification.Title}' marked as read.");
@@ -76,7 +76,7 @@ private void ClearAll()
7676
[RelayCommand]
7777
private void MarkAsRead(NotificationModel? notification)
7878
{
79-
if (notification.isUnread)
79+
if (notification.IsUnread)
8080
{
8181
notification.IsRead = true;
8282
_logger.LogInformation($"Notification '{notification.Title}' marked as read.");

FinTrack/Views/NotificationView.xaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,11 @@
66
xmlns:vm="clr-namespace:FinTrack.ViewModels"
77
xmlns:models="clr-namespace:FinTrack.Models.Notification"
88
xmlns:enums="clr-namespace:FinTrack.Enums"
9-
xmlns:helpers="clr-namespace:FinTrack.Helpers"
109
mc:Ignorable="d"
1110
d:DesignHeight="800" d:DesignWidth="1200"
1211
d:DataContext="{d:DesignInstance Type=local:NotificationViewModel, IsDesignTimeCreatable=True}"
1312
Background="{StaticResource MainBackgroundBrush}">
1413

15-
<UserControl.Resources>
16-
<helpers:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
17-
</UserControl.Resources>
18-
1914
<Border Style="{StaticResource DashboardCardStyle}" Margin="40">
2015
<StackPanel>
2116
<!-- Başlık ve Eylemler -->
@@ -98,7 +93,7 @@
9893
<Button Style="{StaticResource IconOnlyButtonStyle}" ToolTip="Okundu İşaretle"
9994
Command="{Binding DataContext.MarkAsReadCommand, RelativeSource={RelativeSource AncestorType=ListView}}"
10095
CommandParameter="{Binding}"
101-
Visibility="{Binding IsUnread, Converter={StaticResource BooleanToVisibilityConverter}}">
96+
IsEnabled="{Binding IsUnread}">
10297
<Image Source="/Assets/Images/Icons/tick.png" Width="18" Height="18"/>
10398
</Button>
10499
<Button Style="{StaticResource IconOnlyButtonStyle}" ToolTip="Sil" Margin="5,0,0,0"

0 commit comments

Comments
 (0)