From feaf4e79e8a75b277910b5cfb15b4c71d605841b Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期五, 26 三月 2021 10:37:23 +0800 Subject: [PATCH] 2021-3-26-1 --- HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection3Page.cs | 215 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 215 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection3Page.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection3Page.cs new file mode 100644 index 0000000..3d08125 --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection3Page.cs @@ -0,0 +1,215 @@ +锘縰sing HDL_ON.Stan; +using Shared; +using System; +using System.Collections.Generic; +using System.Text; + +namespace HDL_ON.UI +{ + /// <summary> + /// 娣诲姞Evoyo鐨凪ini鏅鸿兘閬ユ帶鍣ㄦ楠�3鐣岄潰 + /// </summary> + public class AddMiniRemoteControlDirection3Page : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 褰撳墠wifi鐨勫悕瀛� + /// </summary> + private string NowWifiName = string.Empty; + /// <summary> + /// wifi鐨勭嚎绋嬫槸鍚﹀惎鍔� + /// </summary> + private bool WifiThreadAction = false; + /// <summary> + /// wifi鍚�(鍒殑鐣岄潰浼犺繃鏉ョ殑) + /// </summary> + private string wifiName = string.Empty; + /// <summary> + /// wifi瀵嗙爜(鍒殑鐣岄潰浼犺繃鏉ョ殑) + /// </summary> + private string wifiPassword = string.Empty; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + /// <param name="i_wifiName">wifi鍚�(鍒殑鐣岄潰浼犺繃鏉ョ殑)</param> + /// <param name="i_wifiPassword">(鍒殑鐣岄潰浼犺繃鏉ョ殑)</param> + public void ShowForm(string i_wifiName, string i_wifiPassword) + { + this.wifiName = i_wifiName; + this.wifiPassword = i_wifiPassword; + + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(StringId.AddInfraredRemoteControl)); + //杩欎釜鐣岄潰鐨勮儗鏅渶瑕佺櫧鑹� + bodyFrameLayout.BackgroundColor = UI.CSS.CSS_Color.MainBackgroundColor; + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + + //閲嶅啓搴曞眰鐨勮繑鍥炴寜閿� + this.BackButtonClickEvent += () => + { + //鍏虫帀钃濈墮 + HdlBluetoothLogic.Current.Dispone(); + this.CloseForm(); + }; + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //杩炴帴WiFi + var btnWifi = new NormalViewControl(200, 28, true); + btnWifi.X = HdlControlResourse.XXLeft; + btnWifi.Y = Application.GetRealHeight(16); + btnWifi.IsBold = true; + btnWifi.TextColor = CSS.CSS_Color.FirstLevelTitleColor; + btnWifi.TextSize = CSS.CSS_FontSize.EmphasisFontSize_Secondary; + btnWifi.TextID = StringId.ConnectWiFi; + bodyFrameLayout.AddChidren(btnWifi); + //鐩墠鍙敮鎸�2.4G WiFi缃戠粶 + //鏆備笉鏀寔甯︽湁涓枃瀛楃鐨刉iFi鍚嶇О + var strMsg = Language.StringByID(StringId.AddInfraredRemoteControlMsg4); + int yy = this.AddListMsgControls(bodyFrameLayout, strMsg, CSS.CSS_FontSize.TextFontSize, CSS.CSS_Color.TextualColor, + Application.GetRealHeight(20), btnWifi.Bottom + Application.GetRealHeight(16), TextAlignment.CenterLeft); + + //wifi琛� + var rowWifi = new RowLayoutControl(); + rowWifi.Y = yy + Application.GetRealHeight(32); + bodyFrameLayout.AddChidren(rowWifi); + //wifi鍚嶅瓧 + var txtWifi = rowWifi.frameTable.AddLeftInput(wifiName, 200); + txtWifi.TextColor = CSS.CSS_Color.FirstLevelTitleColor; + //搴曠嚎 + rowWifi.frameTable.AddBottomLine(); + //鍚戝彸鍥炬爣 + var btnRight = rowWifi.frameTable.AddMostRightEmptyIcon(24, 24); + btnRight.UnSelectedImagePath = "Public/Right.png"; + btnRight.ButtonClickEvent += (sender, e) => + { + //鎵撳紑鎵嬫満wifi璁剧疆鐣岄潰 + HdlWifiLogic.Current.OpenAppWifiSettion(); + //鍒锋柊wifi鍚嶅瓧 + this.RefreshWifiName(txtWifi); + }; + if (this.wifiName != string.Empty) + { + //杩欎釜鏃跺�欐槸閲嶈瘯妯″紡,涓嶅厑璁哥偣鍑� + btnRight.CanClick = false; + } + + //瀵嗙爜琛� + var rowPsw = new RowLayoutControl(); + rowPsw.Y = rowWifi.Bottom; + bodyFrameLayout.AddChidren(rowPsw); + //瀵嗙爜 + var txtPsw = rowPsw.frameTable.AddLeftInput(wifiPassword, 200); + txtPsw.TextColor = CSS.CSS_Color.FirstLevelTitleColor; + txtPsw.PlaceholderText = Language.StringByID(StringId.Password); + txtPsw.SecureTextEntry = true; + //搴曠嚎 + rowPsw.frameTable.AddBottomLine(); + //鐪肩潧鍥炬爣 + var btnView = rowPsw.frameTable.AddMostRightEmptyIcon(24, 24); + btnView.UnSelectedImagePath = "LoginIcon/HidePasswordIcon.png"; + btnView.SelectedImagePath = "LoginIcon/ShowPasswordIcon.png"; + btnView.ButtonClickEvent += (sender, e) => + { + btnView.IsSelected = !btnView.IsSelected; + txtPsw.SecureTextEntry = !btnView.IsSelected; + }; + if (this.wifiName != string.Empty) + { + //杩欎釜鏃跺�欐槸閲嶈瘯妯″紡,涓嶉渶瑕佺偣鍑� + HdlThreadLogic.Current.RunThread(() => + { + System.Threading.Thread.Sleep(1000); + HdlThreadLogic.Current.RunMain(() => + { + //杩涘叆涓嬩竴涓晫闈� + this.CloseForm(); + var form = new AddMiniRemoteControlDirection4Page(); + form.AddForm(wifiName, wifiPassword); + }); + }); + return; + } + + //涓嬩竴姝� + var btnNext = this.AddBottomClickButton(Language.StringByID(StringId.Next)); + btnNext.ButtonClickEvent += (sender, e) => + { + if (txtWifi.Text.Trim() == string.Empty || txtPsw.Text.Trim() == string.Empty) + { + return; + } + + //杩涘叆涓嬩竴涓晫闈� + this.CloseForm(); + var form = new AddMiniRemoteControlDirection4Page(); + form.AddForm(txtWifi.Text.Trim(), txtPsw.Text); + }; + + HdlThreadLogic.Current.RunThread(() => + { + //鎵撳紑杩涘害鏉�,鍗″畠涓�涓� + this.ShowProgressBar(); + //鑾峰彇褰撳墠wifi鍚嶅瓧(閲岄潰鍙兘浼氬崱) + this.NowWifiName = HdlWifiLogic.Current.SSID; + HdlThreadLogic.Current.RunMain(() => + { + txtWifi.Text = NowWifiName; + }); + + this.CloseProgressBar(); + }); + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 鍒锋柊wifi鍚嶅瓧 + /// </summary> + private void RefreshWifiName(TextInputControl textInput) + { + if (this.WifiThreadAction == true) { return; } + this.WifiThreadAction = true; + + HdlThreadLogic.Current.RunThread(() => + { + //杩欎釜绾跨▼涓嶄細琚腑鏂� + while (this.Parent != null) + { + System.Threading.Thread.Sleep(1500); + string wifiName = string.Empty; + try + { + //鑾峰彇褰撳墠wifi鍚嶅瓧(閲岄潰鍙兘浼氬崱) + wifiName = HdlWifiLogic.Current.SSID; + } + catch { continue; } + if (wifiName != this.NowWifiName) + { + this.NowWifiName = wifiName; + HdlThreadLogic.Current.RunMain(() => + { + textInput.Text = this.NowWifiName; + }); + } + } + }); + } + + #endregion + } +} -- Gitblit v1.8.0