Skip to content

Commit 68e595c

Browse files
sung-surookiejava
authored andcommitted
Add Essentials.Samples.Tizen (#24)
* Add Essentials.Samples.Tizen * Add guard for null exception * Fix Essentials.Samples for Tizen * Fix csproj for net6 * Remove Forms.Init
1 parent 7f84c0d commit 68e595c

File tree

14 files changed

+120
-38
lines changed

14 files changed

+120
-38
lines changed

Microsoft.Maui.Tizen.sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.SourceGen", "src\C
118118
EndProject
119119
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.Sample.Tizen", "src\Controls\samples\Controls.Sample.Tizen\Controls.Sample.Tizen.csproj", "{4D5FF3BF-5C21-4DE9-B752-2F92BCB2F7A6}"
120120
EndProject
121+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Essentials.Samples.Tizen", "src\Essentials\samples\Samples.Tizen\Essentials.Samples.Tizen.csproj", "{64483F36-30C0-412D-8230-F69669486F8A}"
122+
EndProject
121123
Global
122124
GlobalSection(SharedMSBuildProjectFiles) = preSolution
123125
src\Compatibility\ControlGallery\src\Issues.Shared\Compatibility.ControlGallery.Issues.Shared.projitems*{ae2513cb-4e5e-4e5c-8237-88954d4c9433}*SharedItemsImports = 13
@@ -862,6 +864,34 @@ Global
862864
{4D5FF3BF-5C21-4DE9-B752-2F92BCB2F7A6}.Release|x64.Build.0 = Release|Any CPU
863865
{4D5FF3BF-5C21-4DE9-B752-2F92BCB2F7A6}.Release|x86.ActiveCfg = Release|Any CPU
864866
{4D5FF3BF-5C21-4DE9-B752-2F92BCB2F7A6}.Release|x86.Build.0 = Release|Any CPU
867+
{64483F36-30C0-412D-8230-F69669486F8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
868+
{64483F36-30C0-412D-8230-F69669486F8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
869+
{64483F36-30C0-412D-8230-F69669486F8A}.Debug|ARM.ActiveCfg = Debug|Any CPU
870+
{64483F36-30C0-412D-8230-F69669486F8A}.Debug|ARM.Build.0 = Debug|Any CPU
871+
{64483F36-30C0-412D-8230-F69669486F8A}.Debug|ARM64.ActiveCfg = Debug|Any CPU
872+
{64483F36-30C0-412D-8230-F69669486F8A}.Debug|ARM64.Build.0 = Debug|Any CPU
873+
{64483F36-30C0-412D-8230-F69669486F8A}.Debug|iPhone.ActiveCfg = Debug|Any CPU
874+
{64483F36-30C0-412D-8230-F69669486F8A}.Debug|iPhone.Build.0 = Debug|Any CPU
875+
{64483F36-30C0-412D-8230-F69669486F8A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
876+
{64483F36-30C0-412D-8230-F69669486F8A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
877+
{64483F36-30C0-412D-8230-F69669486F8A}.Debug|x64.ActiveCfg = Debug|Any CPU
878+
{64483F36-30C0-412D-8230-F69669486F8A}.Debug|x64.Build.0 = Debug|Any CPU
879+
{64483F36-30C0-412D-8230-F69669486F8A}.Debug|x86.ActiveCfg = Debug|Any CPU
880+
{64483F36-30C0-412D-8230-F69669486F8A}.Debug|x86.Build.0 = Debug|Any CPU
881+
{64483F36-30C0-412D-8230-F69669486F8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
882+
{64483F36-30C0-412D-8230-F69669486F8A}.Release|Any CPU.Build.0 = Release|Any CPU
883+
{64483F36-30C0-412D-8230-F69669486F8A}.Release|ARM.ActiveCfg = Release|Any CPU
884+
{64483F36-30C0-412D-8230-F69669486F8A}.Release|ARM.Build.0 = Release|Any CPU
885+
{64483F36-30C0-412D-8230-F69669486F8A}.Release|ARM64.ActiveCfg = Release|Any CPU
886+
{64483F36-30C0-412D-8230-F69669486F8A}.Release|ARM64.Build.0 = Release|Any CPU
887+
{64483F36-30C0-412D-8230-F69669486F8A}.Release|iPhone.ActiveCfg = Release|Any CPU
888+
{64483F36-30C0-412D-8230-F69669486F8A}.Release|iPhone.Build.0 = Release|Any CPU
889+
{64483F36-30C0-412D-8230-F69669486F8A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
890+
{64483F36-30C0-412D-8230-F69669486F8A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
891+
{64483F36-30C0-412D-8230-F69669486F8A}.Release|x64.ActiveCfg = Release|Any CPU
892+
{64483F36-30C0-412D-8230-F69669486F8A}.Release|x64.Build.0 = Release|Any CPU
893+
{64483F36-30C0-412D-8230-F69669486F8A}.Release|x86.ActiveCfg = Release|Any CPU
894+
{64483F36-30C0-412D-8230-F69669486F8A}.Release|x86.Build.0 = Release|Any CPU
865895
EndGlobalSection
866896
GlobalSection(SolutionProperties) = preSolution
867897
HideSolutionNode = FALSE
@@ -907,6 +937,7 @@ Global
907937
{9FAA9654-80E6-4664-9702-47998A04E8FE} = {29AC50BF-B4FB-450B-9386-0C5AD4B84226}
908938
{061EC251-FB7A-43B2-A6AD-065D2CCEF1BD} = {D5B986A3-7FC9-437E-8030-349AA4698DFD}
909939
{4D5FF3BF-5C21-4DE9-B752-2F92BCB2F7A6} = {806499EB-C2CC-4E85-BC19-613F3DE5E0C3}
940+
{64483F36-30C0-412D-8230-F69669486F8A} = {5817A848-0B04-4035-9F7E-B8621B61CBDD}
910941
EndGlobalSection
911942
GlobalSection(ExtensibilityGlobals) = postSolution
912943
SolutionGuid = {650AE971-2F29-46A8-822C-FB4FCDC6A9A0}

Microsoft.Maui.sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.SourceGen", "src\C
136136
EndProject
137137
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.Sample.Tizen", "src\Controls\samples\Controls.Sample.Tizen\Controls.Sample.Tizen.csproj", "{4D5FF3BF-5C21-4DE9-B752-2F92BCB2F7A6}"
138138
EndProject
139+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Essentials.Samples.Tizen", "src\Essentials\samples\Samples.Tizen\Essentials.Samples.Tizen.csproj", "{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}"
140+
EndProject
139141
Global
140142
GlobalSection(SharedMSBuildProjectFiles) = preSolution
141143
src\Compatibility\ControlGallery\src\Issues.Shared\Compatibility.ControlGallery.Issues.Shared.projitems*{ae2513cb-4e5e-4e5c-8237-88954d4c9433}*SharedItemsImports = 13
@@ -1181,6 +1183,34 @@ Global
11811183
{4D5FF3BF-5C21-4DE9-B752-2F92BCB2F7A6}.Release|x64.Build.0 = Release|Any CPU
11821184
{4D5FF3BF-5C21-4DE9-B752-2F92BCB2F7A6}.Release|x86.ActiveCfg = Release|Any CPU
11831185
{4D5FF3BF-5C21-4DE9-B752-2F92BCB2F7A6}.Release|x86.Build.0 = Release|Any CPU
1186+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1187+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
1188+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Debug|ARM.ActiveCfg = Debug|Any CPU
1189+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Debug|ARM.Build.0 = Debug|Any CPU
1190+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Debug|ARM64.ActiveCfg = Debug|Any CPU
1191+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Debug|ARM64.Build.0 = Debug|Any CPU
1192+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Debug|iPhone.ActiveCfg = Debug|Any CPU
1193+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Debug|iPhone.Build.0 = Debug|Any CPU
1194+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
1195+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
1196+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Debug|x64.ActiveCfg = Debug|Any CPU
1197+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Debug|x64.Build.0 = Debug|Any CPU
1198+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Debug|x86.ActiveCfg = Debug|Any CPU
1199+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Debug|x86.Build.0 = Debug|Any CPU
1200+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
1201+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Release|Any CPU.Build.0 = Release|Any CPU
1202+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Release|ARM.ActiveCfg = Release|Any CPU
1203+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Release|ARM.Build.0 = Release|Any CPU
1204+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Release|ARM64.ActiveCfg = Release|Any CPU
1205+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Release|ARM64.Build.0 = Release|Any CPU
1206+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Release|iPhone.ActiveCfg = Release|Any CPU
1207+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Release|iPhone.Build.0 = Release|Any CPU
1208+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
1209+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
1210+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Release|x64.ActiveCfg = Release|Any CPU
1211+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Release|x64.Build.0 = Release|Any CPU
1212+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Release|x86.ActiveCfg = Release|Any CPU
1213+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B}.Release|x86.Build.0 = Release|Any CPU
11841214
EndGlobalSection
11851215
GlobalSection(SolutionProperties) = preSolution
11861216
HideSolutionNode = FALSE
@@ -1235,6 +1265,7 @@ Global
12351265
{9FAA9654-80E6-4664-9702-47998A04E8FE} = {29AC50BF-B4FB-450B-9386-0C5AD4B84226}
12361266
{061EC251-FB7A-43B2-A6AD-065D2CCEF1BD} = {D5B986A3-7FC9-437E-8030-349AA4698DFD}
12371267
{4D5FF3BF-5C21-4DE9-B752-2F92BCB2F7A6} = {806499EB-C2CC-4E85-BC19-613F3DE5E0C3}
1268+
{8B44D770-0239-43A4-8F1D-7C8BD2C8CE7B} = {5817A848-0B04-4035-9F7E-B8621B61CBDD}
12381269
EndGlobalSection
12391270
GlobalSection(ExtensibilityGlobals) = postSolution
12401271
SolutionGuid = {650AE971-2F29-46A8-822C-FB4FCDC6A9A0}

src/Compatibility/Core/src/Compatibility-net6.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<ProjectReference Include="..\..\Android.FormsViewGroup\src\Compatibility.Android.FormsViewGroup-net6.csproj" />
5656
</ItemGroup>
5757

58-
<ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'tizen'" >
58+
<ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'net6.0-tizen'" >
5959
<Compile Include="$(TizenRoot)**\*.cs"></Compile>
6060
<EmbeddedResource Include="$(TizenRoot)Resources\*.resx" />
6161
<EmbeddedResource Include="$(TizenRoot)Resources\*.png" />

src/Compatibility/Core/src/Tizen/Cells/ViewCellRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void UpdatePropagateEvent(View view)
9898
{
9999
if (element is Button || element is Switch)
100100
{
101-
var nativeView = Platform.GetRenderer(element).NativeView ?? null;
101+
var nativeView = Platform.GetRenderer(element)?.NativeView ?? null;
102102
if (nativeView != null)
103103
{
104104
nativeView.PropagateEvents = false;

src/Essentials/samples/Samples.Tizen/Essentials.Samples.Tizen.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
<Project Sdk="Tizen.NET.Sdk/1.0.8">
1+
<Project Sdk="Tizen.NET.Sdk/1.1.6">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>tizen40</TargetFramework>
6-
<TizenNetPackageVersion>4.0.0</TizenNetPackageVersion>
76
<DebugType>portable</DebugType>
87
</PropertyGroup>
98

@@ -17,12 +16,10 @@
1716
</ItemGroup>
1817

1918
<ItemGroup>
20-
<Folder Include="lib\" />
2119
<Folder Include="res\" />
2220
</ItemGroup>
2321

2422
<ItemGroup>
25-
<PackageReference Include="Tizen.NET" Version="6.0.0.14995" />
2623
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" ExcludeAssets="runtime" />
2724
<PackageReference Include="Tizen.NET.MaterialComponents" Version="0.9.9-pre2" />
2825
</ItemGroup>

src/Essentials/samples/Samples.Tizen/Program.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,21 @@
1-
using Tizen.NET.MaterialComponents;
21
using Microsoft.Maui;
3-
using Microsoft.Maui.Controls;
4-
using Xamarin.Forms.Platform.Tizen;
2+
using Tizen.NET.MaterialComponents;
53

64
namespace Samples.Tizen
75
{
8-
class Program : FormsApplication
6+
class Program : MauiApplication<Startup>
97
{
10-
static App formsApp;
11-
128
protected override void OnCreate()
139
{
1410
base.OnCreate();
1511

1612
MaterialComponents.Init(DirectoryInfo.Resource);
17-
Microsoft.Maui.Essentials.Platform.Init(MainWindow);
18-
LoadApplication(formsApp ??= new App());
13+
Microsoft.Maui.Essentials.Platform.Init(CoreUIAppContext.GetInstance(this).MainWindow);
1914
}
2015

2116
static void Main(string[] args)
2217
{
2318
var app = new Program();
24-
Forms.Init(app);
25-
Microsoft.Maui.Essentials.Platform.MapServiceToken = "MAP_SERVICE_KEY";
2619
app.Run(args);
2720
}
2821
}

src/Essentials/samples/Samples.Tizen/tizen-manifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest package="com.microsoft.maui.essentials" version="1.0.0" api-version="4" xmlns="http://tizen.org/ns/packages">
33
<profile name="common" />
4-
<ui-application appid="com.microsoft.maui.essentials" exec="Samples.Tizen.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" splash-screen-display="true" launch_mode="single">
4+
<ui-application appid="com.microsoft.maui.essentials" exec="Essentials.Samples.Tizen.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" splash-screen-display="true" launch_mode="single">
55
<label>Essentials</label>
66
<icon>Samples.Tizen.png</icon>
77
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />

src/Essentials/samples/Samples.Tizen/CustomViewCellRenderer.cs renamed to src/Essentials/samples/Samples/CustomViewCellRenderer.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1+
#if TIZEN
12
using ElmSharp;
2-
using Samples.Tizen;
3-
using Microsoft.Maui;
43
using Microsoft.Maui.Controls;
5-
using Xamarin.Forms.Platform.Tizen;
4+
using Microsoft.Maui.Controls.Compatibility.Platform.Tizen;
65

7-
[assembly: ExportCell(typeof(ViewCell), typeof(CustomViewCellRenderer))]
8-
9-
namespace Samples.Tizen
6+
namespace Samples
107
{
118
public sealed class CustomViewCellRenderer : ViewCellRenderer
129
{
@@ -18,3 +15,4 @@ protected override EvasObject OnGetContent(Cell cell, string part)
1815
}
1916
}
2017
}
18+
#endif
Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-

1+
using Microsoft.Extensions.DependencyInjection;
22
using Microsoft.Maui;
3+
using Microsoft.Maui.Controls.Compatibility;
34
using Microsoft.Maui.Controls.Hosting;
45
using Microsoft.Maui.Hosting;
6+
using Microsoft.Maui.LifecycleEvents;
57

68
namespace Samples
79
{
@@ -10,6 +12,36 @@ public class Startup : IStartup
1012
public void Configure(IAppHostBuilder appBuilder)
1113
{
1214
appBuilder.UseMauiApp<App>();
15+
16+
appBuilder
17+
.ConfigureMauiHandlers(handlers =>
18+
{
19+
#if TIZEN
20+
handlers.AddCompatibilityRenderer(typeof(Microsoft.Maui.Controls.ViewCell), typeof(CustomViewCellRenderer));
21+
#endif
22+
})
23+
24+
.ConfigureServices(services =>
25+
{
26+
#if TIZEN
27+
services.AddTransient((_) =>
28+
{
29+
var option = new InitializationOptions
30+
{
31+
DisplayResolutionUnit = DisplayResolutionUnit.DP(true),
32+
UseSkiaSharp = true
33+
};
34+
return option;
35+
});
36+
#endif
37+
})
38+
39+
.ConfigureLifecycleEvents(events =>
40+
{
41+
#if TIZEN
42+
Microsoft.Maui.Essentials.Platform.MapServiceToken = "YOUR-KEY-HERE";
43+
#endif
44+
});
1345
}
1446
}
1547
}

src/Essentials/samples/Samples/View/AllSensorsPage.xaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,13 @@
191191
</Grid.ColumnDefinitions>
192192

193193
<Label Grid.Row="0" Grid.ColumnSpan="2"
194-
Text="{Binding BaromterValue, StringFormat='Barometer pressure (hPA): {0:N}'}" />
194+
Text="{Binding Pressure, StringFormat='Barometer pressure (hPA): {0:N}'}" />
195195

196-
<Button Grid.Row="1" Grid.Column="0" Text="Start" Command="{Binding StartBarometerComand}"
197-
IsEnabled="{Binding BarometerIsActive, Converter={StaticResource NegativeConverter}}" />
196+
<Button Grid.Row="1" Grid.Column="0" Text="Start" Command="{Binding StartCommand}"
197+
IsEnabled="{Binding IsActive, Converter={StaticResource NegativeConverter}}" />
198198

199-
<Button Grid.Row="1" Grid.Column="1" Text="Stop" Command="{Binding StopBarometerCommand}"
200-
IsEnabled="{Binding BarometerIsActive}" />
199+
<Button Grid.Row="1" Grid.Column="1" Text="Stop" Command="{Binding StopCommand}"
200+
IsEnabled="{Binding IsActive}" />
201201
</Grid>
202202
</StackLayout>
203203
</ScrollView>

0 commit comments

Comments
 (0)