JLChen
2020-06-04 6d55af8792cf8fbef0055e677b900fc352dba9a2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
 
namespace Shared
{
    public class HomePage:FrameLayout
    {
        FrameLayout homeFrameLayout = new FrameLayout () {X=0,Y=0, Height=(int)LayoutParameters.MatchParent, Width=(int)LayoutParameters.MatchParent, BackgroundImagePath="Images/Main/Logo.png"};
 
        LinearLayout roomListFrameLayout = new  LinearLayout () {Height=200, Width=200, BackgroundColor = Color.Green};
 
        Button button = new Button (){ Text = "Hello", X = 0, Y = 0, Height = 100, Width = 100, UnSelectedImagePath="Images/Lamp/Light_SwitchOFF.png", SelectedImagePath="Images/Lamp/Light_SwitchON.png" };
 
        public HomePage (int width,int heiht)
        {
            this.Width = width;
            this.Height = heiht;
            this.BackgroundColor = Color.Blue;
        }
 
        public override void IntUI ()
        {
            this.AddChidren (homeFrameLayout);
            this.AddChidren (roomListFrameLayout);  
 
            button.MouseDown+= Button_MouseDown;
            button.MouseUp+= Button_MouseUp;
            roomListFrameLayout.AddChidren(button);
        }
            
 
        void Button_MouseUp (object sender, EventArgs e)
        {
            Button button = sender as Button;
            button.IsSelected = true;
            button.TextAlignment (HorizontalAlignment.Center, VerticalAlignment.Center);
        }
 
        void Button_MouseDown (object sender, EventArgs e)
        {
            Button button = sender as Button;
            button.IsSelected = false;
            button.TextAlignment (HorizontalAlignment.Center, VerticalAlignment.Bottom);
        
        }
    }
}