--- /dev/null
+/*
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * 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 System.ComponentModel;
+using System.Diagnostics;
+using System.Collections.Generic; // for Dictionary
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+using Tizen.Applications;
+
+namespace WidgetTemplate
+{
+ class RedWidget : Widget
+ {
+ protected override void OnCreate(string contentInfo, Window window)
+ {
+ Tizen.Log.Info("NUI", "OnCreate(RedWidget) \n");
+ Bundle bundle = Bundle.Decode(contentInfo);
+ mRootView = new View();
+ mRootView.BackgroundColor = Color.Red;
+ mRootView.Size2D = window.Size;
+ window.GetDefaultLayer().Add(mRootView);
+
+ TextLabel sampleLabel = new TextLabel("Red Widget ");
+ sampleLabel.FontFamily = "SamsungOneUI 500";
+ sampleLabel.PointSize = 8;
+ sampleLabel.TextColor = Color.Black;
+ sampleLabel.SizeWidth = 300;
+ sampleLabel.PivotPoint = PivotPoint.Center;
+ mRootView.Add(sampleLabel);
+ }
+
+ protected override void OnPause()
+ {
+ base.OnPause();
+ }
+
+ protected override void OnResume()
+ {
+ base.OnResume();
+ }
+
+ protected override void OnResize(Window window)
+ {
+ mRootView.Size2D = window.Size;
+ base.OnResize(window);
+ }
+
+ protected override void OnTerminate(string contentInfo, TerminationType type)
+ {
+ base.OnTerminate(contentInfo, type);
+ }
+
+ protected override void OnUpdate(string contentInfo, int force)
+ {
+ base.OnUpdate(contentInfo, force);
+ }
+
+ private View mRootView;
+ }
+
+ class BlueWidget : Widget
+ {
+ protected override void OnCreate(string contentInfo, Window window)
+ {
+ Tizen.Log.Info("NUI", "OnCreate(BlueWidget) \n");
+ Bundle bundle = Bundle.Decode(contentInfo);
+ mRootView = new View();
+ mRootView.BackgroundColor = Color.Blue;
+ mRootView.Size2D = window.Size;
+ window.GetDefaultLayer().Add(mRootView);
+
+ TextLabel sampleLabel = new TextLabel("Blue Widget ");
+ sampleLabel.FontFamily = "SamsungOneUI 500";
+ sampleLabel.PointSize = 8;
+ sampleLabel.TextColor = Color.Black;
+ sampleLabel.SizeWidth = 300;
+ sampleLabel.PivotPoint = PivotPoint.Center;
+ mRootView.Add(sampleLabel);
+ }
+
+ protected override void OnPause()
+ {
+ base.OnPause();
+ }
+
+ protected override void OnResume()
+ {
+ base.OnResume();
+ }
+
+ protected override void OnResize(Window window)
+ {
+ base.OnResize(window);
+ }
+
+ protected override void OnTerminate(string contentInfo, TerminationType type)
+ {
+ base.OnTerminate(contentInfo, type);
+ }
+
+ protected override void OnUpdate(string contentInfo, int force)
+ {
+ base.OnUpdate(contentInfo, force);
+ }
+
+ private View mRootView;
+ }
+
+ class Program : NUIWidgetApplication
+ {
+ public Program(Dictionary<System.Type, string> widgetSet) : base(widgetSet)
+ {
+
+ }
+
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+ Initialize();
+ }
+
+ void Initialize()
+ {
+ }
+
+ 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)
+ {
+ Dictionary<System.Type, string> widgetSet = new Dictionary<Type, string>();
+ widgetSet.Add(typeof(RedWidget), "class1@Tizen.NUI.WidgetTest");
+ widgetSet.Add(typeof(BlueWidget), "class2@Tizen.NUI.WidgetTest");
+ var app = new Program(widgetSet);
+ app.Run(args);
+ }
+ }
+}
+
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>netcoreapp2.0</TargetFramework>
+ <AssemblyName>Tizen.NUI.WidgetTest</AssemblyName>
+ <SignAssembly>true</SignAssembly>
+ <PackageId>Tizen.NUI.WidgetTest</PackageId>
+ <Authors>Tizen.NUI.WidgetTest</Authors>
+ <Company>Tizen.NUI.WidgetTest</Company>
+ <Product>Tizen.NUI.WidgetTest</Product>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugType>portable</DebugType>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>None</DebugType>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="../../../../src/Tizen.NUI/Tizen.NUI.csproj" />
+ <PackageReference Include="Tizen.NET.Sdk" Version="1.0.9" />
+ </ItemGroup>
+
+</Project>
+
--- /dev/null
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30309.148
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.NUI.WidgetTest", "Tizen.NUI.WidgetTest.csproj", "{3C6CE4CE-9D35-42C9-B23D-BBFFA96B3955}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {3C6CE4CE-9D35-42C9-B23D-BBFFA96B3955}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3C6CE4CE-9D35-42C9-B23D-BBFFA96B3955}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3C6CE4CE-9D35-42C9-B23D-BBFFA96B3955}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3C6CE4CE-9D35-42C9-B23D-BBFFA96B3955}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {355D568D-D02A-490A-A6AC-FD6C7D97457A}
+ EndGlobalSection
+EndGlobal
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="5" package="Tizen.NUI.WidgetTest" version="1.0.0">
+ <profile name="common" />
+ <widget-application appid="Tizen.NUI.WidgetTest"
+ exec="Tizen.NUI.WidgetTest.dll"
+ type="dotnet"
+ multiple="false"
+ taskmanage="true"
+ nodisplay="false"
+ launch_mode="single">
+ <label>Tizen.NUI.WidgetTest</label>
+ <icon>Tizen.NUI.WidgetTest.png</icon>
+ <widget-class classid="class1" update-period="0">
+ <support-size preview="Tizen.NUI.WidgetTest.png">4x4</support-size>
+ </widget-class>
+ <widget-class classid="class2" update-period="0">
+ <support-size preview="Tizen.NUI.WidgetTest.png">4x4</support-size>
+ </widget-class>
+ <metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
+ </widget-application>
+</manifest>
+
--- /dev/null
+/*
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * 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.BaseComponents;
+using Tizen.Applications;
+namespace WidgetApplicationTemplate
+{
+ class Program : NUIApplication
+ {
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+ Initialize();
+ }
+ void Initialize()
+ {
+ Window window = GetDefaultWindow();
+
+ window.KeyEvent += OnKeyEvent;
+ window.TouchEvent += OnTouchEvent;
+
+ rootView = new View();
+ rootView.BackgroundColor = Color.White;
+ rootView.Size = Window.Instance.Size;
+ rootView.PivotPoint = PivotPoint.Center;
+ window.GetDefaultLayer().Add(rootView);
+
+ TextLabel sampleLabel = new TextLabel("Widget Viewer ");
+ sampleLabel.FontFamily = "SamsungOneUI 500";
+ sampleLabel.PointSize = 8;
+ sampleLabel.TextColor = Color.Black;
+ sampleLabel.SizeWidth = 300;
+ sampleLabel.PivotPoint = PivotPoint.Center;
+ rootView.Add(sampleLabel);
+
+ Bundle bundle = new Bundle();
+ bundle.AddItem("COUNT", "1");
+ String encodedBundle = bundle.Encode();
+
+ widgetWidth = 500;
+ widgetHeight = 500;
+ mWidgetView = WidgetViewManager.Instance.AddWidget("class1@Tizen.NUI.WidgetTest", encodedBundle, widgetWidth, widgetHeight, 0.0f);
+ mWidgetView.Position = new Position(100,100);
+ window.GetDefaultLayer().Add(mWidgetView);
+
+ mWidgetView2 = WidgetViewManager.Instance.AddWidget("class2@Tizen.NUI.WidgetTest", encodedBundle, widgetWidth, widgetHeight, 0.0f);
+ mWidgetView2.Position = new Position(100, widgetHeight + 110);
+ window.GetDefaultLayer().Add(mWidgetView2);
+
+
+ }
+ public void OnKeyEvent(object sender, Window.KeyEventArgs e)
+ {
+ if (e.Key.State == Key.StateType.Down )
+ {
+ Tizen.Log.Info("NUI", "OnKeyEvent(View-Window) : " + e.Key.KeyPressedName + "\n");
+ if (e.Key.KeyPressedName == "1")
+ {
+ widgetWidth += 200;
+ widgetHeight += 200;
+ if(widgetWidth > 1000 || widgetHeight > 1000)
+ {
+ widgetWidth = 200;
+ widgetHeight = 200;
+ }
+ mWidgetView.Size2D = new Size2D(widgetWidth, widgetHeight);
+ }
+
+ }
+ }
+ private void OnTouchEvent(object source, Window.TouchEventArgs e)
+ {
+ }
+ private void OnWidgetContentUpdatedCB(object sender, WidgetView.WidgetViewEventArgs e)
+ {
+ String encodedBundle = e.WidgetView.ContentInfo;
+ Bundle bundle = Bundle.Decode(encodedBundle);
+ string outString;
+ if (bundle.TryGetItem("WidgetKey", out outString))
+ {
+ Tizen.Log.Info("NUI", "OnWidgetContentUpdatedCB : " + outString + "\n");
+ }
+
+ }
+
+ static void Main(string[] args)
+ {
+ var app = new Program();
+ app.Run(args);
+ }
+
+ private View rootView;
+ WidgetView mWidgetView;
+ WidgetView mWidgetView2;
+ int widgetWidth;
+ int widgetHeight;
+ }
+}
+
+
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>netcoreapp2.0</TargetFramework>
+ <AssemblyName>Tizen.NUI.WidgetViewTest</AssemblyName>
+ <SignAssembly>true</SignAssembly>
+ <PackageId>Tizen.NUI.WidgetViewTest</PackageId>
+ <Authors>Tizen.NUI.WidgetViewTest</Authors>
+ <Company>Tizen.NUI.WidgetViewTest</Company>
+ <Product>Tizen.NUI.WidgetViewTest</Product>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugType>portable</DebugType>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>None</DebugType>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="../../../../src/Tizen.NUI/Tizen.NUI.csproj" />
+ <PackageReference Include="Tizen.NET.Sdk" Version="1.0.9" />
+ </ItemGroup>
+
+</Project>
+
--- /dev/null
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30309.148
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.NUI.WidgetViewTest", "Tizen.NUI.WidgetViewTest.csproj", "{3C6CE4CE-9D35-42C9-B23D-BBFFA96B3955}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {3C6CE4CE-9D35-42C9-B23D-BBFFA96B3955}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3C6CE4CE-9D35-42C9-B23D-BBFFA96B3955}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3C6CE4CE-9D35-42C9-B23D-BBFFA96B3955}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3C6CE4CE-9D35-42C9-B23D-BBFFA96B3955}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {355D568D-D02A-490A-A6AC-FD6C7D97457A}
+ EndGlobalSection
+EndGlobal
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest package="Tizen.NUI.WidgetViewTest" version="1.0.0" api-version="4" xmlns="http://tizen.org/ns/packages">
+ <profile name="tv" />
+ <ui-application appid="Tizen.NUI.WidgetViewTest" exec="Tizen.NUI.WidgetViewTest.dll" multiple="false" nodisplay="false" taskmanage="true"
+ splash-screen-display="true"
+ type="dotnet"
+ launch_mode="single">
+ <label>Tizen.NUI.WidgetViewTest</label>
+ <icon>Tizen.NUI.WidgetViewTest.png</icon>
+ <metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
+ <splash-screens />
+ </ui-application>
+ <privileges>
+ <privilege>http://tizen.org/privilege/widget.viewer</privilege>
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ <privilege>http://tizen.org/privilege/datasharing</privilege>
+ </privileges>
+</manifest>