<ItemGroup>
<PackageReference Include="Tizen.NET.Sdk" Version="1.1.2" />
<PackageReference Include="Tizen.NET" Version="8.0.0.15595" />
+ <PackageReference Include="Tizen.NUI.XamlBuild" Version="1.0.11" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
+ <ItemGroup>
+ <None Remove="res\layout\1280x720\MainView.xaml" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <EmbeddedResource Include="res\layout\1280x720\MainView.xaml" />
+ </ItemGroup>
+
</Project>
using System;
using Fitness.Services;
+using Fitness.Views;
using Tizen.NUI;
using Tizen.NUI.BaseComponents;
public void Initialize()
{
- Window.Instance.KeyEvent += OnKeyEvent;
-
- TextLabel text = new TextLabel("Hello Tizen NUI World");
- text.HorizontalAlignment = HorizontalAlignment.Center;
- text.VerticalAlignment = VerticalAlignment.Center;
- text.TextColor = Color.Blue;
- text.PointSize = 12.0f;
- text.HeightResizePolicy = ResizePolicyType.FillToParent;
- text.WidthResizePolicy = ResizePolicyType.FillToParent;
- Window.Instance.GetDefaultLayer().Add(text);
-
- Animation animation = new Animation(2000);
- animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(180.0f)), PositionAxis.X), 0, 500);
- animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(0.0f)), PositionAxis.X), 500, 1000);
- animation.Looping = true;
- animation.Play();
- }
-
- public void OnKeyEvent(object sender, Window.KeyEventArgs e)
- {
- if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape"))
- {
- Exit();
- }
+ Window.Instance.GetDefaultLayer().Add(new MainView());
}
protected override void OnCreate()
--- /dev/null
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+
+namespace Fitness.ViewModels
+{
+ /// <summary>
+ /// Common Base class for all ViewModels
+ /// </summary>
+ public abstract class BaseViewModel : INotifyPropertyChanged
+ {
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ /// <summary>
+ /// Raises PropertyChanged event
+ /// </summary>
+ protected void RaisePropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+}
--- /dev/null
+using System;
+
+namespace Fitness.ViewModels
+{
+ public class MainViewModel : BaseViewModel
+ {
+ private string text;
+
+ public MainViewModel()
+ {
+ Text = "Fitness App";
+ }
+
+ public string Text
+ {
+ get
+ {
+ return text;
+ }
+
+ set
+ {
+ text = value;
+ RaisePropertyChanged();
+ }
+ }
+ }
+}
--- /dev/null
+using Tizen.NUI.BaseComponents;
+
+namespace Fitness.Views
+{
+ public partial class MainView : View
+ {
+ public MainView()
+ {
+ InitializeComponent();
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<View x:Class="Fitness.Views.MainView"
+ xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:vm="clr-namespace:Fitness.ViewModels;"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ Size="1280,720" BackgroundColor="Red" ParentOrigin="Center" PivotPoint="Center" PositionUsesPivotPoint="true">
+ <View.BindingContext>
+ <vm:MainViewModel/>
+ </View.BindingContext>
+ <View.Layout>
+ <LinearLayout LinearOrientation="Vertical" CellPadding="50,50" LinearAlignment="Center"/>
+ </View.Layout>
+ <TextLabel Text="{Binding Text}" HorizontalAlignment="Center" VerticalAlignment="Center" Size="300, 50" BackgroundColor="Cyan"/>
+</View>