| | |
| | | }; |
| | | contentView.AddChidren (btnModifyNullLine); |
| | | #endregion |
| | | |
| | | |
| | | #region LocalEncryption |
| | | var LocalEncryptionView = new FrameLayout () { |
| | | Height = Application.GetRealHeight (100), |
| | | }; |
| | | contentView.AddChidren (LocalEncryptionView); |
| | | |
| | | Button btnLocalEncryptionTitle = new Button () { |
| | | X = Application.GetRealWidth (40), |
| | | Text = "Set local encryption", |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = SkinStyle.Current.TextColor1, |
| | | }; |
| | | LocalEncryptionView.AddChidren (btnLocalEncryptionTitle); |
| | | |
| | | Button btnLocalEncryptionRight = new Button () { |
| | | X = Application.GetRealWidth (580), |
| | | Width = Application.GetRealWidth (28), |
| | | Height = Application.GetRealHeight (40), |
| | | Gravity = Gravity.CenterVertical, |
| | | UnSelectedImagePath = "Item/Right.png", |
| | | SelectedImagePath = "Item/RightSelected.png", |
| | | }; |
| | | LocalEncryptionView.AddChidren (btnLocalEncryptionRight); |
| | | |
| | | EventHandler<MouseEventArgs> localEncryptionHandler = (sender, e) => { |
| | | |
| | | var waitPage = new Loading (); |
| | | this.AddChidren (waitPage); |
| | | waitPage.Start ("wait..."); |
| | | new System.Threading.Thread (() => { |
| | | try { |
| | | byte [] AseKeyBytes = UserConfig.Instance.GenerateLocalEncryptionKey (); |
| | | byte [] sendBytes = new byte [17]; |
| | | sendBytes [0] = (byte)1; //0:不加密 1:加密 |
| | | Array.Copy (AseKeyBytes, 0, sendBytes, 1, 16); |
| | | |
| | | UserConfig.Instance.IsLocalEncrypt = false; |
| | | var control = new Control (); |
| | | control.Send (new Target () { |
| | | IPEndPoint = new System.Net.IPEndPoint (System.Net.IPAddress.Parse (new Net.NetWiFi ().BroadcastIpAddress.ToString ()), 6000), |
| | | Command = Command.SetGateWayLocalEncryption, |
| | | SubnetID = 255, |
| | | DeviceID = 0, |
| | | AddData = sendBytes |
| | | }, SendCount.Three, true, true); |
| | | var backBytes = control.UsefulBytes; |
| | | }catch(Exception ex) { |
| | | |
| | | } finally { |
| | | Application.RunOnMainThread (() => { |
| | | waitPage.Hide (); |
| | | }); |
| | | } |
| | | }) { IsBackground = true }.Start (); |
| | | }; |
| | | LocalEncryptionView.MouseUpEventHandler += localEncryptionHandler; |
| | | btnLocalEncryptionTitle.MouseUpEventHandler += localEncryptionHandler; |
| | | btnModifyPasswordRight.MouseUpEventHandler += localEncryptionHandler; |
| | | |
| | | Button btnLocalEncryptionLine = new Button () { |
| | | Height = Application.GetRealHeight (5), |
| | | BackgroundColor = SkinStyle.Current.MainColor, |
| | | }; |
| | | contentView.AddChidren (btnLocalEncryptionLine); |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | Button btnLogout = new Button () { |
| | | Y = contentView.Bottom, |
| | | Height = Application.GetRealHeight (93), |