From d6fb0646531172f23648441c224cdcccd721b894 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期一, 14 十二月 2020 09:59:01 +0800 Subject: [PATCH] 请合并代码,完成晾衣架最终功能。 --- ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionFileContentForm.cs | 125 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 125 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionFileContentForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionFileContentForm.cs new file mode 100755 index 0000000..5658f1d --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionFileContentForm.cs @@ -0,0 +1,125 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.HideOption +{ + /// <summary> + /// 鏂囦欢鍐呭 + /// </summary> + public class HideOptionFileContentForm : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 瑙e瘑 + /// </summary> + private bool decryptPassword = false; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm(string i_file) + { + this.ScrollEnabled = false; + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText("鏂囦欢鍐呭"); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(i_file); + + var btnButton = new NormalViewControl(200, 69, true); + btnButton.Gravity = Gravity.CenterVertical; + btnButton.X = bodyFrameLayout.Width - Application.GetRealWidth(200) - ControlCommonResourse.XXLeft; + btnButton.TextColor = UserCenterColor.Current.TopLayoutTitleText; + btnButton.TextAlignment = TextAlignment.BottomRight; + btnButton.TextSize = 17; + btnButton.Text = "缈昏瘧"; + topFrameLayout.AddChidren(btnButton); + btnButton.ButtonClickEvent += (sender, e) => + { + if (this.decryptPassword == false) + { + this.decryptPassword = true; + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(i_file); + } + }; + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame(string i_file) + { + if (i_file == string.Empty) { return; } + + this.ClearBodyFrame(); + + if (i_file.EndsWith(".png") == true || i_file.EndsWith(".jpg") == true || i_file.EndsWith(".JPG") == true) + { + var btnPic = new ImageView(); + btnPic.Y = Application.GetRealHeight(60); + btnPic.Width = this.GetPictrueRealSize(887); + btnPic.Height = this.GetPictrueRealSize(444); + btnPic.Gravity = Gravity.CenterHorizontal; + btnPic.Radius= (uint)Application.GetRealHeight(17); + btnPic.ImageBytes = Shared.IO.FileUtils.ReadFile(i_file); + bodyFrameLayout.AddChidren(btnPic); + } + else + { + string textValue = System.Text.Encoding.UTF8.GetString(Shared.IO.FileUtils.ReadFile(i_file)).Trim(); + this.SetTextContent(textValue); + } + } + + /// <summary> + /// 鑷畾涔夎缃樉绀虹殑鏂囨湰 + /// </summary> + /// <param name="i_text"></param> + public void SetTextContent(string textValue) + { + if (this.decryptPassword == true) + { + var strArry = textValue.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); + + textValue = string.Empty; + foreach (var strtext in strArry) + { + string value = UserCenterLogic.DecryptPassword(UserCenterResourse.FileEncryptKey, strtext); + textValue += value + "\r\n"; + } + } + if (textValue.StartsWith("{") == true) + { + textValue = "{\r\n" + textValue.Substring(1); + } + if (textValue.EndsWith("}") == true) + { + textValue = textValue.Substring(0, textValue.Length - 1) + "\r\n}"; + } + + var btnText = new EditTextView(); + btnText.Width = bodyFrameLayout.Width; + btnText.Height = bodyFrameLayout.Height; + btnText.TextAlignment = TextAlignment.TopLeft; + btnText.TextColor = UserCenterColor.Current.TextColor1; + btnText.Text = textValue; +#if Android + btnText.Foucs = false; +#endif + bodyFrameLayout.AddChidren(btnText); + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + #endregion + } +} -- Gitblit v1.8.0