using System; using System.Collections.Generic; using System.IO; namespace Shared.SimpleControl.Phone { public static class UserSettingView { public static void InitUserSettingView () { FrameLayout topView = new FrameLayout () { Y = Application.GetRealHeight (36), Height = Application.GetRealHeight (90), Width = Application.GetRealWidth (640), BackgroundColor = SkinStyle.Current.MainColor, }; UserMiddle.SettingBodyView.AddChidren (topView); Button LogoButton = new Button () { Width = Application.GetRealWidth (154), Height = Application.GetRealHeight (90), UnSelectedImagePath = MainPage.LogoString, }; topView.AddChidren (LogoButton); Button NameButton = new Button () { Width = Application.GetRealWidth (400), Height = Application.GetMinReal (90), TextID = R.MyInternationalizationString.Setting, TextColor = SkinStyle.Current.TextColor1, Gravity = Gravity.CenterHorizontal, TextAlignment = TextAlignment.Center, TextSize = 20, //FontName = "TitilliumText25L" }; topView.AddChidren (NameButton); #if wallon #else #region if(MainPage.LoginUser.AccountString == "464027401@qq.com" ) { NameButton.MouseUpEventHandler += (sender, e) => { new Alert ("", UserConfig.Instance.tokenID, "close").Show(); }; } //try { // Console.WriteLine ("3"); // UserMiddle.SettingBodyView.AddChidren (topView); // Console.WriteLine ("3"); //} catch(Exception ex) { // Console.WriteLine (ex.ToString ()); //} FrameLayout topUserMsgView = new FrameLayout () { Y = Application.GetRealHeight (126), Height = Application.GetRealHeight (175), BackgroundColor = SkinStyle.Current.ViewColor }; UserMiddle.SettingView.AddChidren (topUserMsgView); Button btnUserIcon = new Button () { X = Application.GetRealWidth (27), Width = Application.GetMinRealAverage (96), Height = Application.GetMinRealAverage (96), Gravity = Gravity.CenterVertical, Radius = 5, BorderColor = SkinStyle.Current.Transparent, BorderWidth = 0, UnSelectedImagePath = "AccountSettings/User.png", }; topUserMsgView.AddChidren (btnUserIcon); Button btnUserName = new Button () { X = btnUserIcon.Right + Application.GetRealWidth (20), Y = Application.GetRealHeight (40), Width = Application.GetRealWidth (400), Height = Application.GetRealHeight (50), TextAlignment = TextAlignment.CenterLeft, TextColor = SkinStyle.Current.TextColor1, TextID = R.MyInternationalizationString.Account }; topUserMsgView.AddChidren (btnUserName); Button btnUserAccount = new Button () { X = btnUserName.X, Y = btnUserName.Bottom, Width = btnUserName.Width, Height = btnUserName.Height, TextAlignment = TextAlignment.CenterLeft, Text = "", TextColor = SkinStyle.Current.TextColor1 }; topUserMsgView.AddChidren (btnUserAccount); if (MainPage.LoginUser != null) { btnUserAccount.Text += MainPage.LoginUser.AccountString; } Button btnTopUserMsgRight = new Button () { X = Application.GetRealWidth (570), Width = Application.GetRealWidth (28), Height = Application.GetRealHeight (40), Gravity = Gravity.CenterVertical, UnSelectedImagePath = "Item/Right.png", SelectedImagePath = "Item/RightSelected.png", }; topUserMsgView.AddChidren (btnTopUserMsgRight); EventHandler accountEventHandler = (sender, e) => { new AccountLogin ().Show (); }; btnUserName.MouseUpEventHandler += accountEventHandler; btnUserAccount.MouseUpEventHandler += accountEventHandler; topUserMsgView.MouseUpEventHandler += accountEventHandler; btnTopUserMsgRight.MouseUpEventHandler += accountEventHandler; Button btTopNull = new Button () { BackgroundColor = SkinStyle.Current.MainColor, Height = Application.GetRealHeight (50), }; UserMiddle.SettingView.AddChidren (btTopNull); #endregion #region ---进入后台---DeviceManagementView--- if (MainPage.LoginUser.AccountString == "" || MainPage.LoginUser.AccountType == 2 || MainPage.LoginUser.AccountString == @"464027401@qq.com" || MainPage.LoginUser.AccountString =="751083166@qq.com") {//调试账号 FrameLayout DeviceManagementView = new FrameLayout () { Width = Application.GetRealWidth (640), Height = Application.GetRealHeight (100), BackgroundColor = SkinStyle.Current.ViewColor }; UserMiddle.SettingView.AddChidren (DeviceManagementView); Button btnDevcieManagementIcon = new Button () { X = Application.GetRealWidth (30), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage (75), Height = Application.GetMinRealAverage (75), UnSelectedImagePath = "AccountSettings/DeviceManagement.png" }; DeviceManagementView.AddChidren (btnDevcieManagementIcon); Button btnDeviceManagementTitle = new Button () { X = btnDevcieManagementIcon.Right + Application.GetRealWidth (20), TextAlignment = TextAlignment.CenterLeft, TextID = R.MyInternationalizationString.HouseList, TextColor = SkinStyle.Current.TextColor1, }; DeviceManagementView.AddChidren (btnDeviceManagementTitle); EventHandler SystemEventHandler = (sender, e) => { //GoSystem (); HomeListView hl = new HomeListView (); UserMiddle.SettingPageView.AddChidren (hl); hl.ShowHomeList (); UserMiddle.SettingPageView.PageIndex = UserMiddle.SettingPageView.ChildrenCount - 1; }; DeviceManagementView.MouseUpEventHandler += SystemEventHandler; btnDevcieManagementIcon.MouseUpEventHandler += SystemEventHandler; btnDeviceManagementTitle.MouseUpEventHandler += SystemEventHandler; Button btnNull = new Button () { BackgroundColor = SkinStyle.Current.MainColor, Height = Application.GetRealHeight (5) }; UserMiddle.SettingView.AddChidren (btnNull); } #endregion #endif #region ---备份--- FrameLayout BackupView = new FrameLayout () { Width = Application.GetRealWidth (640), Height = Application.GetRealHeight (100), BackgroundColor = SkinStyle.Current.ViewColor }; UserMiddle.SettingView.AddChidren (BackupView); Button btnBackupIcon = new Button () { X = Application.GetRealWidth (30), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage (75), Height = Application.GetMinRealAverage (75), UnSelectedImagePath = "AccountSettings/Backup.png" }; BackupView.AddChidren (btnBackupIcon); Button btnBackupTitle = new Button () { X = btnBackupIcon.Right + Application.GetRealWidth (20), TextAlignment = TextAlignment.CenterLeft, TextID = R.MyInternationalizationString.BackupManage, TextColor = SkinStyle.Current.TextColor1, }; BackupView.AddChidren (btnBackupTitle); EventHandler BackupEventHandler = (sender, e) => { #if wallon Console.WriteLine ( "ssss1" ); if (true) { Console.WriteLine ("ssss2"); var dgLogin = new Dialog (); var loginView = new FrameLayout () { Gravity = Gravity.Center, Width = Application.GetRealWidth (550), Height = Application.GetRealHeight (480), BackgroundColor = SkinStyle.Current.ViewColor, BorderColor = SkinStyle.Current.Transparent, BorderWidth = 1, Radius = 5, }; dgLogin.AddChidren (loginView); var btnLoginTilte = new Button () { Height = Application.GetRealHeight (80), BackgroundColor = SkinStyle.Current.ButtonColor, TextAlignment = TextAlignment.Center, TextID = R.MyInternationalizationString.AccoutLogin, TextColor = SkinStyle.Current.TextColor1, }; loginView.AddChidren (btnLoginTilte); var accountView = new FrameLayout () { Width = Application.GetRealWidth (510), Height = Application.GetRealHeight (80), X = Application.GetRealWidth (20), Y = btnLoginTilte.Bottom + Application.GetRealHeight (30), BackgroundImagePath = "Register/Register_Email_Address.png", Radius = (uint)Application.GetRealHeight (0), }; loginView.AddChidren (accountView); var etAccount = new EditText () { Width = Application.GetRealWidth (400), X = Application.GetRealWidth (100), PlaceholderText = Language.StringByID (R.MyInternationalizationString.EmailAddress), PlaceholderTextColor = SkinStyle.Current.PlaceholderTextColor, TextAlignment = TextAlignment.CenterLeft, Radius = (uint)Application.GetRealHeight (0), TextColor = SkinStyle.Current.TextColor1, #if DEBUG Text = "464027401@qq.com" #endif }; accountView.AddChidren (etAccount); var passwrodView = new FrameLayout () { Width = Application.GetRealWidth (510), Height = Application.GetRealHeight (80), X = Application.GetRealWidth (20), Y = accountView.Bottom + Application.GetRealHeight (50), BackgroundImagePath = "Register/Register_Password_kuang.png", }; loginView.AddChidren (passwrodView); var etPasswrod = new EditText () { Width = Application.GetRealWidth (400 - 73), X = Application.GetRealWidth (100), PlaceholderText = Language.StringByID (R.MyInternationalizationString.PleaseEnterPassword), PlaceholderTextColor = SkinStyle.Current.PlaceholderTextColor, TextAlignment = TextAlignment.CenterLeft, SecureTextEntry = true, TextColor = SkinStyle.Current.TextColor1, }; passwrodView.AddChidren (etPasswrod); Button btnShowPassword = new Button () { X = etPasswrod.Right, Y = etPasswrod.Y + Application.GetRealHeight (12), Width = Application.GetRealWidth (73), Height = Application.GetRealHeight (60), SelectedImagePath = "CrabtreeAdd/ShowPW.png", UnSelectedImagePath = "CrabtreeAdd/HidePW.png", BorderColor = SkinStyle.Current.Transparent, BorderWidth = 2, Radius = 1 }; passwrodView.AddChidren (btnShowPassword); btnShowPassword.MouseUpEventHandler += (dd, ff) => { btnShowPassword.IsSelected = !btnShowPassword.IsSelected; etPasswrod.SecureTextEntry = !btnShowPassword.IsSelected; }; etAccount.EditorEnterAction += (obj) => { Application.HideSoftInput (); etPasswrod.Foucs = true; }; etPasswrod.EditorEnterAction += (obj) => { Application.HideSoftInput (); }; var btnCloseLogin = new Button () { Width = Application.GetRealWidth (274), Height = Application.GetRealHeight (89), Y = passwrodView.Bottom + Application.GetRealHeight (70), BackgroundColor = SkinStyle.Current.ButtonColor, SelectedBackgroundColor = SkinStyle.Current.SelectedColor, TextID = R.MyInternationalizationString.cancel, TextSize = 15, TextColor = SkinStyle.Current.TextColor1, }; loginView.AddChidren (btnCloseLogin); btnCloseLogin.MouseUpEventHandler += (sende2r, e2) => { dgLogin.Close (); }; Button btnLogin = new Button () { Width = Application.GetRealWidth (274), Height = Application.GetRealHeight (89), X = btnCloseLogin.Right +1, Y = btnCloseLogin.Y, BackgroundColor = SkinStyle.Current.ButtonColor, SelectedBackgroundColor = SkinStyle.Current.SelectedColor, TextID = R.MyInternationalizationString.Login, TextSize = 15, TextColor = SkinStyle.Current.TextColor1, }; loginView.AddChidren (btnLogin); btnLogin.MouseDownEventHandler += (sende2r, e2) => { btnLogin.IsSelected = true; }; btnLogin.MouseUpEventHandler += (sender2, e2) => { btnLogin.IsSelected = false; var account = etAccount.Text.Trim (); var password = etPasswrod.Text.Trim (); if (string.IsNullOrEmpty (account) && string.IsNullOrEmpty (password)) { Application.RunOnMainThread (() => { new Tip () { Text = "Please enter your login details.", Direction = AMPopTipDirection.Up, CloseTime = 3 }.Show (btnLogin); }); return; } if (string.IsNullOrEmpty (account)) { Application.RunOnMainThread (() => { new Tip () { Text = "Please enter your user id.", Direction = AMPopTipDirection.Up, CloseTime = 3 }.Show (btnLogin); }); return; } if (string.IsNullOrEmpty (password)) { Application.RunOnMainThread (() => { new Tip () { Text = "Please enter your password.", Direction = AMPopTipDirection.Up, CloseTime = 3 }.Show (btnLogin); }); return; } System.Threading.Tasks.Task.Run (() => { try { Application.RunOnMainThread (() => { if (Language.CurrentLanguage == "Chinese") { MainPage.Loading.Start ("登陆中..."); } else { MainPage.Loading.Start ("Login..."); } }); if (UserConfig.Instance.internetStatus == 0) { Application.RunOnMainThread (() => { new Tip () { Text = Language.StringByID (R.MyInternationalizationString.NetworkAbnormal), Direction = AMPopTipDirection.Down, CloseTime = 3 }.Show (btnLogin); }); return; } var revertConnectionObj = MainPage.RequestHttps ("Connection", ""); if (revertConnectionObj.StateCode == "SUCCESS") { Application.RunOnMainThread (() => { if (Language.CurrentLanguage == "Chinese") { MainPage.Loading.Start ("链接服务器成功..."); } else { MainPage.Loading.Start ("Link server successful..."); } }); var requestObj = new LoginObj () { Account = account, Password = password, Company = MainPage.SoftSmsType }; var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj); var revertObj = MainPage.RequestHttps ("Login", requestJson, false); if (revertObj.StateCode == "SUCCESS") { var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject (revertObj.ResponseData.ToString ()); var revertData = responseDataObj; MainPage.LoginUser = new UserInfo { ID = revertData.UserId, MasterID = revertData.MainUserId, AccountType = revertData.UserType, AccountString = account, Password = password, LastTime = DateTime.Now, AllVisionRegisterDevUserNameGuid = revertData.AllVisionRegisterDevUserNameGuid, }; Application.RunOnMainThread (() => { dgLogin.Close (); Databackup dataBackupView = new Databackup (); UserMiddle.SettingPageView.AddChidren (dataBackupView); dataBackupView.DatabackupShow (); UserMiddle.SettingPageView.PageIndex = 1; }); } } } catch (Exception ex) { MainPage.FailureToServer (); Console.WriteLine (ex.Message); } finally { Application.RunOnMainThread (() => { MainPage.Loading.Hide (); }); } }); }; dgLogin.Show (); } #else Databackup dataBackupView = new Databackup (); UserMiddle.SettingPageView.AddChidren (dataBackupView); dataBackupView.DatabackupShow (); UserMiddle.SettingPageView.PageIndex = 1; #endif }; BackupView.MouseUpEventHandler += BackupEventHandler; btnBackupIcon.MouseUpEventHandler += BackupEventHandler; btnBackupTitle.MouseUpEventHandler += BackupEventHandler; Button btnNull2 = new Button () { BackgroundColor = SkinStyle.Current.MainColor, Height = Application.GetRealHeight (5) }; UserMiddle.SettingView.AddChidren (btnNull2); btnBackupIcon.MouseLongEventHandler += (sdd, ffd) => { var alertDialog = new Dialog (); var alertBodyView = new FrameLayout (); alertDialog.AddChidren (alertBodyView); alertBodyView.MouseUpEventHandler += (d, f) => { alertDialog.Close (); }; var tipView = new FrameLayout () { Gravity = Gravity.Center, Width = Application.GetRealWidth (500), Height = Application.GetRealHeight (250), BackgroundColor = SkinStyle.Current.DialogTitle, Radius = 5, BorderColor = SkinStyle.Current.Transparent, BorderWidth = 1, }; alertBodyView.AddChidren (tipView); var btnTipMsg = new TextView () { X = Application.GetRealWidth (20), Height = Application.GetRealHeight (130), Width = Application.GetRealWidth (460), IsMoreLines = true, TextColor = SkinStyle.Current.TextColor2, TextID = R.MyInternationalizationString.ClearAllDate, TextSize = 16 }; tipView.AddChidren (btnTipMsg); var bottomView = new FrameLayout () { Y = btnTipMsg.Bottom, Height = Application.GetRealHeight (120), BackgroundColor = SkinStyle.Current.ViewColor, }; tipView.AddChidren (bottomView); var btnYes = new Button () { X = Application.GetRealWidth (40), Y = Application.GetRealHeight (20), Height = Application.GetRealHeight (70), Width = Application.GetRealWidth (200), BackgroundColor = SkinStyle.Current.ButtonColor, TextColor = SkinStyle.Current.TextColor1, TextID = R.MyInternationalizationString.Yes, TextAlignment = TextAlignment.Center, Radius = 5, BorderColor = SkinStyle.Current.Transparent, BorderWidth = 1, }; bottomView.AddChidren (btnYes); var btnNo = new Button () { X = btnYes.Right + Application.GetRealWidth (30), Y = Application.GetRealHeight (20), Height = Application.GetRealHeight (70), Width = Application.GetRealWidth (200), BackgroundColor = SkinStyle.Current.ButtonColor, TextColor = SkinStyle.Current.TextColor1, TextID = R.MyInternationalizationString.No, TextAlignment = TextAlignment.Center, Radius = 5, BorderColor = SkinStyle.Current.Transparent, BorderWidth = 1, }; bottomView.AddChidren (btnNo); btnYes.MouseUpEventHandler += (s2dd, ff) => { alertDialog.Close (); IO.FileUtils.DeleteAllFile (); foreach (var tempHome in UserConfig.Instance.HomeLists) { IO.FileUtils.DeleteRegionFiles (IO.FileUtils.CreateRegionBackup (tempHome.RegionID.ToString ())); } Room.Lists.Clear (); Room.InitAllRoom (); }; btnNo.MouseUpEventHandler += (sd2d, ff) => { alertDialog.Close (); }; alertDialog.Show (); }; #endregion #region ---数据接收--- if (MainPage.LoginUser.AccountString == "" || MainPage.LoginUser.AccountType == 2 || MainPage.LoginUser.AccountString == @"464027401@qq.com" || MainPage.LoginUser.AccountString == @"751083166@qq.com") { FrameLayout DataReceptionView = new FrameLayout () { Width = Application.GetRealWidth (640), Height = Application.GetRealHeight (100), BackgroundColor = SkinStyle.Current.ViewColor }; UserMiddle.SettingView.AddChidren (DataReceptionView); Button btnDataReceptionIcon = new Button () { X = Application.GetRealWidth (30), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage (75), Height = Application.GetMinRealAverage (75), UnSelectedImagePath = "AccountSettings/DataShared.png" }; DataReceptionView.AddChidren (btnDataReceptionIcon); Button btnDataReceptionTitle = new Button () { X = Application.GetRealWidth (125), TextAlignment = TextAlignment.CenterLeft, TextID = R.MyInternationalizationString.DataReception, TextColor = SkinStyle.Current.TextColor1, }; DataReceptionView.AddChidren (btnDataReceptionTitle); EventHandler DataReceptionEventHandler = (sender, e) => { GoData (); }; DataReceptionView.MouseUpEventHandler += DataReceptionEventHandler; btnDataReceptionIcon.MouseUpEventHandler += DataReceptionEventHandler; btnDataReceptionTitle.MouseUpEventHandler += DataReceptionEventHandler; Button btnNull3 = new Button () { BackgroundColor = SkinStyle.Current.MainColor, Height = Application.GetRealHeight (5) }; UserMiddle.SettingView.AddChidren (btnNull3); } #endregion #if wallon #region 菜单配置 FrameLayout SetFunctionListView = new FrameLayout () { Height = Application.GetRealHeight (100), }; UserMiddle.SettingView.AddChidren (SetFunctionListView); Button btnSetFunctionListIcon = new Button () { X = Application.GetRealWidth (35), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage (65), Height = Application.GetMinRealAverage (65), UnSelectedImagePath = "AccountSettings/Category.png" }; SetFunctionListView.AddChidren (btnSetFunctionListIcon); Button btnSetFunctionListTitle = new Button () { X = btnSetFunctionListIcon.Right + Application.GetRealWidth (20), TextID = R.MyInternationalizationString.FunctionCatalogueManagement, TextAlignment = TextAlignment.CenterLeft, TextColor = SkinStyle.Current.TextColor1, }; SetFunctionListView.AddChidren (btnSetFunctionListTitle); EventHandler SetFunctionListHandler = (sender, e) => { Dialog dialogSetFunctionList = new Dialog (); string setLanguage = UserConfig.Instance.SetLanguage; FrameLayout dialogSetFunctionListView = new FrameLayout () { Width = Application.GetRealWidth (500), Height = Application.GetRealHeight (270 + 180 + 70 + 200), Gravity = Gravity.Center, Radius = 5, BorderColor = SkinStyle.Current.Transparent, BorderWidth = 0, BackgroundColor = SkinStyle.Current.DialogColor, }; dialogSetFunctionList.AddChidren (dialogSetFunctionListView); Button setFunctionList = new Button () { Height = Application.GetRealHeight (90), BackgroundColor = SkinStyle.Current.DialogTitle, TextID = R.MyInternationalizationString.FunctionCatalogueManagement, TextColor = SkinStyle.Current.DialogTextColor, TextAlignment = TextAlignment.Center, }; dialogSetFunctionListView.AddChidren (setFunctionList); VerticalScrolViewLayout setFunctionListScrolView = new VerticalScrolViewLayout () { Y = setFunctionList.Bottom, Height = Application.GetRealHeight (330 + 200), }; dialogSetFunctionListView.AddChidren (setFunctionListScrolView); foreach (var functionIndex in UserConfig.Instance.DeviceTypes) { #region RowLayout functionRow = new RowLayout () { Height = Application.GetRealHeight (110), }; setFunctionListScrolView.AddChidren (functionRow); Button btnPoint = new Button () { X = Application.GetMinRealAverage (30), Width = Application.GetMinRealAverage (10), Height = Application.GetMinRealAverage (10), Radius = (uint)Application.GetMinRealAverage (5), BackgroundColor = SkinStyle.Current.ButtonColor, BorderColor = SkinStyle.Current.Transparent, BorderWidth = 0, Gravity = Gravity.CenterVertical, }; functionRow.AddChidren (btnPoint); Button btnChineseName = new Button () { X = btnPoint.Right + Application.GetRealWidth (20), Width = Application.GetRealWidth (350), TextColor = SkinStyle.Current.TextColor, TextAlignment = TextAlignment.CenterLeft, Text = Language.StringByID (functionIndex) }; functionRow.AddChidren (btnChineseName); Button btnCheck = new Button () { X = btnChineseName.Right + Application.GetRealWidth (10), Y = Application.GetRealHeight (15), Width = Application.GetRealWidth (72), Height = Application.GetRealHeight (61), SelectedImagePath = "Skin/Check.png", UnSelectedImagePath = "Item/Transparent.png", IsSelected = !UserConfig.Instance.HideDeviceTypes.Contains (functionIndex) }; functionRow.AddChidren (btnCheck); #endregion EventHandler EventHandler = (sender2, e2) => { btnCheck.IsSelected = !btnCheck.IsSelected; if (btnCheck.IsSelected) { UserConfig.Instance.HideDeviceTypes.Remove (functionIndex); } else { UserConfig.Instance.HideDeviceTypes.Add (functionIndex); } UserConfig.Instance.SaveUserConfig (); }; functionRow.MouseUpEventHandler += EventHandler; btnCheck.MouseUpEventHandler += EventHandler; btnChineseName.MouseUpEventHandler += EventHandler; } FrameLayout skinDialogBottom = new FrameLayout () { Y = setFunctionListScrolView.Bottom, Height = Application.GetRealHeight (80 + 30), BackgroundColor = SkinStyle.Current.White20Transparent, }; dialogSetFunctionListView.AddChidren (skinDialogBottom); Button btnConfrim = new Button () { BackgroundColor = SkinStyle.Current.DialogTitle, TextID = R.MyInternationalizationString.Confrim, TextAlignment = TextAlignment.Center, }; skinDialogBottom.AddChidren (btnConfrim); btnConfrim.MouseUpEventHandler += (ssd, de) => { dialogSetFunctionList.Close (); }; dialogSetFunctionList.Show (); }; SetFunctionListView.MouseUpEventHandler += SetFunctionListHandler; btnSetFunctionListTitle.MouseUpEventHandler += SetFunctionListHandler; btnSetFunctionListIcon.MouseUpEventHandler += SetFunctionListHandler; Button btnSetFunctionListLine = new Button () { Height = Application.GetRealHeight (5), BackgroundColor = SkinStyle.Current.MainColor, }; UserMiddle.SettingView.AddChidren (btnSetFunctionListLine); #endregion #else #region ---msg--- FrameLayout WarningMsgView = new FrameLayout () { Width = Application.GetRealWidth (640), Height = Application.GetRealHeight (100), BackgroundColor = SkinStyle.Current.ViewColor }; UserMiddle.SettingView.AddChidren (WarningMsgView); Button btnWarningMsgIcon = new Button () { X = Application.GetRealWidth (30), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage (75), Height = Application.GetMinRealAverage (75), UnSelectedImagePath = "RemoteMsg/RemoteIcon.png", SelectedImagePath = "RemoteMsg/RemoteIconOn.png" }; WarningMsgView.AddChidren (btnWarningMsgIcon); Button btnWarningMsgTitle = new Button () { X = btnWarningMsgIcon.Right + Application.GetRealWidth (20), TextAlignment = TextAlignment.CenterLeft, TextID = R.MyInternationalizationString.MessageAlert, TextColor = SkinStyle.Current.TextColor1, }; WarningMsgView.AddChidren (btnWarningMsgTitle); EventHandler WarningMsgEventHandler = (sender, e) => { var msgView = new WarningList (); UserMiddle.SettingPageView.AddChidren (msgView); msgView.ShowWarningListPage (); UserMiddle.SettingPageView.PageIndex = 1; }; WarningMsgView.MouseUpEventHandler += WarningMsgEventHandler; btnWarningMsgIcon.MouseUpEventHandler += WarningMsgEventHandler; btnWarningMsgTitle.MouseUpEventHandler += WarningMsgEventHandler; Button btnNullWarningMsg1 = new Button () { Height = Application.GetRealHeight (5), BackgroundColor = SkinStyle.Current.MainColor }; UserMiddle.SettingView.AddChidren (btnNullWarningMsg1); #endregion #endif #region ---skin--- FrameLayout SkinView = new FrameLayout () { Width = Application.GetRealWidth (640), Height = Application.GetRealHeight (100), BackgroundColor = SkinStyle.Current.ViewColor }; UserMiddle.SettingView.AddChidren (SkinView); Button btnSkinIcon = new Button () { X = Application.GetRealWidth (30), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage (75), Height = Application.GetMinRealAverage (75), UnSelectedImagePath = "Skin/Skin.png", SelectedImagePath = "Skin/SkinOn.png" }; SkinView.AddChidren (btnSkinIcon); Button btnSkinTitle = new Button () { X = Application.GetRealWidth (125), TextAlignment = TextAlignment.CenterLeft, TextID = R.MyInternationalizationString.Skin, TextColor = SkinStyle.Current.TextColor1, }; SkinView.AddChidren (btnSkinTitle); EventHandler SkinEventHandler = (sender, e) => { Dialog dialogSkin = new Dialog (); int skinCode = UserConfig.Instance.SkinCode; FrameLayout dialogSkinView = new FrameLayout () { Width = Application.GetRealWidth (400), Height = Application.GetRealHeight (270 + 150), Gravity = Gravity.Center, Radius = 5, BorderColor = SkinStyle.Current.Transparent, BorderWidth = 0, BackgroundColor = SkinStyle.Current.DialogColor, }; dialogSkin.AddChidren (dialogSkinView); Button skinTitle = new Button () { Height = Application.GetRealHeight (80), BackgroundColor = SkinStyle.Current.DialogTitle, TextID = R.MyInternationalizationString.Skin, TextColor = SkinStyle.Current.DialogTextColor, TextAlignment = TextAlignment.Center, }; dialogSkinView.AddChidren (skinTitle); VerticalScrolViewLayout skinScrolView = new VerticalScrolViewLayout () { Y = skinTitle.Bottom, Height = Application.GetRealHeight (270), ScrollEnabled = false, }; dialogSkinView.AddChidren (skinScrolView); #region Black RowLayout rowLayoutSkin = new RowLayout () { Height = Application.GetRealHeight (90), }; skinScrolView.AddChidren (rowLayoutSkin); Button btnPoint = new Button () { X = Application.GetMinRealAverage (30), Width = Application.GetMinRealAverage (10), Height = Application.GetMinRealAverage (10), Radius = (uint)Application.GetMinRealAverage (5), BackgroundColor = SkinStyle.Current.ButtonColor, BorderColor = SkinStyle.Current.Transparent, BorderWidth = 0, Gravity = Gravity.CenterVertical, }; rowLayoutSkin.AddChidren (btnPoint); Button btnSkinName = new Button () { X = btnPoint.Right + Application.GetRealWidth (20), Width = Application.GetRealWidth (250), TextColor = SkinStyle.Current.TextColor, TextAlignment = TextAlignment.CenterLeft, TextID = R.MyInternationalizationString.BlackStyle }; rowLayoutSkin.AddChidren (btnSkinName); Button btnSkinCheck = new Button () { X = btnSkinName.Right + Application.GetRealWidth (10), Y = Application.GetRealHeight (15), Width = Application.GetRealWidth (72), Height = Application.GetRealHeight (61), SelectedImagePath = "Skin/Check.png", UnSelectedImagePath = "Item/Transparent.png", IsSelected = skinCode == 0 ? true : false }; rowLayoutSkin.AddChidren (btnSkinCheck); #endregion #region WhiteStyle RowLayout rowLayoutSkinWhite = new RowLayout () { Height = Application.GetRealHeight (90), }; skinScrolView.AddChidren (rowLayoutSkinWhite); Button btnPointWhite = new Button () { X = Application.GetMinRealAverage (30), Width = Application.GetMinRealAverage (10), Height = Application.GetMinRealAverage (10), Radius = (uint)Application.GetMinRealAverage (5), BackgroundColor = SkinStyle.Current.ButtonColor, BorderColor = SkinStyle.Current.Transparent, Gravity = Gravity.CenterVertical, BorderWidth = 0, }; rowLayoutSkinWhite.AddChidren (btnPointWhite); Button btnSkinNameWhite = new Button () { X = btnPointWhite.Right + Application.GetRealWidth (20), Width = Application.GetRealWidth (250), TextColor = SkinStyle.Current.TextColor, TextAlignment = TextAlignment.CenterLeft, TextID = R.MyInternationalizationString.WhiteStyle }; rowLayoutSkinWhite.AddChidren (btnSkinNameWhite); Button btnSkinCheckWhite = new Button () { X = btnSkinNameWhite.Right + Application.GetRealWidth (10), Y = Application.GetRealHeight (15), Width = Application.GetRealWidth (72), Height = Application.GetRealHeight (61), SelectedImagePath = "Skin/Check.png", UnSelectedImagePath = "Item/Transparent.png", IsSelected = skinCode == 1 ? true : false }; rowLayoutSkinWhite.AddChidren (btnSkinCheckWhite); #endregion EventHandler SkinChangeEventHandler = (sender2, e2) => { skinCode = 0; btnSkinCheck.IsSelected = true; btnSkinCheckWhite.IsSelected = false; }; btnSkinName.MouseUpEventHandler += SkinChangeEventHandler; btnSkinCheck.MouseUpEventHandler += SkinChangeEventHandler; rowLayoutSkin.MouseUpEventHandler += SkinChangeEventHandler; EventHandler SkinChangeEventHandlerWhite = (sender2, e2) => { skinCode = 1; btnSkinCheck.IsSelected = false; btnSkinCheckWhite.IsSelected = true; }; btnSkinNameWhite.MouseUpEventHandler += SkinChangeEventHandlerWhite; btnSkinCheckWhite.MouseUpEventHandler += SkinChangeEventHandlerWhite; rowLayoutSkinWhite.MouseUpEventHandler += SkinChangeEventHandlerWhite; FrameLayout skinDialogBottom = new FrameLayout () { Y = skinScrolView.Bottom, Height = Application.GetRealHeight (80), BackgroundColor = SkinStyle.Current.White20Transparent, }; dialogSkinView.AddChidren (skinDialogBottom); Button btnCancel = new Button () { Width = Application.GetRealWidth (200), BackgroundColor = SkinStyle.Current.DialogTitle, TextID = R.MyInternationalizationString.cancel, TextAlignment = TextAlignment.Center, }; skinDialogBottom.AddChidren (btnCancel); btnCancel.MouseUpEventHandler += (ssd, de) => { dialogSkin.Close (); }; Button btnConfrim = new Button () { X = btnCancel.Right +1, Width = Application.GetRealWidth (200), BackgroundColor = SkinStyle.Current.DialogTitle, TextID = R.MyInternationalizationString.Confrim, TextAlignment = TextAlignment.Center, }; skinDialogBottom.AddChidren (btnConfrim); btnConfrim.MouseUpEventHandler += (ssd, de) => { if (UserConfig.Instance.SkinCode != skinCode) { UserConfig.Instance.SkinCode = skinCode; UserConfig.Instance.SaveUserConfig (); MainPage.RestroeSkin (); UserMiddle.ShowSettingView (); } dialogSkin.Close (); }; dialogSkin.Show (); }; SkinView.MouseUpEventHandler += SkinEventHandler; btnSkinIcon.MouseUpEventHandler += SkinEventHandler; btnSkinTitle.MouseUpEventHandler += SkinEventHandler; #endregion #region update app Button btnNullApp = new Button () { BackgroundColor = SkinStyle.Current.MainColor, Height = Application.GetRealHeight (5) }; UserMiddle.SettingView.AddChidren (btnNullApp); FrameLayout updateAppView = new FrameLayout () { Width = Application.GetRealWidth (640), Height = Application.GetRealHeight (100), BackgroundColor = SkinStyle.Current.ViewColor }; UserMiddle.SettingView.AddChidren (updateAppView); Button btnUpdateAppIcon = new Button () { X = Application.GetRealWidth (30), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage (75), Height = Application.GetMinRealAverage (75), UnSelectedImagePath = "Item/VersionIcon.png", SelectedImagePath = "Item/VersionIcon.png", }; updateAppView.AddChidren (btnUpdateAppIcon); Button btnUpdateAppTitle = new Button () { X = btnUpdateAppIcon.Right + Application.GetRealWidth (20), TextAlignment = TextAlignment.CenterLeft, //TextID = R.MyInternationalizationString.CheckVersion, TextColor = SkinStyle.Current.TextColor1, Text = Language.StringByID (R.MyInternationalizationString.Version) + " : " + MainPage.CodeIDString, }; updateAppView.AddChidren (btnUpdateAppTitle); if (!MainPage.IsAppStoreVersionNewer) { var btnTipUp = new Button () { X = Application.GetRealWidth (550), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage (40), Height = Application.GetMinRealAverage (40), Radius = (uint)Application.GetMinRealAverage (20), Text = "1", TextSize = 16, BackgroundColor = 0xFFFE5E01, TextColor = SkinStyle.Current.TextColor1, }; updateAppView.AddChidren (btnTipUp); } EventHandler UpdateAppEventHandler = (sender, e) => { #if Android //UserConfig.Instance.TipUpdataVersion = DateTime.MinValue; //CheckVersionInfo (); //var updateView = new UpdateAppPage (); //UserMiddle.SettingPageView.AddChidren (updateView); //updateView.ShowUpdateAppPage (); //UserMiddle.SettingPageView.PageIndex = 1; #else var result = SharedMethod.SharedMethod.CheckVersion (); if(MainPage.LoginUser.AccountString == @"464027401@qq.com"|| MainPage.LoginUser.AccountString == @"751083166@qq.com") { new Alert ("", result, "Close").Show (); } #endif }; updateAppView.MouseUpEventHandler += UpdateAppEventHandler; btnUpdateAppIcon.MouseUpEventHandler += UpdateAppEventHandler; btnUpdateAppTitle.MouseUpEventHandler += UpdateAppEventHandler; Button btnNullWarningMsg = new Button () { Height = Application.GetRealHeight (5), BackgroundColor = SkinStyle.Current.MainColor }; UserMiddle.SettingView.AddChidren (btnNullWarningMsg); #endregion Button btnNullSkin = new Button () { Height = Application.GetRealHeight (5), BackgroundColor = SkinStyle.Current.MainColor }; UserMiddle.SettingView.AddChidren (btnNullSkin); } static void GoData () { Dialog dialog = new Dialog (); FrameLayout MianBody = new FrameLayout (); dialog.AddChidren (MianBody); FrameLayout bodyView = new FrameLayout () { Width = Application.GetRealWidth (500), Height = Application.GetRealHeight (430), Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight (250), Radius = 5, BorderColor = SkinStyle.Current.Transparent, BorderWidth = 2, BackgroundColor = SkinStyle.Current.DialogColor }; MianBody.AddChidren (bodyView); Button topButton = new Button () { Height = Application.GetRealHeight (90), BackgroundColor = SkinStyle.Current.DialogTitle, TextSize = 18, TextAlignment = TextAlignment.Center, TextColor = SkinStyle.Current.DialogTextColor, TextID = R.MyInternationalizationString.DataReception }; bodyView.AddChidren (topButton); Button btnIP = new Button () { Width = Application.GetRealWidth (400), Height = Application.GetRealHeight (90), X = Application.GetRealWidth (50), Y = topButton.Bottom, TextAlignment = TextAlignment.CenterLeft, Enable = false, TextID = R.MyInternationalizationString.IPAddresses, TextColor = SkinStyle.Current.TextColor }; bodyView.AddChidren (btnIP); EditText etIP = new EditText () { Width = Application.GetRealWidth (400), Height = Application.GetRealHeight (80), X = Application.GetRealWidth (50), Y = btnIP.Bottom, TextAlignment = TextAlignment.Center, TextColor = SkinStyle.Current.TextColor, Radius = 5, BorderColor = SkinStyle.Current.BorderColor, BorderWidth = 2, Enable = false }; bodyView.AddChidren (etIP); Button btnCloseSharing = new Button () { X = Application.GetRealWidth (50), Y = etIP.Bottom + Application.GetRealHeight (40), Width = Application.GetRealWidth (400), Height = Application.GetRealHeight (80), SelectedBackgroundColor = SkinStyle.Current.ButtonColor, BackgroundColor = SkinStyle.Current.SelectedColor, TextSize = 16, Radius = 5, BorderColor = SkinStyle.Current.Transparent, BorderWidth = 2, TextID = R.MyInternationalizationString.CloseDataSharing, TextColor = SkinStyle.Current.DialogTextColor }; bodyView.AddChidren (btnCloseSharing); btnCloseSharing.MouseDownEventHandler += (sender2, e2) => { btnCloseSharing.IsSelected = true; }; btnCloseSharing.MouseUpEventHandler += (sender2, e2) => { btnCloseSharing.IsSelected = false; new System.Threading.Thread (() => { CommonPage.CloseHttpListener (); }) { IsBackground = true }.Start (); Room.InitAllRoom (); dialog.Close (); }; dialog.Show (); MainPage.Loading.Start (); new System.Threading.Thread (() => { try { string ipAddressString = new Net.NetWiFi ().IpAddress == null ? "null" : new Net.NetWiFi ().IpAddress.ToString (); CommonPage.InitHttpListener (); Application.RunOnMainThread (() => { etIP.Text = ipAddressString; }); } catch (Exception ex) { Console.WriteLine ("Get ip address string erorr : " + ex.Message); } finally { Application.RunOnMainThread (() => { MainPage.Loading.Hide (); }); } }) { IsBackground = true }.Start (); } public static void CheckVersionInfo () { new System.Threading.Thread (() => { try { #if wallon string url = "http://intercom.hdlcontrol.com/AppDownload/apk/teston.json";//获取下载文件的路径 #else string url = "http://intercom.hdlcontrol.com/AppDownload/apk/hdlon.json";//获取下载文件的路径 #endif var result = new System.Net.WebClient { }.DownloadData (url); if (result != null) { var sss = Newtonsoft.Json.JsonConvert.DeserializeObject (System.Text.Encoding.UTF8.GetString (result)); UserConfig.Instance.UpdateVersionType = sss.UpdateVersionType_Android; Console.WriteLine (" sss.CodeIDString : " + sss.CodeIDString); Console.WriteLine ($"UserConfig.Instance.UpdateVersionType {UserConfig.Instance.UpdateVersionType}"); if (Convert.ToDouble (sss.CodeIDString) > Convert.ToDouble (MainPage.CodeIDString) ) { MainPage.IsAppStoreVersionNewer = false; string tip1 = "更新可用"; string tip2 = $"HDL-ON的新版本可用。请立即更新。"; string tip3 = "下一次"; if (Language.CurrentLanguage != "Chinese") { tip1 = "Update Available"; tip2 = $"A new version of HDL-ON is available.Please update now."; tip3 = "Next time"; } if (UserConfig.Instance.UpdateVersionType == UpdateVersionType.Option) { if (UserConfig.Instance.TipUpdataVersion.AddDays (1) < DateTime.Now) { Application.RunOnMainThread (() => { var alert = new Alert (tip1, tip2, tip3, Language.StringByID (R.MyInternationalizationString.Update)); alert.Show (); alert.ResultEventHandler += (arg1, arg2) => { if (arg2) { UserConfig.Instance.TipUpdataVersion = DateTime.MinValue; 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 } else { UserConfig.Instance.TipUpdataVersion = DateTime.Now; } UserConfig.Instance.SaveUserConfig (); }; }); } } else if (UserConfig.Instance.UpdateVersionType == UpdateVersionType.Force) { Application.RunOnMainThread (() => { var alert = new Alert (tip1, tip2, Language.StringByID (R.MyInternationalizationString.Update)); alert.Show (); alert.ResultEventHandler += (arg1, arg2) => { Action action = (pre) => { Application.RunOnMainThread (() => { if (Language.CurrentLanguage == "Chinese") MainPage.Loading.Start ("正在下载最新版本 : " + pre + " %"); else MainPage.Loading.Start ("Downloading the latest version : " + 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 }; }); } } else { UserConfig.Instance.UpdateVersionType = UpdateVersionType.None; MainPage.IsAppStoreVersionNewer = true; } } } catch (Exception ex) { Console.WriteLine (ex.Message); } finally { Application.RunOnMainThread (() => { UserConfig.Instance.SaveUserConfig (); }); } }) { IsBackground = true }.Start (); } } }