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.GetMinRealAverage (154), Height = Application.GetMinRealAverage (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 || !SystemRemote.checeInternet ()) { 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 #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 #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); 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 (); } } }