b36142b2e88570e22099969ef4a9968bc7b1cbfa
[platform/core/csapi/tizenfx.git] / test / NUITestSample / NUIXAMLTestSample / TestAmbient / AmbientDuoPage.xaml.cs
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 using System;
18 using Tizen.NUI.BaseComponents;
19 using Tizen.NUI.UIComponents;
20
21 namespace Tizen.NUI.Examples
22 {
23     public class AmbientDuoPage : ContentPage
24     {
25
26         public AmbientDuoPage(Window win) : base (win)
27         {
28             Content.BackgroundImage = "/home/tengxb/GitRepo/nui-xaml/TestXaml/res/images/ambient/photoduo_img_bg_01_no9patch.png";
29             ClearEvent += OnClearEvent;
30             Content.Opacity = 0.0f;
31         }
32
33         /// <summary>
34         /// To make the ContentPage instance be disposed.
35         /// </summary>
36         protected override void Dispose(DisposeTypes type)
37         {
38             if (disposed)
39             {
40                 return;
41             }
42
43             if (type == DisposeTypes.Explicit)
44             {
45             }
46
47             ClearEvent -= OnClearEvent;
48
49             base.Dispose(type);
50         }
51
52         public override void SetFocus()
53         {
54             Console.WriteLine("AmbientDuoPage focused.");
55             Animation animation = new Animation(2000);
56             animation.AnimateTo(Content, "Opacity", 1.0f);
57             animation.Play();
58         }
59
60         private void OnClearEvent(object obj, EventArgs e)
61         {
62             Content.BackgroundImage = "/home/tengxb/GitRepo/nui-xaml/TestXaml/res/images/ambient/photoduo_img_bg_01_no9patch.png";
63         }
64     }
65 }