From 9c16d3614d9b88c637f967518a329f239fcd3aaf Mon Sep 17 00:00:00 2001
From: lss <316519258@qq.com>
Date: 星期五, 12 六月 2020 09:22:04 +0800
Subject: [PATCH] 2020.06.12
---
ZigbeeApp/Shared/Common/CommonPage.cs | 266 +++++------------------------------------------------
1 files changed, 25 insertions(+), 241 deletions(-)
diff --git a/ZigbeeApp/Shared/Common/CommonPage.cs b/ZigbeeApp/Shared/Common/CommonPage.cs
index 6e16115..bc830bf 100755
--- a/ZigbeeApp/Shared/Common/CommonPage.cs
+++ b/ZigbeeApp/Shared/Common/CommonPage.cs
@@ -43,26 +43,14 @@
Application.MainPage.AddChidren(Loading);
//}
Phone.UserView.HomePage.Instance.InitPage();
-
- var roomList = new Shared.Phone.Device.Room.RoomManagement();
-
- Instance.AddLeftView(roomList);
- roomList.Show();
}
- public static string SoftTitle = "ZigBee";
- /// <summary>
- /// 鐭俊妯℃澘缂栧彿
- /// </summary>
- public static int SoftSmsType = 0;
- public static string LogoString = @"Logo/Logo.png";
- public static string RegisterLogoString = @"Logo/Register_logo.png";
- public static string RequestHttpsHost = "https://global.hdlcontrol.com/HangZhouHdlCloudApi";
- //public static string RequestHttpsHost = "http://172.16.2.192:13061";
+ //public static string RequestHttpsHost = "https://global.hdlcontrol.com/HangZhouHdlCloudApi";
+ public static string RequestHttpsHost = "https://global.hdlcontrol.com/ProposedProductionApi";
/// <summary>
/// 鐗堟湰鍙�
/// </summary>
- public static string CodeIDString = "1.0.19121201";
+ public static string CodeIDString = "1.1.0120061001";
/// <summary>
/// 娉ㄥ唽鏉ユ簮(0:HDL On 1:Zigbee)
/// </summary>
@@ -85,10 +73,6 @@
/// </summary>
public static int XLeft = 58;
/// <summary>
- /// button楂樺害--110
- /// </summary>
- public static int ButtonHeight = 110;
- /// <summary>
/// 浣跨敤鐨勮瑷�
/// </summary>
public static string ZigBeeLanguage
@@ -99,10 +83,6 @@
}
}
/// <summary>
- /// 澶ф帶浠跺渾瑙� --- 10銆備笉鏄笉鍗婂渾閭g銆�
- /// </summary>
- public static uint BigFormRadius = 10;
- /// <summary>
/// 榛樿鎵嬫満鍖哄彿涓�86涓浗澶ч檰
/// </summary>
public static string PhoneZoneStr = "86";
@@ -111,46 +91,9 @@
/// </summary>
public static string ZoneNameStr = "涓浗澶ч檰";
/// <summary>
- /// 璺濈椤剁楂樺害--80 鐘舵�佹爮楂樺害
- /// </summary>
- public static int NavigationTitle_Y = 80;
- /// <summary>
- /// 琛岄珮--180
- /// </summary>
- public static int RowHeight = 180;
- /// <summary>
/// APP瀹藉害 -- 1080
/// </summary>
public static int AppRealWidth = 1080;
- /// <summary>
- /// APP楂樺害 -- 1920
- /// </summary>
- public static int AppRealHeight = 1920;
- /// <summary>
- /// 杩斿洖閿窛绂诲乏杈圭殑璺濈 30
- /// </summary>
- public static int Navigation_X = 30;
- /// <summary>
- /// 瀵艰埅鏍忛珮搴�-220
- /// </summary>
- public static int Navigation_Height = 220;
- /// <summary>
- /// 搴曡竟鏍忛珮搴�
- /// </summary>
- public const int TabbarHeight = 141;
- /// <summary>
- /// 绾挎潯鐨勯珮搴�--瀹為檯鍍忕礌3
- /// </summary>
- public static int LineHeight = 3;
- /// <summary>
- /// 鏁翠釜鍦烘櫙寤舵椂鏃堕棿--60绉�
- /// </summary>
- public static int SceneDelayTime = 60;
-
- /// <summary>
- /// 闂撮殧澶氶暱鏃堕棿璇诲彇璁惧鐘舵�� 鍗曚綅 绉� --榛樿30
- /// </summary>
- public static int ReadDeviceStatuSpan = 30;
/// <summary>
/// 璇诲彇澶氬皯椤�--999
/// </summary>
@@ -169,23 +112,9 @@
/// </summary>
public static string EmailRegexStr = "^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$";
/// <summary>
- /// 涓嬭浇瀹夊崜apk鐨刡yte闀垮害
- /// </summary>
- public static long ApkBytesTotalLength = 0;
-
- //public static Encoding EncodingUTF8 = Encoding.UTF8;
- //public static Encoding EncodingGB2312 = Encoding.GetEncoding("gb2312");
- public static bool IsRemote = false;
- public static bool FindGateway = false;
- /// <summary>
/// 褰撳墠缃戠粶杩炴帴鐨勬ā寮� 0:娌℃湁缃戠粶 1锛氳繙绋嬭繛鎺ワ紝涔熷彨3G,4G 2锛歐IFI
/// </summary>
public static int nowNetworkMode = 0;
- /// <summary>
- /// 鍗犱綅瀛椾綋澶у皬
- /// 11
- /// </summary>
- public static int PlaceHolderTextSize = 11;
/// <summary>
/// 瀹夊崜鐨勭郴缁熻繑鍥炴寜閿兘鍚︽寜涓�(姣斿鍦ㄥ浠借繕鍘熸椂,涓嶈兘鎸変笅杩斿洖閿�)
/// </summary>
@@ -332,152 +261,7 @@
return null;
}
}
-#if iOS
- /// <summary>
- /// 鑾峰彇iOS-APP鐗堟湰淇℃伅
- /// </summary>
- /// <returns>The https app version async.</returns>
- public async System.Threading.Tasks.Task<ResponseEntity.ResultPack> RequestHttpsiOSAppVersionAsync()
- {
- try
- {
- var webClient = new WebClient { };
- var result = await webClient.DownloadDataTaskAsync("https://itunes.apple.com/lookup?id=1461693569");
- if (result == null)
- {
- return null;
- }
- return Newtonsoft.Json.JsonConvert.DeserializeObject<ResponseEntity.ResultPack>(Encoding.UTF8.GetString(result));
- }
- catch
- {
- return null;
- }
- }
- /// <summary>
- /// 璺宠浆鍒癆PP Store
- /// </summary>
- public void OpenUrl()
- {
- Uri url = new Uri("https://itunes.apple.com/cn/app/hdl-home/id1461693569?mt=8");
- UIKit.UIApplication.SharedApplication.OpenUrl(url);
- }
-#elif Android
- /// <summary>
- /// 鑾峰彇 Android-APP 鐗堟湰淇℃伅
- /// </summary>
- /// <returns>The https app version async.</returns>
- public async System.Threading.Tasks.Task<ResponseEntity.ApkInfoOBJ> RequestHttpsAndroidAppVersionAsync()
- {
- try
- {
- var requestOBJ = new SendDataToServer.GetAndroidApkInfoOBJ
- {
- Name = "ZigbeeApp",
- RequestVersion = CodeIDString
- };
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestOBJ);
- var result = await RequestHttpsZigbeeAsync("FirmwareMana/DetectionPlatformUploadFirmware", System.Text.Encoding.UTF8.GetBytes(requestJson));
- if (result == null)
- {
- return null;
- }
- if (result.StateCode.ToUpper() == "SUCCESS")
- {
- if (result.ResponseData == null)
- {
- return null;
- }
- var responeData = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponseEntity.ApkInfoRes>(result.ResponseData.ToString());
- if (responeData == null || responeData.pageData == null || responeData.pageData.Count == 0)
- {
- return null;
- }
- int MaxIndex = 0;
- int NewVersion = 0;
- for (int i = 0; i < responeData.pageData.Count; i++)
- {
- var apkInfo = responeData.pageData[i];
- var version = int.Parse(apkInfo.FirmwareVersion.Replace(".", ""));
- if (version > NewVersion)
- {
- NewVersion = version;
- MaxIndex = i;
- }
- }
- return responeData.pageData[MaxIndex];
- }
- return null;
- }
- catch (Exception ex)
- {
- return null;
- }
- }
-
- /// <summary>
- /// 涓嬭浇瀹夎apk
- /// </summary>
- /// <returns>The load apk async.</returns>
- /// <param name="requestUrl">璇锋眰閾炬帴</param>
- /// <param name="byteData">璇锋眰鍙傛暟</param>
- public System.Threading.Tasks.Task<byte[]> DownLoadApkAsync(string requestUrl, byte[] byteData)
- {
- try
- {
- AbountForm.instance.webClient.Headers.Add(HttpRequestHeader.ContentType, "application/json");
- AbountForm.instance.webClient.Headers.Add(HttpRequestHeader.Authorization, Config.Instance.Token);
- AbountForm.instance.webClient.UploadProgressChanged += Client_DownloadProgressChanged;
- AbountForm.instance.webClient.UploadDataCompleted += Client_UploadCompleted;
- var result = AbountForm.instance.webClient.UploadDataTaskAsync($"{RequestHttpsHost}/{requestUrl}", "POST", byteData);
- if (result == null)
- {
- return null;
- }
- return result;
- }
- catch (Exception ex)
- {
- return null;
- }
- finally
- {
- }
- }
- /// <summary>
- /// apk涓嬭浇杩涘害
- /// </summary>
- /// <param name="sender">Sender.</param>
- /// <param name="e">E.</param>
- void Client_DownloadProgressChanged(object sender, UploadProgressChangedEventArgs e)
- {
- System.Console.WriteLine($"褰撳墠杩涘害--{(int)(e.BytesReceived / (float)ApkBytesTotalLength * 100)} % --BytesReceived--{e.BytesReceived}--totalByte{e.TotalBytesToReceive}");
- if (e.BytesReceived <= ApkBytesTotalLength)
- {
- Application.RunOnMainThread(() =>
- {
- //Loading.Start($"{(int)(e.BytesReceived / (float)ApkBytesTotalLength * 100)} %");
- AbountForm.instance.seekBar.Progress = (int)(e.BytesReceived / (float)ApkBytesTotalLength * 100);
- AbountForm.instance.seekBarTitle.Text = $"{(int)(e.BytesReceived / (float)ApkBytesTotalLength * 100)}%";
- });
- }
- }
- void Client_UploadCompleted(object sender, UploadDataCompletedEventArgs e)
- {
- System.Console.WriteLine("涓嬭浇apk瀹屾垚");
- //Application.RunOnMainThread(Loading.Hide);
- }
- /// <summary>
- /// 鍙栨秷涓嬭浇apk
- /// </summary>
- public static void CancelDownLoadApkAsync()
- {
- AbountForm.instance.webClient?.CancelAsync();
- System.Console.WriteLine("鍙栨秷涓嬭浇apk");
- }
-
-#endif
/// <summary>
/// 鏈嶅姟鍣ㄨ幏鍙栨暟鎹け璐ユ彁绀�
/// </summary>
@@ -527,30 +311,30 @@
}
}
}
+ }
+
+ /// <summary>
+ /// 鐧诲嚭
+ /// </summary>
+ public void SingOut()
+ {
+ try
+ {
+ Application.RunOnMainThread(() =>
+ {
+ //璁惧畾涓�涓椂闂�
+ Config.Instance.LoginDateTime = new DateTime(1970, 1, 1);
+ Config.Instance.Save();
+ CommonPage.Instance.RemoveAll();
+ CommonPage.Instance.Show();
+ var login = new Phone.Login.AccountLoginForm();
+ CommonPage.Instance.AddChidren(login);
+ login.ShowForm();
+ });
+ }
+ catch { }
}
-
- /// <summary>
- /// 鐧诲嚭
- /// </summary>
- public void SingOut()
- {
- try
- {
- Application.RunOnMainThread(() =>
- {
- //璁惧畾涓�涓椂闂�
- Config.Instance.LoginDateTime = new DateTime(1970, 1, 1);
- Config.Instance.Save();
- CommonPage.Instance.RemoveAll();
- CommonPage.Instance.Show();
- var login = new Phone.Device.Account.AccountLogin();
- CommonPage.Instance.AddChidren(login);
- login.Show();
- });
- }
- catch { }
- }
/// <summary>
/// 閫�鍑虹櫥褰曟椂璋冪敤锛屾竻闄ゆ帹閫佹暟鎹�
/// </summary>
--
Gitblit v1.8.0