From 587c36e27131f2d028fcabc13b296a8de7470034 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期三, 08 一月 2020 08:59:19 +0800
Subject: [PATCH] 2019.1.8
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs | 155 +++++++++++++++++++++++++++++++++------------------
1 files changed, 100 insertions(+), 55 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
index 5580861..1097fdd 100644
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
@@ -259,6 +259,11 @@
/// <param name="pra">璇锋眰鐨勫弬鏁�</param>
public static bool CheckNotEorrorMsg(ResponsePack revertObj, string RequestName, List<string> listNotShowError = null, object pra = null)
{
+ if (listNotShowError != null && listNotShowError.Contains("NotCheck") == true)
+ {
+ //涓嶆娴�
+ return true;
+ }
if (revertObj == null)
{
Application.RunOnMainThread(() =>
@@ -345,7 +350,6 @@
var formTemp = UserCenterResourse.DicActionForm[formName];
formTemp.CloseForm();
UserCenterResourse.DicActionForm.Remove(formName);
- formTemp = null;
return true;
}
@@ -417,7 +421,7 @@
catch (Exception ex)
{
//鍑虹幇鏈煡閿欒,鏁版嵁涓㈠け
- var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnknownErrorAndDataLost));
+ var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
alert.Show();
//Log鍑哄姏
@@ -452,7 +456,7 @@
catch (Exception ex)
{
//鍑虹幇鏈煡閿欒,鏁版嵁涓㈠け
- var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnknownErrorAndDataLost));
+ var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
alert.Show();
//Log鍑哄姏
@@ -466,9 +470,7 @@
//绉婚櫎ID
UserCenterResourse.listActionFormId.Remove(UserCenterResourse.DicActionForm[formName].FormID);
//绉婚櫎鐢婚潰
- var formTemp = UserCenterResourse.DicActionForm[formName];
UserCenterResourse.DicActionForm.Remove(formName);
- formTemp = null;
}
}
@@ -616,8 +618,7 @@
//鍏抽棴鎵�鏈夋帴鏀�
HdlGatewayReceiveLogic.Current.RemoveAllEvent();
//娓呴櫎鍗囩骇鍒楄〃
- FirmwareUpdateResourse.dicDeviceUpdateList.Clear();
- FirmwareUpdateResourse.dicGatewayUpdateList.Clear();
+ FirmwareUpdateResourse.dicUpdateList.Clear();
HdlThreadLogic.Current.RunThread(async () =>
{
@@ -640,11 +641,6 @@
}
catch { }
- if (noticeDb == true)
- {
- //閫氱煡浜戠锛屽凡缁忛��鍑虹櫥闄�
- var result = await CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("ZigbeeUsers/SignOut", null, "GET");
- }
HdlThreadLogic.Current.RunMain(() =>
{
//鍏抽棴鎵�鏈夋墦寮�浜嗙殑鐣岄潰
@@ -655,6 +651,12 @@
Shared.Common.CommonPage.Instance.AddChidren(formLogin);
formLogin.Show(account);
});
+
+ if (noticeDb == true)
+ {
+ //閫氱煡浜戠锛屽凡缁忛��鍑虹櫥闄�
+ var result = await CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("ZigbeeUsers/SignOut", null, "GET");
+ }
});
}
@@ -801,10 +803,14 @@
/// <summary>
/// 寮傛鏂规硶鎵ц(浠呴檺鍒囨崲浣忓畢鏃惰皟鐢�)锛屽埛鏂颁釜浜轰腑蹇冪殑鍐呭瓨鍙婄嚎绋�
/// </summary>
- public async static Task<bool> InitUserCenterMenmoryAndThread()
+ /// <param name="ShowPrompted">鏂拌拷鍔犲彉閲忥細鏄惁鏄剧ず鎻愮ず鑷姩澶囦唤鐨勭晫闈�</param>
+ /// <returns></returns>
+ public async static Task<bool> InitUserCenterMenmoryAndThread(bool ShowPrompted = true)
{
//APP缂撳瓨鍔犺浇寮�濮�
UserCenterResourse.Option.AppCanSignout = false;
+ //杩樺師杩滅▼杩炴帴鍙橀噺
+ ZigBee.Device.ZbGateway.AllowRemoteCtrl = true;
//鍙湁鍦ㄤ綇瀹匢D涓嶄竴鏍风殑鏃跺�欐墠鍋氳繖涓搷浣�
if (Common.Config.Instance.HomeId != UserCenterResourse.Option.OldHomeStringId
@@ -813,7 +819,7 @@
try
{
//鏂紑杩滅▼Mqtt杩炴帴
- ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient();
+ await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient();
}
catch { }
@@ -832,6 +838,8 @@
{
//閲嶆柊鍙戦�佸懡浠ゅ幓缁戝畾鏂綉鎯呭喌涓嬪浠界殑缃戝叧
HdlGatewayLogic.Current.ResetComandToBindBackupGateway();
+ //璇诲彇闅愬尶閰嶇疆
+ await HdlBackupLogic.Current.LoadHideOption();
}
//鍒濆鍖栫紦瀛樻垚鍛樼殑淇℃伅
@@ -869,9 +877,6 @@
HdlGatewayLogic.Current.SynchronizeDbGateway();
}
- //鍒濆鍖栦綇瀹呭璞�
- Common.Config.Instance.Home = House.GetHouseByHouseId(Common.Config.Instance.HomeId);
-
//鍒濆鍖栨埧闂�(閮洩鍩庨偅杈逛笉鍋氬鐞�,闇�瑕佽繖閲岀壒娈婃墽琛屼竴姝�)
Room.RefreshAllRoomByLocation();
@@ -879,11 +884,13 @@
HdlGatewayLogic.Current.RefreshAppOldSelectGatewayId();
//0:宸茬粡鍚屾杩囷紝涓嶉渶瑕佸悓姝�,杩欎釜鏃跺�欓渶瑕佹彁绀哄浠�
- if (result == 0)
+ if (result == 0 && ShowPrompted == true)
{
//寮�鍚嚜鍔ㄥ浠芥彁绀�
HdlAutoBackupLogic.ShowAutoBackupPromptedForm();
}
+ //鏄剧ず寮曞鐣岄潰
+ ShowGuideForm(result);
}
//APP缂撳瓨鍔犺浇瀹屾垚
UserCenterResourse.Option.AppCanSignout = true;
@@ -1178,6 +1185,36 @@
#endregion
+ #region 鈻� 寮曞鐣岄潰___________________________
+
+ /// <summary>
+ /// 鏄剧ず寮曞鐣岄潰
+ /// </summary>
+ /// <param name="result">鍚屾缁撴灉 -1锛氬紓甯� 0:宸茬粡鍚屾杩囷紝涓嶉渶瑕佸悓姝� 1锛氭甯稿悓姝� 2:娌℃湁鑷姩澶囦唤鏁版嵁</param>
+ private static void ShowGuideForm(int result)
+ {
+ var checkFile = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, DirNameResourse.GuideFile);
+ if (System.IO.File.Exists(checkFile) == true)
+ {
+ //涓嶉渶瑕佹樉绀�
+ return;
+ }
+ if (result == 2 && Config.Instance.Home.IsOthreShare == false)
+ {
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ var form = new Guide.GuideHouseForm();
+ form.ShowFrom();
+ });
+ }
+
+ //鍒涘缓涓�涓┖鏂囦欢(鏍囪瘑宸茬粡瀹屾垚寮曞)
+ var file = System.IO.File.Create(checkFile);
+ file.Close();
+ }
+
+ #endregion
+
#region 鈻� 16杩涘埗杞寲_________________________
/// <summary>
@@ -1227,24 +1264,28 @@
/// <returns></returns>
public static string EncryptPassword(string keys, string strPsw)
{
- if (strPsw == string.Empty)
+ try
{
- return strPsw;
+ if (strPsw == string.Empty)
+ {
+ return strPsw;
+ }
+ var des = new System.Security.Cryptography.DESCryptoServiceProvider();
+ byte[] inputByteArray = Encoding.Default.GetBytes(strPsw);
+ des.Key = ASCIIEncoding.ASCII.GetBytes(keys);
+ des.IV = ASCIIEncoding.ASCII.GetBytes(keys);
+ var ms = new System.IO.MemoryStream();
+ var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateEncryptor(), System.Security.Cryptography.CryptoStreamMode.Write);
+ cs.Write(inputByteArray, 0, inputByteArray.Length);
+ cs.FlushFinalBlock();
+ StringBuilder ret = new StringBuilder();
+ foreach (byte b in ms.ToArray())
+ {
+ ret.AppendFormat("{0:X2}", b);
+ }
+ return ret.ToString().ToLower();
}
- var des = new System.Security.Cryptography.DESCryptoServiceProvider();
- byte[] inputByteArray = Encoding.Default.GetBytes(strPsw);
- des.Key = ASCIIEncoding.ASCII.GetBytes(keys);
- des.IV = ASCIIEncoding.ASCII.GetBytes(keys);
- var ms = new System.IO.MemoryStream();
- var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateEncryptor(), System.Security.Cryptography.CryptoStreamMode.Write);
- cs.Write(inputByteArray, 0, inputByteArray.Length);
- cs.FlushFinalBlock();
- StringBuilder ret = new StringBuilder();
- foreach (byte b in ms.ToArray())
- {
- ret.AppendFormat("{0:X2}", b);
- }
- return ret.ToString();
+ catch { return strPsw; }
}
/// <summary>
@@ -1254,29 +1295,33 @@
/// <returns></returns>
public static string DecryptPassword(string keys, string strPsw)
{
- if (strPsw == string.Empty)
+ try
{
- return strPsw;
+ if (strPsw == string.Empty)
+ {
+ return strPsw;
+ }
+ var des = new System.Security.Cryptography.DESCryptoServiceProvider();
+
+ byte[] inputByteArray = new byte[strPsw.Length / 2];
+ for (int x = 0; x < strPsw.Length / 2; x++)
+ {
+ int i = (Convert.ToInt32(strPsw.Substring(x * 2, 2), 16));
+ inputByteArray[x] = (byte)i;
+ }
+
+ des.Key = ASCIIEncoding.ASCII.GetBytes(keys);
+ des.IV = ASCIIEncoding.ASCII.GetBytes(keys);
+ var ms = new System.IO.MemoryStream();
+ var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateDecryptor(), System.Security.Cryptography.CryptoStreamMode.Write);
+ cs.Write(inputByteArray, 0, inputByteArray.Length);
+ cs.FlushFinalBlock();
+
+ StringBuilder ret = new StringBuilder();
+
+ return System.Text.Encoding.Default.GetString(ms.ToArray());
}
- var des = new System.Security.Cryptography.DESCryptoServiceProvider();
-
- byte[] inputByteArray = new byte[strPsw.Length / 2];
- for (int x = 0; x < strPsw.Length / 2; x++)
- {
- int i = (Convert.ToInt32(strPsw.Substring(x * 2, 2), 16));
- inputByteArray[x] = (byte)i;
- }
-
- des.Key = ASCIIEncoding.ASCII.GetBytes(keys);
- des.IV = ASCIIEncoding.ASCII.GetBytes(keys);
- var ms = new System.IO.MemoryStream();
- var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateDecryptor(), System.Security.Cryptography.CryptoStreamMode.Write);
- cs.Write(inputByteArray, 0, inputByteArray.Length);
- cs.FlushFinalBlock();
-
- StringBuilder ret = new StringBuilder();
-
- return System.Text.Encoding.Default.GetString(ms.ToArray());
+ catch { return strPsw; }
}
#endregion
--
Gitblit v1.8.0