Skip to content

Commit 2813b28

Browse files
committed
[Mobile][NUI] Location sample application
1 parent 6f7a29f commit 2813b28

21 files changed

+12810
-0
lines changed

Mobile/NUI/Location/.gn

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
arg_file_template = ""
3+
buildconfig = "//build/BUILDCONFIG.gn"
4+
root = "//build:"
5+
script_executable = ""
6+
secondary_source = "//build"

Mobile/NUI/Location/Location.sln

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio Version 16
3+
VisualStudioVersion = 16.0.31005.135
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Location", "Location\Location.csproj", "{e708c9b1-601b-48fa-9ff2-fe38f37dc2f5}"
6+
EndProject
7+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5204eb4c-1913-4de9-93d0-f1e45943f734}"
8+
ProjectSection(SolutionItems) = preProject
9+
tizen_workspace.yaml = tizen_workspace.yaml
10+
EndProjectSection
11+
EndProject
12+
Global
13+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
14+
Debug|Any CPU = Debug|Any CPU
15+
Release|Any CPU = Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{e708c9b1-601b-48fa-9ff2-fe38f37dc2f5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19+
{e708c9b1-601b-48fa-9ff2-fe38f37dc2f5}.Debug|Any CPU.Build.0 = Debug|Any CPU
20+
{e708c9b1-601b-48fa-9ff2-fe38f37dc2f5}.Release|Any CPU.ActiveCfg = Release|Any CPU
21+
{e708c9b1-601b-48fa-9ff2-fe38f37dc2f5}.Release|Any CPU.Build.0 = Release|Any CPU
22+
23+
EndGlobalSection
24+
GlobalSection(SolutionProperties) = preSolution
25+
HideSolutionNode = FALSE
26+
EndGlobalSection
27+
EndGlobal
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (c) 2023 Samsung Electronics Co., Ltd. All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
using Tizen.NUI.Binding;
17+
using Tizen.NUI.Components;
18+
19+
namespace Location.Behaviors
20+
{
21+
public static class TextSetter
22+
{
23+
public static readonly BindableProperty TextProperty =
24+
BindableProperty.CreateAttached(
25+
"Text",
26+
typeof(string),
27+
typeof(TextSetter),
28+
"",
29+
propertyChanged: OnTextChanged);
30+
31+
public static string GetText(BindableObject button) => (string)button.GetValue(TextProperty);
32+
33+
public static void SetText(BindableObject button, string value) => button.SetValue(TextProperty, value);
34+
35+
public static void OnTextChanged(BindableObject bindable, object oldValue, object newValue)
36+
{
37+
if (newValue is string text && bindable is Button button)
38+
{
39+
button.Text = text;
40+
}
41+
}
42+
}
43+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!--
2+
***********************************************************************************************
3+
<Build.Directory.targets>
4+
WARNING: DO NOT MODIFY this file. Incorrect changes to this file will make it
5+
impossible to load or build your projects from the IDE.
6+
7+
***********************************************************************************************
8+
-->
9+
10+
<Project>
11+
<Target Name="BuildDotnet" AfterTargets="TizenPackage" >
12+
<Message Text="Tizen Build starts here ------------" Importance="high"/>
13+
<Message Text="$(MSBuildProjectDirectory)" Importance="high"/>
14+
<PropertyGroup>
15+
<WorkspaceFolder>$([System.IO.Path]::GetDirectoryName($(MSBuildProjectDirectory)))</WorkspaceFolder>
16+
</PropertyGroup>
17+
<Message Text="Workspace: '$(WorkspaceFolder)'" Importance="high" />
18+
19+
<Exec Command="C:\tizen-studio\tools\tizen-core\tz.exe pack -S $(ProjectDir) $(WorkspaceFolder)"> </Exec>
20+
</Target>
21+
</Project>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using Tizen.NUI;
3+
using Tizen.NUI.BaseComponents;
4+
5+
namespace Location
6+
{
7+
public class Program : NUIApplication
8+
{
9+
protected override void OnCreate()
10+
{
11+
base.OnCreate();
12+
Window window = Window.Instance;
13+
window.BackgroundColor = Color.Blue;
14+
window.KeyEvent += OnKeyEvent;
15+
16+
MainPage page = new MainPage();
17+
page.PositionUsesPivotPoint = true;
18+
page.ParentOrigin = ParentOrigin.Center;
19+
page.PivotPoint = PivotPoint.Center;
20+
page.Size = new Size(window.WindowSize);
21+
window.Add(page);
22+
}
23+
24+
public void OnKeyEvent(object sender, Window.KeyEventArgs e)
25+
{
26+
if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape"))
27+
{
28+
Exit();
29+
}
30+
}
31+
32+
static void Main(string[] args)
33+
{
34+
var app = new Program();
35+
app.Run(args);
36+
}
37+
}
38+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<Project Sdk="Tizen.NET.Sdk/1.1.9">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>tizen10.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
9+
<DebugType>portable</DebugType>
10+
</PropertyGroup>
11+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
12+
<DebugType>None</DebugType>
13+
</PropertyGroup>
14+
15+
<ItemGroup>
16+
<Folder Include="lib\" />
17+
</ItemGroup>
18+
19+
<ItemGroup>
20+
<EmbeddedResource Include="res\layout\MainPage.xaml">
21+
<Generator>MSBuild:Compile</Generator>
22+
</EmbeddedResource>
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<PackageReference Include="Tizen.NUI.XamlBuild" Version="1.0.34" />
27+
</ItemGroup>
28+
29+
<PropertyGroup>
30+
<NeedInjection>True</NeedInjection>
31+
</PropertyGroup>
32+
33+
</Project>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright (c) 2022 Samsung Electronics Co., Ltd. All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
using System;
18+
using Tizen.NUI;
19+
using Tizen.NUI.Components;
20+
using Tizen.NUI.BaseComponents;
21+
22+
namespace Location
23+
{
24+
public partial class MainPage : ContentPage
25+
{
26+
public MainPage()
27+
{
28+
InitializeComponent();
29+
}
30+
31+
/// <summary>
32+
/// User needs to implement this, if required
33+
/// </summary>
34+
/// <param name="type">dispose type</param>
35+
protected override void Dispose(DisposeTypes type)
36+
{
37+
if (Disposed)
38+
{
39+
return;
40+
}
41+
42+
ExitXaml();
43+
44+
if (type == DisposeTypes.Explicit)
45+
{
46+
//Todo: Called by User
47+
//Release your own managed resources here.
48+
//You should release all of your own disposable objects here.
49+
50+
}
51+
52+
//Todo: Release your own unmanaged resources here.
53+
//You should not access any managed member here except static instance.
54+
//because the execution order of Finalizes is non-deterministic.
55+
56+
57+
base.Dispose(type);
58+
}
59+
}
60+
}

0 commit comments

Comments
 (0)