Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added IoT/UI/AppCommon/AppCommon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions IoT/UI/AppCommon/AppCommon.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36414.22 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppCommon", "AppCommon\AppCommon.csproj", "{E4FE2ADD-EAF4-4152-BC2F-3DFF44C2443E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E4FE2ADD-EAF4-4152-BC2F-3DFF44C2443E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E4FE2ADD-EAF4-4152-BC2F-3DFF44C2443E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E4FE2ADD-EAF4-4152-BC2F-3DFF44C2443E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E4FE2ADD-EAF4-4152-BC2F-3DFF44C2443E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DC210600-66CB-4C43-94CE-4713D9FA403A}
EndGlobalSection
EndGlobal
112 changes: 112 additions & 0 deletions IoT/UI/AppCommon/AppCommon/AppCommon.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
using AppCommon.Services;
using System;
using Tizen.Applications;
using Tizen.NUI;
using Tizen.NUI.BaseComponents;
using Tizen.NUI.Components;
using AppCommon.Models;
using AppCommon.Pages;
using AppCommon.Services;

namespace AppCommon
{
class Program : NUIApplication
{
private Window window;
private Navigator navigator;
private MainPage mainPage;

protected override void OnCreate()
{
base.OnCreate();
Initialize();
}

void Initialize()
{
// Set IsUsingXaml to false as per migration requirements
NUIApplication.IsUsingXaml = false;

// Initialize service locator
ServiceLocator.Initialize();

window = NUIApplication.GetDefaultWindow();
window.BackgroundColor = Color.White;

// Get window size
var windowSize = window.WindowSize;
int screenWidth = (int)windowSize.Width;
int screenHeight = (int)windowSize.Height;

// Get default navigator for page-based navigation
navigator = window.GetDefaultNavigator();

// Push main page with tabs
mainPage = new MainPage(screenWidth, screenHeight);
navigator.Push(mainPage);
}

/// <summary>
/// Handle LowMemory event
/// </summary>
/// <param name="e">Low memory event arguments</param>
protected override void OnLowMemory(LowMemoryEventArgs e)
{
base.OnLowMemory(e);

// Convert Tizen.Applications.LowMemoryStatus to our LowMemoryStatus enum
var status = Models.LowMemoryStatus.None;
switch (e.LowMemoryStatus)
{
case Tizen.Applications.LowMemoryStatus.Normal:
status = Models.LowMemoryStatus.Normal;
break;
case Tizen.Applications.LowMemoryStatus.SoftWarning:
status = Models.LowMemoryStatus.SoftWarning;
break;
case Tizen.Applications.LowMemoryStatus.HardWarning:
status = Models.LowMemoryStatus.HardWarning;
break;
}

// Update ViewModel
mainPage?.AppInfoPage?.ViewModel?.UpdateLowMemoryLEDColor(status);
}

/// <summary>
/// Handle DeviceOrientation event
/// </summary>
/// <param name="e">Device orientation event arguments</param>
protected override void OnDeviceOrientationChanged(DeviceOrientationEventArgs e)
{
base.OnDeviceOrientationChanged(e);

// Convert Tizen.Applications.DeviceOrientation to our DeviceOrientationStatus enum
var orientation = Models.DeviceOrientationStatus.Orientation_0;
switch (e.DeviceOrientation)
{
case Tizen.Applications.DeviceOrientation.Orientation_0:
orientation = Models.DeviceOrientationStatus.Orientation_0;
break;
case Tizen.Applications.DeviceOrientation.Orientation_90:
orientation = Models.DeviceOrientationStatus.Orientation_90;
break;
case Tizen.Applications.DeviceOrientation.Orientation_180:
orientation = Models.DeviceOrientationStatus.Orientation_180;
break;
case Tizen.Applications.DeviceOrientation.Orientation_270:
orientation = Models.DeviceOrientationStatus.Orientation_270;
break;
}

// Update ViewModel
mainPage?.AppInfoPage?.ViewModel?.UpdateDeviceOrientation(orientation);
}

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

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0-tizen</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\" />
<Folder Include="res\" />
</ItemGroup>


<!-- If solution already has PCL project, will reference -->

</Project>
50 changes: 50 additions & 0 deletions IoT/UI/AppCommon/AppCommon/Models/Enums.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (c) 2025 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.
*/

namespace AppCommon.Models
{
/// <summary>
/// Low battery status enumeration
/// </summary>
public enum LowBatteryStatus
{
None,
PowerOff,
CriticalLow
}

/// <summary>
/// Low memory status enumeration
/// </summary>
public enum LowMemoryStatus
{
None,
Normal,
SoftWarning,
HardWarning
}

/// <summary>
/// Device orientation status enumeration
/// </summary>
public enum DeviceOrientationStatus
{
Orientation_0,
Orientation_90,
Orientation_180,
Orientation_270
}
}
27 changes: 27 additions & 0 deletions IoT/UI/AppCommon/AppCommon/Models/PathInformation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2025 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.
*/

namespace AppCommon.Models
{
/// <summary>
/// A class to define each path information
/// </summary>
public class PathInformation
{
public string Title { get; set; }
public string Path { get; set; }
}
}
Loading