using System; namespace Shared.SimpleControl.Phone { public class UpdateAppPage : FrameLayout { VerticalScrolViewLayout middleVerticalScrolViewLayout; public UpdateAppPage () { BackgroundColor = SkinStyle.Current.MainColor; } public void ShowUpdateAppPage () { #region 标题 var topView = new FrameLayout () { Height = Application.GetRealHeight (136), }; AddChidren (topView); var title = new Button () { Y = Application.GetRealHeight (10), TextAlignment = TextAlignment.Center, Text = Language.StringByID (R.MyInternationalizationString.UpdateApp), TextSize = 19, TextColor = SkinStyle.Current.TextColor1 }; topView.AddChidren (title); var back = new Button () { Height = Application.GetRealHeight (90), Width = Application.GetRealWidth (85), UnSelectedImagePath = "Item/Back.png", SelectedImagePath = "Item/BackSelected.png", Y = Application.GetRealHeight (30), }; topView.AddChidren (back); back.MouseUpEventHandler += (sender, e) => { (Parent as PageLayout).PageIndex -= 1; }; #endregion var BodyView = new FrameLayout () { Y = topView.Bottom, Height = Application.GetRealHeight (Application.DesignHeight - 126), BackgroundColor = SkinStyle.Current.ViewColor, }; AddChidren (BodyView); var btnCurVersion = new Button () { X = Application.GetRealWidth (60), Y = Application.GetRealHeight (60), TextAlignment = TextAlignment.CenterLeft, Text = Language.StringByID (R.MyInternationalizationString.CurrentVersion) + MainPage.CodeIDString, TextColor = SkinStyle.Current.TextColor1, Width = Application.GetRealHeight (500), Height = Application.GetRealHeight (80), }; BodyView.AddChidren (btnCurVersion); var btnLatestVersion = new Button () { X = Application.GetRealWidth (60), Y = btnCurVersion.Bottom + Application.GetRealHeight (30), TextAlignment = TextAlignment.CenterLeft, Text = Language.StringByID (R.MyInternationalizationString.LatestVersion) + "", TextColor = SkinStyle.Current.TextColor1, Width = Application.GetRealHeight (500), Height = Application.GetRealHeight (80), }; BodyView.AddChidren (btnLatestVersion); var btnCheckVersion = new Button () { Gravity = Gravity.CenterHorizontal, BackgroundColor = SkinStyle.Current.ButtonColor, TextID = R.MyInternationalizationString.CheckVersion, TextAlignment = TextAlignment.Center, Y = btnLatestVersion.Bottom + Application.GetRealHeight (50), Width = Application.GetRealHeight (300), Height = Application.GetRealHeight (80), TextColor = SkinStyle.Current.TextColor1, }; BodyView.AddChidren (btnCheckVersion); btnCheckVersion.MouseUpEventHandler += (ss, dd) => { Action action = (pre) => { Application.RunOnMainThread (() => { MainPage.Loading.Start (pre + " %"); if (Convert.ToInt32 (pre) >= 100) { MainPage.Loading.Hide (); } }); }; #if Android (Shared.Application.Activity as BaseActivity).SetImagePermission ((obj) => { if (obj) { System.Threading.Tasks.Task.Run (() => { SharedMethod.SharedMethod.DownloadFile (action); }); } }); #endif }; } } public class UpdateAppInfo { public string CodeIDString = ""; public UpdateVersionType UpdateVersionType_IOS = 0; public UpdateVersionType UpdateVersionType_Android = 0; } public enum UpdateVersionType { None = 0,//不需要更新
 Option,//提醒更新
 Force,//强制更新
 Skip,// } }