Skip to content

Commit

Permalink
[Mobile][NUI] Location sample application
Browse files Browse the repository at this point in the history
  • Loading branch information
bchrescionko committed Jan 5, 2023
1 parent 6f7a29f commit 2813b28
Show file tree
Hide file tree
Showing 21 changed files with 12,810 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Mobile/NUI/Location/.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

arg_file_template = ""
buildconfig = "//build/BUILDCONFIG.gn"
root = "//build:"
script_executable = ""
secondary_source = "//build"
27 changes: 27 additions & 0 deletions Mobile/NUI/Location/Location.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31005.135
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Location", "Location\Location.csproj", "{e708c9b1-601b-48fa-9ff2-fe38f37dc2f5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5204eb4c-1913-4de9-93d0-f1e45943f734}"
ProjectSection(SolutionItems) = preProject
tizen_workspace.yaml = tizen_workspace.yaml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{e708c9b1-601b-48fa-9ff2-fe38f37dc2f5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{e708c9b1-601b-48fa-9ff2-fe38f37dc2f5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{e708c9b1-601b-48fa-9ff2-fe38f37dc2f5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{e708c9b1-601b-48fa-9ff2-fe38f37dc2f5}.Release|Any CPU.Build.0 = Release|Any CPU

EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
43 changes: 43 additions & 0 deletions Mobile/NUI/Location/Location/Behaviors/TextSetter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2023 Samsung Electronics Co., Ltd. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using Tizen.NUI.Binding;
using Tizen.NUI.Components;

namespace Location.Behaviors
{
public static class TextSetter
{
public static readonly BindableProperty TextProperty =
BindableProperty.CreateAttached(
"Text",
typeof(string),
typeof(TextSetter),
"",
propertyChanged: OnTextChanged);

public static string GetText(BindableObject button) => (string)button.GetValue(TextProperty);

public static void SetText(BindableObject button, string value) => button.SetValue(TextProperty, value);

public static void OnTextChanged(BindableObject bindable, object oldValue, object newValue)
{
if (newValue is string text && bindable is Button button)
{
button.Text = text;
}
}
}
}
21 changes: 21 additions & 0 deletions Mobile/NUI/Location/Location/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
***********************************************************************************************
<Build.Directory.targets>
WARNING: DO NOT MODIFY this file. Incorrect changes to this file will make it
impossible to load or build your projects from the IDE.
***********************************************************************************************
-->

<Project>
<Target Name="BuildDotnet" AfterTargets="TizenPackage" >
<Message Text="Tizen Build starts here ------------" Importance="high"/>
<Message Text="$(MSBuildProjectDirectory)" Importance="high"/>
<PropertyGroup>
<WorkspaceFolder>$([System.IO.Path]::GetDirectoryName($(MSBuildProjectDirectory)))</WorkspaceFolder>
</PropertyGroup>
<Message Text="Workspace: '$(WorkspaceFolder)'" Importance="high" />

<Exec Command="C:\tizen-studio\tools\tizen-core\tz.exe pack -S $(ProjectDir) $(WorkspaceFolder)"> </Exec>
</Target>
</Project>
38 changes: 38 additions & 0 deletions Mobile/NUI/Location/Location/Location.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using Tizen.NUI;
using Tizen.NUI.BaseComponents;

namespace Location
{
public class Program : NUIApplication
{
protected override void OnCreate()
{
base.OnCreate();
Window window = Window.Instance;
window.BackgroundColor = Color.Blue;
window.KeyEvent += OnKeyEvent;

MainPage page = new MainPage();
page.PositionUsesPivotPoint = true;
page.ParentOrigin = ParentOrigin.Center;
page.PivotPoint = PivotPoint.Center;
page.Size = new Size(window.WindowSize);
window.Add(page);
}

public void OnKeyEvent(object sender, Window.KeyEventArgs e)
{
if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape"))
{
Exit();
}
}

static void Main(string[] args)
{
var app = new Program();
app.Run(args);
}
}
}
33 changes: 33 additions & 0 deletions Mobile/NUI/Location/Location/Location.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Project Sdk="Tizen.NET.Sdk/1.1.9">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>tizen10.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>None</DebugType>
</PropertyGroup>

<ItemGroup>
<Folder Include="lib\" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="res\layout\MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Tizen.NUI.XamlBuild" Version="1.0.34" />
</ItemGroup>

<PropertyGroup>
<NeedInjection>True</NeedInjection>
</PropertyGroup>

</Project>
60 changes: 60 additions & 0 deletions Mobile/NUI/Location/Location/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright (c) 2022 Samsung Electronics Co., Ltd. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using System;
using Tizen.NUI;
using Tizen.NUI.Components;
using Tizen.NUI.BaseComponents;

namespace Location
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}

/// <summary>
/// User needs to implement this, if required
/// </summary>
/// <param name="type">dispose type</param>
protected override void Dispose(DisposeTypes type)
{
if (Disposed)
{
return;
}

ExitXaml();

if (type == DisposeTypes.Explicit)
{
//Todo: Called by User
//Release your own managed resources here.
//You should release all of your own disposable objects here.

}

//Todo: Release your own unmanaged resources here.
//You should not access any managed member here except static instance.
//because the execution order of Finalizes is non-deterministic.


base.Dispose(type);
}
}
}
Loading

0 comments on commit 2813b28

Please sign in to comment.