1
1
using System ;
2
+ using System . Threading . Tasks ;
2
3
using Tizen . UIExtensions . ElmSharp ;
3
4
4
5
namespace Microsoft . Maui . Handlers
@@ -17,7 +18,6 @@ protected override void ConnectHandler(Button nativeView)
17
18
nativeView . Released += OnButtonClicked ;
18
19
nativeView . Clicked += OnButtonReleased ;
19
20
nativeView . Pressed += OnButtonPressed ;
20
-
21
21
base . ConnectHandler ( nativeView ) ;
22
22
}
23
23
@@ -26,32 +26,40 @@ protected override void DisconnectHandler(Button nativeView)
26
26
nativeView . Released -= OnButtonClicked ;
27
27
nativeView . Clicked -= OnButtonReleased ;
28
28
nativeView . Pressed -= OnButtonPressed ;
29
-
30
29
base . DisconnectHandler ( nativeView ) ;
31
30
}
32
31
33
- public static void MapText ( ButtonHandler handler , IButton button )
32
+ public static void MapText ( IButtonHandler handler , IText button )
34
33
{
35
- handler . NativeView ? . UpdateText ( button ) ;
34
+ handler . TypedNativeView ? . UpdateText ( button ) ;
36
35
}
37
36
38
- public static void MapTextColor ( ButtonHandler handler , IButton button )
37
+ public static void MapTextColor ( IButtonHandler handler , ITextStyle button )
39
38
{
40
- handler . NativeView ? . UpdateTextColor ( button ) ;
39
+ handler . TypedNativeView ? . UpdateTextColor ( button ) ;
41
40
}
42
41
43
- //TODO : Need to impl
44
- [ MissingMapper ]
45
- public static void MapImageSource ( ButtonHandler handler , IButton image ) { }
42
+ public static void MapImageSource ( IButtonHandler handler , IButton image ) =>
43
+ MapImageSourceAsync ( handler , image ) . FireAndForget ( handler ) ;
44
+
45
+ public static Task MapImageSourceAsync ( IButtonHandler handler , IButton image )
46
+ {
47
+ if ( image . ImageSource == null )
48
+ {
49
+ return Task . CompletedTask ;
50
+ }
51
+
52
+ return handler . ImageSourceLoader . UpdateImageSourceAsync ( ) ;
53
+ }
46
54
47
55
[ MissingMapper ]
48
- public static void MapCharacterSpacing ( ButtonHandler handler , IButton button ) { }
56
+ public static void MapCharacterSpacing ( IButtonHandler handler , ITextStyle button ) { }
49
57
50
58
[ MissingMapper ]
51
- public static void MapFont ( ButtonHandler handler , IButton button ) { }
59
+ public static void MapFont ( IButtonHandler handler , ITextStyle button ) { }
52
60
53
61
[ MissingMapper ]
54
- public static void MapPadding ( ButtonHandler handler , IButton button ) { }
62
+ public static void MapPadding ( IButtonHandler handler , IButton button ) { }
55
63
56
64
void OnButtonClicked ( object ? sender , EventArgs e )
57
65
{
@@ -67,5 +75,11 @@ void OnButtonPressed(object? sender, EventArgs e)
67
75
{
68
76
VirtualView ? . Pressed ( ) ;
69
77
}
78
+
79
+ void OnSetImageSource ( Image ? image )
80
+ {
81
+ NativeView . Image = image ;
82
+ VirtualView . ImageSourceLoaded ( ) ;
83
+ }
70
84
}
71
85
}
0 commit comments