Revert "[NUI] Dialog and AlertDialog code refactoring with adding DialogPage"
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Samples / Tizen.NUI.Samples / Samples / DatePickerSample.cs
1 using System;
2 using System.Collections.Generic;
3 using Tizen.NUI;
4 using Tizen.NUI.BaseComponents;
5 using Tizen.NUI.Components;
6
7 namespace Tizen.NUI.Samples
8 {
9     //Please expand Window size, When it runs on Ubuntu.
10     public class DatePickerSample : IExample
11     {
12         private static int pickerWidth = 600;
13         private static int pickerHeight = 339;
14         private Window window;
15         private DatePicker datePicker;
16
17         private void OnValueChanged(object sender, DateChangedEventArgs e)
18         {
19             Console.WriteLine(" Date is " + e.Day + " " + e.Month + " " + e.Year);
20         }
21
22         public void Activate()
23         {
24             window = NUIApplication.GetDefaultWindow();
25             window.BackgroundColor = Color.White;
26
27             datePicker = new DatePicker()
28             {
29                 Size = new Size(pickerWidth, pickerHeight),
30                 Position = new Position(Window.Instance.Size.Width / 2 - pickerWidth / 2, Window.Instance.Size.Height/ 2 - pickerHeight / 2),
31
32                 Day = 1,
33                 Month = 10,
34                 Year = 2021,
35             };
36             datePicker.DateChanged += OnValueChanged;
37             window.Add(datePicker);
38         }
39         public void Deactivate()
40         {
41             window.Remove(datePicker);
42             datePicker.Dispose();
43             datePicker = null;
44         }
45     }
46 }