1
1
using System ;
2
2
using System . Threading . Tasks ;
3
+
3
4
using Avalonia . Collections ;
4
5
using Avalonia . Media ;
6
+
5
7
using CommunityToolkit . Mvvm . ComponentModel ;
6
8
7
9
namespace SourceGit . ViewModels
@@ -20,10 +22,10 @@ public object Data
20
22
set => SetProperty ( ref _data , value ) ;
21
23
}
22
24
23
- public IBrush DirtyBrush
25
+ public Models . DirtyState DirtyState
24
26
{
25
- get => _dirtyBrush ;
26
- private set => SetProperty ( ref _dirtyBrush , value ) ;
27
+ get => _dirtyState ;
28
+ private set => SetProperty ( ref _dirtyState , value ) ;
27
29
}
28
30
29
31
public Popup Popup
@@ -66,22 +68,18 @@ public async Task CopyPathAsync()
66
68
67
69
public void ChangeDirtyState ( Models . DirtyState flag , bool remove )
68
70
{
71
+ var state = _dirtyState ;
69
72
if ( remove )
70
73
{
71
- if ( _dirtyState . HasFlag ( flag ) )
72
- _dirtyState -= flag ;
74
+ if ( state . HasFlag ( flag ) )
75
+ state -= flag ;
73
76
}
74
77
else
75
78
{
76
- _dirtyState |= flag ;
79
+ state |= flag ;
77
80
}
78
81
79
- if ( _dirtyState . HasFlag ( Models . DirtyState . HasLocalChanges ) )
80
- DirtyBrush = Brushes . Gray ;
81
- else if ( _dirtyState . HasFlag ( Models . DirtyState . HasPendingPullOrPush ) )
82
- DirtyBrush = Brushes . RoyalBlue ;
83
- else
84
- DirtyBrush = null ;
82
+ DirtyState = state ;
85
83
}
86
84
87
85
public bool CanCreatePopup ( )
@@ -127,7 +125,6 @@ public void CancelPopup()
127
125
128
126
private RepositoryNode _node = null ;
129
127
private object _data = null ;
130
- private IBrush _dirtyBrush = null ;
131
128
private Models . DirtyState _dirtyState = Models . DirtyState . None ;
132
129
private Popup _popup = null ;
133
130
}
0 commit comments