1
1
using System ;
2
- using System . Collections . Generic ;
3
2
using System . Collections . ObjectModel ;
4
3
using System . ComponentModel ;
5
4
using System . Linq ;
8
7
using System . Windows . Forms ;
9
8
using Flow . Launcher . Plugin . Explorer . Helper ;
10
9
using Flow . Launcher . Plugin . Explorer . Search . QuickAccessLinks ;
11
- using JetBrains . Annotations ;
12
10
13
11
namespace Flow . Launcher . Plugin . Explorer . Views ;
14
12
15
13
public partial class QuickAccessLinkSettings : INotifyPropertyChanged
16
14
{
17
-
18
15
private string _selectedPath ;
19
-
20
16
public string SelectedPath
21
17
{
22
18
get => _selectedPath ;
@@ -26,20 +22,20 @@ public string SelectedPath
26
22
{
27
23
_selectedPath = value ;
28
24
OnPropertyChanged ( ) ;
29
- if ( string . IsNullOrEmpty ( _selectedName ) ) SelectedName = _selectedPath . GetPathName ( ) ;
25
+ if ( string . IsNullOrEmpty ( _selectedName ) )
26
+ {
27
+ SelectedName = _selectedPath . GetPathName ( ) ;
28
+ }
30
29
}
31
30
}
32
31
}
33
32
34
-
35
33
private string _selectedName ;
36
-
37
34
public string SelectedName
38
35
{
39
36
get
40
37
{
41
- if ( string . IsNullOrEmpty ( _selectedName ) ) return _selectedPath . GetPathName ( ) ;
42
- return _selectedName ;
38
+ return string . IsNullOrEmpty ( _selectedName ) ? _selectedPath . GetPathName ( ) : _selectedName ;
43
39
}
44
40
set
45
41
{
@@ -52,7 +48,7 @@ public string SelectedName
52
48
}
53
49
54
50
private bool IsEdit { get ; set ; }
55
- [ CanBeNull ] private AccessLink SelectedAccessLink { get ; }
51
+ private AccessLink SelectedAccessLink { get ; }
56
52
57
53
public ObservableCollection < AccessLink > QuickAccessLinks { get ; }
58
54
@@ -62,7 +58,7 @@ public QuickAccessLinkSettings(ObservableCollection<AccessLink> quickAccessLinks
62
58
InitializeComponent ( ) ;
63
59
}
64
60
65
- public QuickAccessLinkSettings ( ObservableCollection < AccessLink > quickAccessLinks , AccessLink selectedAccessLink )
61
+ public QuickAccessLinkSettings ( ObservableCollection < AccessLink > quickAccessLinks , AccessLink selectedAccessLink )
66
62
{
67
63
IsEdit = true ;
68
64
_selectedName = selectedAccessLink . Name ;
@@ -72,15 +68,12 @@ public QuickAccessLinkSettings(ObservableCollection<AccessLink> quickAccessLinks
72
68
InitializeComponent ( ) ;
73
69
}
74
70
75
-
76
-
77
71
private void BtnCancel_OnClick ( object sender , RoutedEventArgs e )
78
72
{
79
73
DialogResult = false ;
80
74
Close ( ) ;
81
75
}
82
76
83
-
84
77
private void OnDoneButtonClick ( object sender , RoutedEventArgs e )
85
78
{
86
79
if ( string . IsNullOrEmpty ( SelectedName ) || string . IsNullOrEmpty ( SelectedPath ) )
@@ -121,7 +114,7 @@ private void SelectPath_OnClick(object commandParameter, RoutedEventArgs e)
121
114
122
115
private void EditAccessLink ( )
123
116
{
124
- if ( SelectedAccessLink == null ) throw new ArgumentException ( "Access Link object is null" ) ;
117
+ if ( SelectedAccessLink == null ) throw new ArgumentException ( "Access Link object is null" ) ;
125
118
126
119
var index = QuickAccessLinks . IndexOf ( SelectedAccessLink ) ;
127
120
if ( index >= 0 )
@@ -134,19 +127,10 @@ private void EditAccessLink()
134
127
Close ( ) ;
135
128
}
136
129
137
- public event PropertyChangedEventHandler PropertyChanged ;
130
+ public event PropertyChangedEventHandler PropertyChanged ;
138
131
139
132
protected virtual void OnPropertyChanged ( [ CallerMemberName ] string propertyName = null )
140
133
{
141
134
PropertyChanged ? . Invoke ( this , new PropertyChangedEventArgs ( propertyName ) ) ;
142
135
}
143
-
144
- protected bool SetField < T > ( ref T field , T value , [ CallerMemberName ] string propertyName = null )
145
- {
146
- if ( EqualityComparer < T > . Default . Equals ( field , value ) ) return false ;
147
- field = value ;
148
- OnPropertyChanged ( propertyName ) ;
149
- return true ;
150
- }
151
136
}
152
-
0 commit comments