Merge remote-tracking branch 'origin/master' into tizen
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.WindowSystem.Samples / Tizen.NUI.WindowSystem.Samples.cs
1 using System;
2 using System.Runtime.CompilerServices;
3 using System.Threading.Tasks;
4 using Tizen.Applications.ComponentBased.Common;
5 using Tizen.NUI;
6 using Tizen.NUI.BaseComponents;
7 using Tizen.NUI.Components;
8 using Tizen.NUI.WindowSystem;
9
10 namespace Tizen.NUI.WindowSystem.Samples
11 {
12     class Program : NUIApplication
13     {
14         Shell.TizenShell tzShell;
15         Shell.QuickPanelClient qpClient;
16         Button BtnClient;
17         TextLabel textClientVisible;
18         TextLabel textClientScrollable;
19         TextLabel textClientOrientation;
20
21         Shell.QuickPanelService qpService;
22         Shell.TizenRegion qpRegion;
23         Button BtnService;
24         Timer _timer;
25
26         Shell.SoftkeyClient softkeyClient;
27         Button BtnSoftkeyClient;
28         TextLabel textSoftkeyClientVisible;
29         TextLabel textSoftkeyClientExpand;
30         TextLabel textSoftkeyClientOpacity;
31
32         Shell.SoftkeyService softkeyService;
33         Button BtnSoftkeyService;
34         TextLabel textSoftkeyServiceVisible;
35         TextLabel textSoftkeyServiceExpand;
36         TextLabel textSoftkeyServiceOpacity;
37
38         protected override void OnCreate()
39         {
40             base.OnCreate();
41             Initialize();
42         }
43
44         void Initialize()
45         {
46             Window window = NUIApplication.GetDefaultWindow();
47             window.KeyEvent += OnKeyEvent;
48             window.BackgroundColor = Color.White;
49
50             BtnClient = new Button()
51             {
52                 Text = "QuickPanelClient",
53                 Size = new Size(400, 100),
54                 Position = new Position(100, 200),
55                 Margin = 10,
56             };
57
58             BtnService = new Button()
59             {
60                 Text = "QuickPanelService",
61                 Size = new Size(400, 100),
62                 Position = new Position(100, 400),
63                 Margin = 10,
64             };
65
66             BtnSoftkeyClient = new Button()
67             {
68                 Text = "SoftkeyClient",
69                 Size = new Size(400, 100),
70                 Position = new Position(100, 600),
71                 Margin = 10,
72             };
73
74             BtnSoftkeyService = new Button()
75             {
76                 Text = "SoftkeyService",
77                 Size = new Size(400, 100),
78                 Position = new Position(100, 800),
79                 Margin = 10,
80             };
81
82             window.Add(BtnClient);
83             window.Add(BtnService);
84             window.Add(BtnSoftkeyClient);
85             window.Add(BtnSoftkeyService);
86
87             BtnClient.ClickEvent += BtnClient_ClickEvent;
88             BtnService.ClickEvent += BtnService_ClickEvent;
89             BtnSoftkeyClient.ClickEvent += BtnSoftkeyClient_ClickEvent;
90             BtnSoftkeyService.ClickEvent += BtnSoftkeyService_ClickEvent;
91
92             tzShell = new Shell.TizenShell();
93
94             window.AddAvailableOrientation(Window.WindowOrientation.Portrait);
95             window.AddAvailableOrientation(Window.WindowOrientation.Landscape);
96             window.AddAvailableOrientation(Window.WindowOrientation.PortraitInverse);
97             window.AddAvailableOrientation(Window.WindowOrientation.LandscapeInverse);
98         }
99
100         public void OnKeyEvent(object sender, Window.KeyEventArgs e)
101         {
102             if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape"))
103             {
104                 Exit();
105             }
106         }
107
108         public void OnVisibleEvent(object sender, Shell.QuickPanelClient.VisibleState state)
109         {
110             textClientVisible.Text = $"Visible: {qpClient.Visible}";
111         }
112
113         public void OnOrientationEvent(object sender, Window.WindowOrientation state)
114         {
115             textClientOrientation.Text = $"Orientation: {qpClient.Orientation}";
116         }
117
118         private void BtnClient_ClickEvent(object sender, Button.ClickEventArgs e)
119         {
120             Window window = NUIApplication.GetDefaultWindow();
121
122             window.Remove(BtnService);
123             window.Remove(BtnClient);
124             window.Remove(BtnSoftkeyService);
125             window.Remove(BtnSoftkeyClient);
126             qpClient = new Shell.QuickPanelClient(tzShell, window, Shell.QuickPanelClient.Types.SystemDefault);
127
128             qpClient.VisibleChanged += OnVisibleEvent;
129             qpClient.OrientationChanged += OnOrientationEvent;
130
131             textClientVisible = new TextLabel($"Visible: {qpClient.Visible}");
132             textClientVisible.Position = new Position(0, -100);
133             textClientVisible.HorizontalAlignment = HorizontalAlignment.Center;
134             textClientVisible.VerticalAlignment = VerticalAlignment.Center;
135             textClientVisible.TextColor = Color.Blue;
136             textClientVisible.PointSize = 12.0f;
137             textClientVisible.HeightResizePolicy = ResizePolicyType.FillToParent;
138             textClientVisible.WidthResizePolicy = ResizePolicyType.FillToParent;
139             window.Add(textClientVisible);
140
141             textClientScrollable = new TextLabel($"Scrollable: {qpClient.Scrollable}");
142             textClientScrollable.HorizontalAlignment = HorizontalAlignment.Center;
143             textClientScrollable.VerticalAlignment = VerticalAlignment.Center;
144             textClientScrollable.TextColor = Color.Blue;
145             textClientScrollable.PointSize = 12.0f;
146             textClientScrollable.HeightResizePolicy = ResizePolicyType.FillToParent;
147             textClientScrollable.WidthResizePolicy = ResizePolicyType.FillToParent;
148             window.Add(textClientScrollable);
149
150             textClientOrientation = new TextLabel($"Orientation: {qpClient.Orientation}");
151             textClientOrientation.Position = new Position(0, 100);
152             textClientOrientation.HorizontalAlignment = HorizontalAlignment.Center;
153             textClientOrientation.VerticalAlignment = VerticalAlignment.Center;
154             textClientOrientation.TextColor = Color.Blue;
155             textClientOrientation.PointSize = 12.0f;
156             textClientOrientation.HeightResizePolicy = ResizePolicyType.FillToParent;
157             textClientOrientation.WidthResizePolicy = ResizePolicyType.FillToParent;
158             window.Add(textClientOrientation);
159
160             Button BtnScrollableSet = new Button()
161             {
162                 Text = "Scrollable Set",
163                 Size = new Size(400, 100),
164                 Position = new Position(50, 800),
165                 Margin = 10,
166             };
167             Button BtnScrollableUnset = new Button()
168             {
169                 Text = "Scrollable Unset",
170                 Size = new Size(400, 100),
171                 Position = new Position(50, 920),
172                 Margin = 10,
173             };
174             Button BtnScrollableRetain = new Button()
175             {
176                 Text = "Scrollable Retain",
177                 Size = new Size(400, 100),
178                 Position = new Position(50, 1040),
179                 Margin = 10,
180             };
181             Button BtnShow = new Button()
182             {
183                 Text = "Show",
184                 Size = new Size(200, 100),
185                 Position = new Position(470, 850),
186                 Margin = 10,
187             };
188             Button BtnHide = new Button()
189             {
190                 Text = "Hide",
191                 Size = new Size(200, 100),
192                 Position = new Position(470, 990),
193                 Margin = 10,
194             };
195
196             BtnScrollableSet.ClickEvent += BtnScrollableSet_ClickEvent;
197             BtnScrollableUnset.ClickEvent += BtnScrollableUnset_ClickEvent;
198             BtnScrollableRetain.ClickEvent += BtnScrollableRetain_ClickEvent;
199             BtnShow.ClickEvent += BtnClientShow_ClickEvent;
200             BtnHide.ClickEvent += BtnClientHide_ClickEvent;
201
202             window.Add(BtnScrollableSet);
203             window.Add(BtnScrollableUnset);
204             window.Add(BtnScrollableRetain);
205             window.Add(BtnShow);
206             window.Add(BtnHide);
207         }
208
209         private void BtnScrollableSet_ClickEvent(object sender, Button.ClickEventArgs e)
210         {
211             qpClient.Scrollable = Shell.QuickPanelClient.ScrollableState.Set;
212             textClientScrollable.Text = $"Scrollable: {qpClient.Scrollable}";
213         }
214         private void BtnScrollableUnset_ClickEvent(object sender, Button.ClickEventArgs e)
215         {
216             qpClient.Scrollable = Shell.QuickPanelClient.ScrollableState.Unset;
217             textClientScrollable.Text = $"Scrollable: {qpClient.Scrollable}";
218         }
219         private void BtnScrollableRetain_ClickEvent(object sender, Button.ClickEventArgs e)
220         {
221             qpClient.Scrollable = Shell.QuickPanelClient.ScrollableState.Retain;
222             textClientScrollable.Text = $"Scrollable: {qpClient.Scrollable}";
223         }
224         private void BtnClientShow_ClickEvent(object sender, Button.ClickEventArgs e)
225         {
226             qpClient.Show();
227         }
228         private void BtnClientHide_ClickEvent(object sender, Button.ClickEventArgs e)
229         {
230             qpClient.Hide();
231         }
232
233         private void BtnService_ClickEvent(object sender, Button.ClickEventArgs e)
234         {
235             Window window = NUIApplication.GetDefaultWindow();
236             Shell.QuickPanelService.Types type = Shell.QuickPanelService.Types.AppsMenu;
237
238             window.Remove(BtnService);
239             window.Remove(BtnClient);
240             window.Remove(BtnSoftkeyService);
241             window.Remove(BtnSoftkeyClient);
242             qpService = new Shell.QuickPanelService(tzShell, window, type);
243             //if ((type == Shell.QuickPanelService.Types.ContextMenu) || (type == Shell.QuickPanelService.Types.AppsMenu))
244                 //window.AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
245
246             TextLabel textServiceType = new TextLabel($"Type: {qpService.ServiceType}");
247             textServiceType.Position = new Position(0, -300);
248             textServiceType.HorizontalAlignment = HorizontalAlignment.Center;
249             textServiceType.VerticalAlignment = VerticalAlignment.Center;
250             textServiceType.TextColor = Color.Blue;
251             textServiceType.PointSize = 12.0f;
252             textServiceType.HeightResizePolicy = ResizePolicyType.FillToParent;
253             textServiceType.WidthResizePolicy = ResizePolicyType.FillToParent;
254             window.Add(textServiceType);
255
256             Button BtnShow = new Button()
257             {
258                 Text = "Show",
259                 Size = new Size(200, 100),
260                 Position = new Position(50, 500),
261                 Margin = 10,
262             };
263             Button BtnHide = new Button()
264             {
265                 Text = "Hide",
266                 Size = new Size(200, 100),
267                 Position = new Position(410, 500),
268                 Margin = 10,
269             };
270
271             Button BtnEffectSwipe = new Button()
272             {
273                 Text = "EffectSwipe",
274                 Size = new Size(400, 80),
275                 Position = new Position(50, 700),
276                 Margin = 10,
277             };
278             Button BtnEffectMove = new Button()
279             {
280                 Text = "EffectMove",
281                 Size = new Size(400, 80),
282                 Position = new Position(50, 800),
283                 Margin = 10,
284             };
285             Button BtnEffectAppCustom = new Button()
286             {
287                 Text = "EffectAppCustom",
288                 Size = new Size(400, 80),
289                 Position = new Position(50, 900),
290                 Margin = 10,
291             };
292
293             Button BtnLockTrue = new Button()
294             {
295                 Text = "LockTrue",
296                 Size = new Size(300, 80),
297                 Position = new Position(50, 1000),
298                 Margin = 10,
299             };
300             Button BtnLockFalse = new Button()
301             {
302                 Text = "LockFalse",
303                 Size = new Size(300, 80),
304                 Position = new Position(400, 1000),
305                 Margin = 10,
306             };
307             Button BtnTimerStop = new Button()
308             {
309                 Text = "TimerStop",
310                 Size = new Size(300, 80),
311                 Position = new Position(50, 50),
312                 Margin = 10,
313             };
314
315             BtnShow.ClickEvent += BtnServiceShow_ClickEvent;
316             BtnHide.ClickEvent += BtnServiceHide_ClickEvent;
317
318             BtnEffectSwipe.ClickEvent += BtnEffectSwipe_ClickEvent;
319             BtnEffectMove.ClickEvent += BtnEffectMove_ClickEvent;
320             BtnEffectAppCustom.ClickEvent += BtnEffectAppCustom_ClickEvent;
321
322             BtnLockTrue.ClickEvent += BtnLockTrue_ClickEvent;
323             BtnLockFalse.ClickEvent += BtnLockFalse_ClickEvent;
324
325             BtnTimerStop.ClickEvent += BtnTimerStop_ClickEvent;
326
327             window.Add(BtnShow);
328             window.Add(BtnHide);
329
330             window.Add(BtnEffectSwipe);
331             window.Add(BtnEffectMove);
332             window.Add(BtnEffectAppCustom);
333
334             window.Add(BtnLockTrue);
335             window.Add(BtnLockFalse);
336
337             window.Add(BtnTimerStop);
338
339             qpRegion = new Shell.TizenRegion(tzShell);
340             qpRegion.Add(window.WindowPosition.X, window.WindowPosition.Y, window.WindowSize.Width, window.WindowSize.Height - 50);
341             qpService.SetContentRegion(0, qpRegion);
342             qpRegion.Dispose();
343
344             qpRegion = new Shell.TizenRegion(tzShell);
345             qpRegion.Add(window.WindowPosition.X, window.WindowPosition.Y + window.WindowSize.Height - 50, window.WindowSize.Width, 50);
346             qpService.SetHandlerRegion(0, qpRegion);
347             qpRegion.Dispose();
348
349             _timer = new Timer(2000);
350             _timer.Tick += Timer_Tick;
351             _timer.Start();
352         }
353
354         bool _cnt = true;
355
356         private bool Timer_Tick(object source, Timer.TickEventArgs e)
357         {
358             if (_cnt)
359             {
360                 qpService.Show();
361             }
362             else
363             {
364                 qpService.Hide();
365             }
366             _cnt = !_cnt;
367             return true;
368
369         }
370
371         private void BtnServiceShow_ClickEvent(object sender, Button.ClickEventArgs e)
372         {
373             qpService.Show();
374         }
375         private void BtnServiceHide_ClickEvent(object sender, Button.ClickEventArgs e)
376         {
377             qpService.Hide();
378         }
379
380         private void BtnEffectSwipe_ClickEvent(object sender, Button.ClickEventArgs e)
381         {
382             qpService.SetEffectType(Shell.QuickPanelService.EffectType.Swipe);
383         }
384         private void BtnEffectMove_ClickEvent(object sender, Button.ClickEventArgs e)
385         {
386             qpService.SetEffectType(Shell.QuickPanelService.EffectType.Move);
387         }
388         private void BtnEffectAppCustom_ClickEvent(object sender, Button.ClickEventArgs e)
389         {
390             qpService.SetEffectType(Shell.QuickPanelService.EffectType.Custom);
391         }
392         private void BtnLockTrue_ClickEvent(object sender, Button.ClickEventArgs e)
393         {
394             qpService.LockScroll(true);
395         }
396         private void BtnLockFalse_ClickEvent(object sender, Button.ClickEventArgs e)
397         {
398             qpService.LockScroll(false);
399         }
400         private void BtnTimerStop_ClickEvent(object sender, Button.ClickEventArgs e)
401         {
402             _timer.Stop();
403         }
404
405         private void BtnSoftkeyClient_ClickEvent(object sender, Button.ClickEventArgs e)
406         {
407             Window window = NUIApplication.GetDefaultWindow();
408
409             window.Remove(BtnService);
410             window.Remove(BtnClient);
411             window.Remove(BtnSoftkeyService);
412             window.Remove(BtnSoftkeyClient);
413             softkeyClient = new Shell.SoftkeyClient(tzShell, window);
414
415             textSoftkeyClientVisible = new TextLabel($"Visible: {softkeyClient.Visible}");
416             textSoftkeyClientVisible.Position = new Position(0, -100);
417             textSoftkeyClientVisible.HorizontalAlignment = HorizontalAlignment.Center;
418             textSoftkeyClientVisible.VerticalAlignment = VerticalAlignment.Center;
419             textSoftkeyClientVisible.TextColor = Color.Blue;
420             textSoftkeyClientVisible.PointSize = 12.0f;
421             textSoftkeyClientVisible.HeightResizePolicy = ResizePolicyType.FillToParent;
422             textSoftkeyClientVisible.WidthResizePolicy = ResizePolicyType.FillToParent;
423             window.Add(textSoftkeyClientVisible);
424
425             textSoftkeyClientExpand = new TextLabel($"Expand: {softkeyClient.Expand}");
426             textSoftkeyClientExpand.Position = new Position(0, 0);
427             textSoftkeyClientExpand.HorizontalAlignment = HorizontalAlignment.Center;
428             textSoftkeyClientExpand.VerticalAlignment = VerticalAlignment.Center;
429             textSoftkeyClientExpand.TextColor = Color.Blue;
430             textSoftkeyClientExpand.PointSize = 12.0f;
431             textSoftkeyClientExpand.HeightResizePolicy = ResizePolicyType.FillToParent;
432             textSoftkeyClientExpand.WidthResizePolicy = ResizePolicyType.FillToParent;
433             window.Add(textSoftkeyClientExpand);
434
435             textSoftkeyClientOpacity = new TextLabel($"Opacity: {softkeyClient.Opacity}");
436             textSoftkeyClientOpacity.Position = new Position(0, 100);
437             textSoftkeyClientOpacity.HorizontalAlignment = HorizontalAlignment.Center;
438             textSoftkeyClientOpacity.VerticalAlignment = VerticalAlignment.Center;
439             textSoftkeyClientOpacity.TextColor = Color.Blue;
440             textSoftkeyClientOpacity.PointSize = 12.0f;
441             textSoftkeyClientOpacity.HeightResizePolicy = ResizePolicyType.FillToParent;
442             textSoftkeyClientOpacity.WidthResizePolicy = ResizePolicyType.FillToParent;
443             window.Add(textSoftkeyClientOpacity);
444
445             Button BtnExpandSetOn = new Button()
446             {
447                 Text = "Expand On",
448                 Size = new Size(300, 100),
449                 Position = new Position(50, 800),
450                 Margin = 10,
451             };
452             Button BtnExpandSetOff = new Button()
453             {
454                 Text = "Expand Off",
455                 Size = new Size(300, 100),
456                 Position = new Position(400, 800),
457                 Margin = 10,
458             };
459             Button BtnOpacitySetOpaque = new Button()
460             {
461                 Text = "Opacity Opaque",
462                 Size = new Size(300, 100),
463                 Position = new Position(50, 1000),
464                 Margin = 10,
465             };
466             Button BtnOpacitySetTransparent = new Button()
467             {
468                 Text = "Opacity Transparent",
469                 Size = new Size(300, 100),
470                 Position = new Position(400, 1000),
471                 Margin = 10,
472             };
473             Button BtnShow = new Button()
474             {
475                 Text = "Show",
476                 Size = new Size(200, 100),
477                 Position = new Position(50, 1100),
478                 Margin = 10,
479             };
480             Button BtnHide = new Button()
481             {
482                 Text = "Hide",
483                 Size = new Size(200, 100),
484                 Position = new Position(410, 1100),
485                 Margin = 10,
486             };
487
488             BtnExpandSetOn.ClickEvent += BtnExpandSetOn_ClickEvent;
489             BtnExpandSetOff.ClickEvent += BtnExpandSetOff_ClickEvent;
490             BtnOpacitySetOpaque.ClickEvent += BtnOpacitySetOpaque_ClickEvent;
491             BtnOpacitySetTransparent.ClickEvent += BtnOpacitySetTransparent_ClickEvent;
492             BtnShow.ClickEvent += BtnSoftkeyClientShow_ClickEvent;
493             BtnHide.ClickEvent += BtnSoftkeyClientHide_ClickEvent;
494
495             window.Add(BtnExpandSetOn);
496             window.Add(BtnExpandSetOff);
497             window.Add(BtnOpacitySetOpaque);
498             window.Add(BtnOpacitySetTransparent);
499             window.Add(BtnShow);
500             window.Add(BtnHide);
501         }
502
503         private void BtnExpandSetOn_ClickEvent(object sender, Button.ClickEventArgs e)
504         {
505             softkeyClient.Expand = Shell.SoftkeyExpandState.On;
506             textSoftkeyClientExpand.Text = $"Expand: {softkeyClient.Expand}";
507         }
508
509         private void BtnExpandSetOff_ClickEvent(object sender, Button.ClickEventArgs e)
510         {
511             softkeyClient.Expand = Shell.SoftkeyExpandState.Off;
512             textSoftkeyClientExpand.Text = $"Expand: {softkeyClient.Expand}";
513         }
514
515         private void BtnOpacitySetOpaque_ClickEvent(object sender, Button.ClickEventArgs e)
516         {
517             softkeyClient.Opacity = Shell.SoftkeyOpacityState.Opaque;
518             textSoftkeyClientOpacity.Text = $"Opacity: {softkeyClient.Opacity}";
519         }
520
521         private void BtnOpacitySetTransparent_ClickEvent(object sender, Button.ClickEventArgs e)
522         {
523             softkeyClient.Opacity = Shell.SoftkeyOpacityState.Transparent;
524             textSoftkeyClientOpacity.Text = $"Opacity: {softkeyClient.Opacity}";
525         }
526
527         private async Task ControlSoftKeyVisible(bool visible)
528         {
529             if (visible)
530                 softkeyClient.Show();
531             else
532                 softkeyClient.Hide();
533             await Task.Delay(50);
534             textSoftkeyClientVisible.Text = $"Visible: {softkeyClient.Visible}";
535         }
536
537         private void BtnSoftkeyClientShow_ClickEvent(object sender, Button.ClickEventArgs e)
538         {
539             _ = ControlSoftKeyVisible(true);
540         }
541
542         private void BtnSoftkeyClientHide_ClickEvent(object sender, Button.ClickEventArgs e)
543         {
544             _ = ControlSoftKeyVisible(false);
545         }
546
547         private void BtnSoftkeyService_ClickEvent(object sender, Button.ClickEventArgs e)
548         {
549             Window window = NUIApplication.GetDefaultWindow();
550             window.WindowSize = new Size(500, 500);
551             window.WindowPosition = new Position(0, 700);
552
553             window.Remove(BtnService);
554             window.Remove(BtnClient);
555             window.Remove(BtnSoftkeyService);
556             window.Remove(BtnSoftkeyClient);
557             softkeyService = new Shell.SoftkeyService(tzShell, window);
558
559             textSoftkeyServiceVisible = new TextLabel($"Visible: None");
560             textSoftkeyServiceVisible.Position = new Position(0, -100);
561             textSoftkeyServiceVisible.HorizontalAlignment = HorizontalAlignment.Center;
562             textSoftkeyServiceVisible.VerticalAlignment = VerticalAlignment.Center;
563             textSoftkeyServiceVisible.TextColor = Color.Blue;
564             textSoftkeyServiceVisible.PointSize = 12.0f;
565             textSoftkeyServiceVisible.HeightResizePolicy = ResizePolicyType.FillToParent;
566             textSoftkeyServiceVisible.WidthResizePolicy = ResizePolicyType.FillToParent;
567             window.Add(textSoftkeyServiceVisible);
568
569             textSoftkeyServiceExpand = new TextLabel($"Expand: None");
570             textSoftkeyServiceExpand.Position = new Position(0, 0);
571             textSoftkeyServiceExpand.HorizontalAlignment = HorizontalAlignment.Center;
572             textSoftkeyServiceExpand.VerticalAlignment = VerticalAlignment.Center;
573             textSoftkeyServiceExpand.TextColor = Color.Blue;
574             textSoftkeyServiceExpand.PointSize = 12.0f;
575             textSoftkeyServiceExpand.HeightResizePolicy = ResizePolicyType.FillToParent;
576             textSoftkeyServiceExpand.WidthResizePolicy = ResizePolicyType.FillToParent;
577             window.Add(textSoftkeyServiceExpand);
578
579             textSoftkeyServiceOpacity = new TextLabel($"Opacity: None");
580             textSoftkeyServiceOpacity.Position = new Position(0, 100);
581             textSoftkeyServiceOpacity.HorizontalAlignment = HorizontalAlignment.Center;
582             textSoftkeyServiceOpacity.VerticalAlignment = VerticalAlignment.Center;
583             textSoftkeyServiceOpacity.TextColor = Color.Blue;
584             textSoftkeyServiceOpacity.PointSize = 12.0f;
585             textSoftkeyServiceOpacity.HeightResizePolicy = ResizePolicyType.FillToParent;
586             textSoftkeyServiceOpacity.WidthResizePolicy = ResizePolicyType.FillToParent;
587             window.Add(textSoftkeyServiceOpacity);
588
589             Button BtnShow = new Button()
590             {
591                 Text = "Show",
592                 Size = new Size(200, 100),
593                 Position = new Position(50, 800),
594                 Margin = 10,
595             };
596             Button BtnHide = new Button()
597             {
598                 Text = "Hide",
599                 Size = new Size(200, 100),
600                 Position = new Position(410, 800),
601                 Margin = 10,
602             };
603
604             window.Add(BtnShow);
605             window.Add(BtnHide);
606
607             BtnShow.ClickEvent += BtnSoftkeyServiceShow_ClickEvent;
608             BtnHide.ClickEvent += BtnSoftkeyServiceHide_ClickEvent;
609
610             softkeyService.VisibleChanged += OnSoftkeyServiceVisibleEvent;
611             softkeyService.ExpandChanged += OnSoftkeyServiceExpandEvent;
612             softkeyService.OpacityChanged += OnSoftkeyServiceOpacityEvent;
613         }
614
615         public void OnSoftkeyServiceVisibleEvent(object sender, Shell.SoftkeyVisibleState state)
616         {
617             Shell.SoftkeyService obj = (Shell.SoftkeyService)sender;
618             textSoftkeyServiceVisible.Text = $"Visible: {state}";
619             if (state == Shell.SoftkeyVisibleState.Shown)
620             {
621                 obj.Show();
622             }
623             else
624             {
625                 obj.Hide();
626             }
627         }
628
629         public void OnSoftkeyServiceExpandEvent(object sender, Shell.SoftkeyExpandState state)
630         {
631             textSoftkeyServiceExpand.Text = $"Expand: {state}";
632         }
633
634         public void OnSoftkeyServiceOpacityEvent(object sender, Shell.SoftkeyOpacityState state)
635         {
636             textSoftkeyServiceOpacity.Text = $"Opacity: {state}";
637         }
638
639         private void BtnSoftkeyServiceShow_ClickEvent(object sender, Button.ClickEventArgs e)
640         {
641             softkeyService.Show();
642         }
643
644         private void BtnSoftkeyServiceHide_ClickEvent(object sender, Button.ClickEventArgs e)
645         {
646             softkeyService.Hide();
647         }
648
649         static void Main(string[] args)
650         {
651             var app = new Program();
652             app.Run(args);
653         }
654     }
655 }