using System; namespace Shared { /// /// 弹窗视图 /// public class Dialog { Button tempButton; FrameLayout mainFrameLayout; /// /// 弹窗视图构造函数 /// public Dialog () { Application.MainPage.AddChidren (tempButton = new Button () { Visible = false, Width = LayoutParams.MatchParent, Height = LayoutParams.MatchParent, BackgroundColor = 0x88323232 }); Application.MainPage.AddChidren (mainFrameLayout = new FrameLayout () { Visible = false, Tag = "Dialog" }); } /// /// 背景颜色 /// /// The color of the background. public uint BackgroundColor { get { return mainFrameLayout.BackgroundColor; } set { mainFrameLayout.BackgroundColor = value; } } /// /// 圆角大小 /// /// The corner. public uint Radius { get { return mainFrameLayout.Radius; } set { mainFrameLayout.Radius = value; } } /// /// 边框线大小 /// /// The width of the border. public uint BorderWidth { get { return mainFrameLayout.BorderWidth; } set { mainFrameLayout.BorderWidth = value; } } /// /// 增加子控件 /// /// View. public void AddChidren (View view) { mainFrameLayout.AddChidren (view); } /// /// 背景图片路径 /// /// The background image path. public string BackgroundImagePath { get { return mainFrameLayout.BackgroundImagePath; } set { mainFrameLayout.BackgroundImagePath = value; } } /// /// 宽度 /// /// The width. public int Width { get { return mainFrameLayout.Width; } set { mainFrameLayout.Width = value; } } /// /// 高宽 /// /// The height. public int Height { get { return mainFrameLayout.Height; } set { mainFrameLayout.Height = value; } } /// /// X /// /// The height. public int X { get { return mainFrameLayout.X; } set { mainFrameLayout.X = value; } } /// /// Y /// /// The height. public int Y { get { return mainFrameLayout.Y; } set { mainFrameLayout.Y = value; } } /// /// 显示当前的界面 /// public void Show () { tempButton.Visible = true; mainFrameLayout.Visible = true; mainFrameLayout.Gravity = Gravity.Center; tempButton.BringToFront (); mainFrameLayout.BringToFront (); } /// /// 关闭当前的界面,释放资源 /// public void Close () { tempButton.RemoveFromParent (); mainFrameLayout.RemoveFromParent (); } //public void RemoveFromParent () //{ // Shared.HDLUtils.WriteLine ("Dialog RemoveFromParent!!!"); // tempButton.RemoveFromParent (); // mainFrameLayout.RemoveFromParent (); //} } }