3 using Tizen.NUI.Components;
4 using Tizen.NUI.BaseComponents;
6 namespace DigitalHumanLayer
8 class Program : NUIApplication
10 private const string USER_AGENT = "Mozilla/5.0 (SMART-TV; Linux; Tizen 6.0) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/4.0 Chrome/76.0.3809.146 TV Safari/537.36";
11 private static string[] runtimeArgs = { "org.tizen.example.DigitalHumanLayer", "--enable-dali-window", "--enable-spatial-navigation" };
13 //Define WebView Variable as Member Variable
16 //Control Position Animation for WebView
17 Animation moveAnimation;
18 AlphaFunction alphaFunction;
19 Button moveTopButton, moveBottomButton, moveLeftButton, moveCenterButton, moveRightButton;
20 protected override void OnCreate()
26 protected override void OnTerminate()
32 void ResetMoveAnimation()
34 //Reset previous moving animation
38 moveAnimation.Dispose();
40 moveAnimation = new Animation(600);
41 alphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutSine);
42 moveAnimation.DefaultAlphaFunction = alphaFunction;
48 Window.Instance.WindowSize = new Size(1920, 1080);
50 //Make Window Transparency
51 Window.Instance.BackgroundColor = Color.Transparent;
52 Window.Instance.SetTransparency(true);
54 //Ignore Key Events for Receiving remote controller event
55 Window.Instance.SetAcceptFocus(false);
57 //Set Window Notification Type
58 Window.Instance.Type = WindowType.Notification;
60 //Make Window Notification Level Top
61 Window.Instance.SetNotificationLevel(NotificationLevel.Top);
64 webView = new WebView(runtimeArgs)
66 Size = new Size(500, 500),
67 Position = new Position(750, 300),
68 UserAgent = USER_AGENT,
70 VideoHoleEnabled = true,
73 webView.LoadUrl("https://www.youtube.com");
75 //Initialize Move Animation for WebView
76 moveAnimation = new Animation(600);
77 alphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseInOut);
78 moveAnimation.DefaultAlphaFunction = alphaFunction;
80 moveTopButton = new Button()
82 Size = new Size(200, 100),
83 Position = new Position(210, 220),
86 moveTopButton.Clicked += (object source, ClickedEventArgs args) =>
88 //Move Position 750, 0 (Pivot is LeftTop of WebView)
90 moveAnimation.AnimateTo(webView, "PositionX", 750);
91 moveAnimation.AnimateTo(webView, "PositionY", 0);
95 moveBottomButton = new Button()
97 Size = new Size(200, 100),
98 Position = new Position(210, 440),
101 moveBottomButton.Clicked += (object source, ClickedEventArgs args) =>
103 //Move Position 750, 600 (Pivot is LeftTop of WebView)
104 ResetMoveAnimation();
105 moveAnimation.AnimateTo(webView, "PositionX", 750);
106 moveAnimation.AnimateTo(webView, "PositionY", 600);
107 moveAnimation.Play();
110 moveLeftButton = new Button()
112 Size = new Size(200, 100),
113 Position = new Position(0, 330),
116 moveLeftButton.Clicked += (object source, ClickedEventArgs args) =>
118 //Move Position 300, 300 (Pivot is LeftTop of WebView)
119 ResetMoveAnimation();
120 moveAnimation.AnimateTo(webView, "PositionX", 300);
121 moveAnimation.AnimateTo(webView, "PositionY", 300);
122 moveAnimation.Play();
125 moveCenterButton = new Button()
127 Size = new Size(200, 100),
128 Position = new Position(210, 330),
131 moveCenterButton.Clicked += (object source, ClickedEventArgs args) =>
133 //Move Position 750, 300 (Pivot is LeftTop of WebView)
134 ResetMoveAnimation();
135 moveAnimation.AnimateTo(webView, "PositionX", 750);
136 moveAnimation.AnimateTo(webView, "PositionY", 300);
137 moveAnimation.Play();
140 moveRightButton = new Button()
142 Size = new Size(200, 100),
143 Position = new Position(420, 330),
146 moveRightButton.Clicked += (object source, ClickedEventArgs args) =>
148 //Move Position 1400, 300 (Pivot is LeftTop of WebView)
149 ResetMoveAnimation();
150 moveAnimation.AnimateTo(webView, "PositionX", 1400);
151 moveAnimation.AnimateTo(webView, "PositionY", 300);
152 moveAnimation.Play();
155 //Add WebView and NUI Buttons to Main Window
156 Window.Instance.GetDefaultLayer().Add(moveTopButton);
157 Window.Instance.GetDefaultLayer().Add(moveBottomButton);
158 Window.Instance.GetDefaultLayer().Add(moveLeftButton);
159 Window.Instance.GetDefaultLayer().Add(moveCenterButton);
160 Window.Instance.GetDefaultLayer().Add(moveRightButton);
161 Window.Instance.GetDefaultLayer().Add(webView);
166 //Remove WebView and NUI Buttons from Main Window
167 Window.Instance.GetDefaultLayer().Remove(moveTopButton);
168 Window.Instance.GetDefaultLayer().Remove(moveBottomButton);
169 Window.Instance.GetDefaultLayer().Remove(moveLeftButton);
170 Window.Instance.GetDefaultLayer().Remove(moveCenterButton);
171 Window.Instance.GetDefaultLayer().Remove(moveRightButton);
172 Window.Instance.GetDefaultLayer().Remove(webView);
175 static void Main(string[] args)
177 var app = new Program();