File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ public static class Gestures
30
30
"ScrollGestureEnded" , RoutingStrategies . Bubble , typeof ( Gestures ) ) ;
31
31
32
32
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
33
- private static WeakReference < IInteractive > s_lastPress = new WeakReference < IInteractive > ( null ) ;
33
+ private static readonly WeakReference < IInteractive > s_lastPress = new WeakReference < IInteractive > ( null ) ;
34
34
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
35
35
36
36
static Gestures ( )
@@ -86,16 +86,15 @@ private static void PointerPressed(RoutedEventArgs ev)
86
86
#pragma warning restore CS0618 // Type or member is obsolete
87
87
if ( clickCount <= 1 )
88
88
{
89
- s_lastPress = new WeakReference < IInteractive > ( ev . Source ) ;
89
+ s_lastPress . SetTarget ( ev . Source ) ;
90
90
}
91
- else if ( s_lastPress != null && clickCount == 2 && e . GetCurrentPoint ( visual ) . Properties . IsLeftButtonPressed )
91
+ else if ( clickCount == 2 && e . GetCurrentPoint ( visual ) . Properties . IsLeftButtonPressed )
92
92
{
93
93
if ( s_lastPress . TryGetTarget ( out var target ) && target == e . Source )
94
94
{
95
95
e . Source . RaiseEvent ( new TappedEventArgs ( DoubleTappedEvent , e ) ) ;
96
96
}
97
97
}
98
-
99
98
}
100
99
}
101
100
You can’t perform that action at this time.
0 commit comments