From c26f0e521b59ace5addd7c2be3baeaa2d103a0b3 Mon Sep 17 00:00:00 2001 From: "xb.teng" Date: Thu, 24 Aug 2017 18:59:19 +0800 Subject: [PATCH] [Tizen] Add Interval property for Timer Conflicts: NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj Change-Id: I22f83894065752d245150cb1374f6f4f456aa312 --- .../NUISamples.TizenTV/NUISamples.TizenTV.csproj | 206 +++++++++++++++++++++ .../NUISamples.TizenTV/examples/timer-test.cs | 112 +++++++++++ Tizen.NUI/src/public/Timer.cs | 15 ++ 3 files changed, 333 insertions(+) create mode 100755 NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj create mode 100755 NUISamples/NUISamples/NUISamples.TizenTV/examples/timer-test.cs diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj b/NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj new file mode 100755 index 0000000..4901499 --- /dev/null +++ b/NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj @@ -0,0 +1,206 @@ + + + + 14.0 + Debug + AnyCPU + 8.0.30703 + 2.0 + {2F98DAC9-6F16-457B-AED7-D43CAC379341};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {7731BE98-0A68-49A9-877C-A30A0D30D9F6} + Exe + Properties + NUISamples.TizenTV + NUISamples.TizenTV + 512 + en-US + + + DNXCore + v5.0 + false + .NETCoreApp,Version=v1.0 + true + $(NoWarn);1701 + false + + + true + portable + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + portable + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {f03a3b48-9d9b-4bf3-92ce-bd63cadc3cd3} + Tizen.NUI + + + {56ca3b27-c662-4ac8-93ca-7acef926b2aa} + NUISamples-dummy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory) + <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory) + true + + + + + + + + + + + + diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/timer-test.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/timer-test.cs new file mode 100755 index 0000000..6b408e7 --- /dev/null +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/timer-test.cs @@ -0,0 +1,112 @@ +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Constants; + +namespace TimerTest +{ + // An example of Visual View control. + class Example : NUIApplication + { + private static int i = 0; + + public Example() : base() + { + } + + protected override void OnCreate() + { + base.OnCreate(); + Initialize(); + } + + public void Initialize() + { + Window window = Window.Instance; + window.BackgroundColor = Color.White; + + TextLabel label = new TextLabel() + { + Text = "Steps: 0", + Size2D = new Size2D(460, 80), + Position2D = new Position2D(10, 10) + }; + + RadioButton radio1 = new RadioButton() + { + LabelText = "Set interval 500", + Size2D = new Size2D(300, 50), + Position2D = new Position2D(10, 100), + }; + RadioButton radio2 = new RadioButton() + { + LabelText = "Set interval 1000", + Size2D = new Size2D(300, 50), + Position2D = new Position2D(10, 160), + Selected = true + }; + RadioButton radio3 = new RadioButton() + { + LabelText = "Set interval 3000", + Size2D = new Size2D(300, 50), + Position2D = new Position2D(10, 220), + }; + + PushButton button1 = new PushButton() + { + LabelText = "Start", + Size2D = new Size2D(100, 50), + Position2D = new Position2D(10, 300), + Focusable = true + }; + + PushButton button2 = new PushButton() + { + LabelText = "Stop", + Size2D = new Size2D(100, 50), + Position2D = new Position2D(140, 300), + Focusable = true + }; + + window.Add(label); + window.Add(radio1); + window.Add(radio2); + window.Add(radio3); + window.Add(button1); + window.Add(button2); + + FocusManager.Instance.SetCurrentFocusView(button1); + button1.LeftFocusableView = button1.RightFocusableView = button2; + button2.RightFocusableView = button2.LeftFocusableView = button1; + button1.UpFocusableView = button2.UpFocusableView = radio3; + radio3.UpFocusableView = radio2; + radio2.UpFocusableView = radio1; + radio1.DownFocusableView = radio2; + radio2.DownFocusableView = radio3; + radio3.DownFocusableView = button1; + + Timer timer = new Timer(1000); + timer.Tick += (obj, e) => + { + Tizen.Log.Fatal("NUI", "NUI Timer tick called!"); + label.Text = "Steps: " + (i++); + return true; + }; + + button1.Clicked += (obj, e) => + { + if (radio1.Selected == true) timer.Interval = 500; + if (radio2.Selected == true) timer.Interval = 1000; + if (radio3.Selected == true) timer.Interval = 3000; + timer.Start(); + return true; + }; + button2.Clicked += (obj, e) => + { + timer.Stop(); + return true; + }; + } + } +} diff --git a/Tizen.NUI/src/public/Timer.cs b/Tizen.NUI/src/public/Timer.cs index a062638..cbb7dd6 100755 --- a/Tizen.NUI/src/public/Timer.cs +++ b/Tizen.NUI/src/public/Timer.cs @@ -175,6 +175,21 @@ namespace Tizen.NUI } /// + /// Gets/Sets the interval of the timer. + /// + public uint Interval + { + get + { + return GetInterval(); + } + set + { + SetInterval(value); + } + } + + /// /// Sets a new interval on the timer and starts the timer.
/// Cancels the previous timer.
///
-- 2.7.4