From 2d414e3b007f750cdad4f9e4a7c04db696bca5e4 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期四, 23 四月 2020 16:13:59 +0800
Subject: [PATCH] 2020-04-23 1.优化远程连接提示,改为Loading方案,防止连接过程用户点击重连图标。 2.点击网络检测图标会判断,是否正在远程连接,如果是,会弹窗提示用户”正在远程连接,是否仍要重新检测“。 3.Help 增加隐藏长按功能,长按后,可以开启远程过程异常弹窗提示。长按后关闭。
---
Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs | 97 ++++++++++-----
Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserSettingView.cs | 1
Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs | 9
Crabtree/ON.Ios/AppDelegate.cs | 72 ++++++++++-
Crabtree/ON/Properties/AndroidManifest.xml | 2
Crabtree/.vs/SmartHome/xs/UserPrefs.xml | 16 +-
Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide | 0
Crabtree/SmartHome/UI/SimpleControl/MqttCommon.cs | 87 +++++++++++---
Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/HelpView.cs | 11 +
Crabtree/SmartHome/UI/SimpleControl/MainPage.cs | 16 ++
10 files changed, 233 insertions(+), 78 deletions(-)
diff --git a/Crabtree/.vs/SmartHome/xs/UserPrefs.xml b/Crabtree/.vs/SmartHome/xs/UserPrefs.xml
index ee7be84..7a5ad9e 100644
--- a/Crabtree/.vs/SmartHome/xs/UserPrefs.xml
+++ b/Crabtree/.vs/SmartHome/xs/UserPrefs.xml
@@ -1,24 +1,26 @@
锘�<Properties StartupConfiguration="{1D83BF28-BA88-4152-BA41-D7EFE90A5437}|Default">
+ <MonoDevelop.Ide.ItemProperties.ON.Droid PreferredExecutionTarget="Android.364c4b3158493098" />
<MonoDevelop.Ide.Workbench ActiveDocument="SmartHome/UI/SimpleControl/MqttCommon.cs">
<Files>
- <File FileName="SmartHome/UI/SimpleControl/MainPage.cs" Line="40" Column="56" />
- <File FileName="SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs" Line="84" Column="41" />
- <File FileName="SmartHome/UI/SimpleControl/MqttCommon.cs" Line="225" Column="27" />
+ <File FileName="SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs" Line="84" Column="50" IsPinned="True" />
+ <File FileName="../../../2020/娴嬭瘯/SmartHome/SmartHome/UI/SimpleControl/Phone/Room/UserRoom.cs" />
+ <File FileName="SmartHome/UI/SimpleControl/EquipmentPublicClass.cs" Line="35" Column="33" />
+ <File FileName="SmartHome/UI/SimpleControl/MainPage.cs" />
+ <File FileName="SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs" />
+ <File FileName="SmartHome/UI/SimpleControl/MqttCommon.cs" Line="1" Column="1" />
</Files>
<Pads>
<Pad Id="ProjectPad">
<State name="__root__">
<Node name="SmartHome" expanded="True">
- <Node name="ON.Droid" expanded="True">
- <Node name="Packages" expanded="True" selected="True" />
- <Node name="Properties" expanded="True" />
- </Node>
+ <Node name="ON.Droid" expanded="True" />
<Node name="Shared" expanded="True">
<Node name="UI" expanded="True">
<Node name="SimpleControl" expanded="True">
<Node name="Phone" expanded="True">
<Node name="Register" expanded="True" />
</Node>
+ <Node name="MqttCommon.cs" selected="True" />
</Node>
</Node>
</Node>
diff --git a/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide b/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide
index cc8f5a6..891009e 100644
--- a/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide
+++ b/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide
Binary files differ
diff --git a/Crabtree/ON.Ios/AppDelegate.cs b/Crabtree/ON.Ios/AppDelegate.cs
index 5d47357..6942a4c 100644
--- a/Crabtree/ON.Ios/AppDelegate.cs
+++ b/Crabtree/ON.Ios/AppDelegate.cs
@@ -191,13 +191,15 @@
public override void OnResignActivation (UIApplication application)
{
Utlis.WriteLine ("OnResignActivation");
- Shared.BusSocket.Stop ();
+ //Shared.BusSocket.Stop ();
+ BusSocketStop ();
}
public override void DidEnterBackground (UIApplication application)
{
SharedMethod.SharedMethod.IsBackground = true;
Utlis.WriteLine ("DidEnterBackground");
+ //BusSocketStop ();
}
public override void WillEnterForeground (UIApplication application)
@@ -209,6 +211,7 @@
UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
// Called as part of the transiton from background to active state.
// Here you can undo many of the changes made on entering the background.
+ //BusSocketStart ();
}
public override void WillTerminate (UIApplication application)
@@ -222,6 +225,61 @@
Utlis.WriteLine ("OnActivated");
base.OnActivated (application);
+ BusSocketStart ();
+ ////鏈変簺绯荤粺鐗堟湰杩欓噷鍚姩姣旇鍥炬帶鍒跺櫒蹇�
+ //if (!Shared.SimpleControl.MainPage.Showed) {
+ // System.Threading.Tasks.Task.Run (() => {
+ // while (true) {
+ // System.Threading.Thread.Sleep (10);
+ // if (Shared.SimpleControl.MainPage.Showed) {
+ // break;
+ // }
+ // }
+ // Shared.Application.RunOnMainThread (() => {
+ // Shared.BusSocket.Start (6000);
+ // Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote ((int)Reachability.InternetConnectionStatus (),false);
+ // //RemoteInfo.Current.ReadMsgList (NSUserDefaults.StandardUserDefaults.StringForKey ("PushDeviceToken"), true);
+ // if (SmartHome.WiFiSet.refreshView != null) {
+ // SmartHome.WiFiSet.refreshView ();
+ // }
+ // });
+ // });
+ // return;
+ //}
+ //Shared.BusSocket.Start (6000);
+ //Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote ((int)Reachability.InternetConnectionStatus (), false);
+ //if (SmartHome.WiFiSet.refreshView != null) {
+ // SmartHome.WiFiSet.refreshView ();
+ //}
+
+
+ //com.freeview.global.Video.FVapplicationDidBecomeActive (application);
+ }
+
+ //DateTime closeTime = DateTime.MinValue;
+ /// <summary>
+ /// BusSocketStop
+ /// </summary>
+ void BusSocketStop ()
+ {
+ Shared.BusSocket.Stop ();
+ //closeTime = DateTime.Now;
+ }
+
+
+ /// <summary>
+ /// BusSocketStart
+ /// </summary>
+ void BusSocketStart ()
+ {
+
+ //if (closeTime == DateTime.MinValue) {
+ // closeTime = DateTime.Now;
+ //} else if (closeTime.AddMinutes (2) > DateTime.Now) {
+ // // MqttCommon.DisConnectRemoteMqttClient ();
+ //}
+
+ var netStatus = (int)Reachability.InternetConnectionStatus ();
//鏈変簺绯荤粺鐗堟湰杩欓噷鍚姩姣旇鍥炬帶鍒跺櫒蹇�
if (!Shared.SimpleControl.MainPage.Showed) {
System.Threading.Tasks.Task.Run (() => {
@@ -233,23 +291,23 @@
}
Shared.Application.RunOnMainThread (() => {
Shared.BusSocket.Start (6000);
- Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote ((int)Reachability.InternetConnectionStatus (),false);
- //RemoteInfo.Current.ReadMsgList (NSUserDefaults.StandardUserDefaults.StringForKey ("PushDeviceToken"), true);
+ Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote (netStatus, false);
+ //RemoteInfo.Current.ReadMsgList (true);
if (SmartHome.WiFiSet.refreshView != null) {
SmartHome.WiFiSet.refreshView ();
}
});
});
return;
+ } else {
+ Shared.BusSocket.Start (6000);
+ Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote (netStatus, false);
+ //RemoteInfo.Current.ReadMsgList (true);
}
- Shared.BusSocket.Start (6000);
- Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote ((int)Reachability.InternetConnectionStatus (), false);
if (SmartHome.WiFiSet.refreshView != null) {
SmartHome.WiFiSet.refreshView ();
}
-
- //com.freeview.global.Video.FVapplicationDidBecomeActive (application);
}
}
}
\ No newline at end of file
diff --git a/Crabtree/ON/Properties/AndroidManifest.xml b/Crabtree/ON/Properties/AndroidManifest.xml
index 5a3faa6..e0bd6ab 100644
--- a/Crabtree/ON/Properties/AndroidManifest.xml
+++ b/Crabtree/ON/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
锘�<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtreenew" android:versionName="2.504221" android:versionCode="202004221">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtreenew" android:versionName="2.504232" android:versionCode="202004232">
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28" />
<!-- 鍦ㄥ畨鍗揚鐗堟湰涔嬪悗锛屽繀椤昏鎺堜簣FOREGROUND_SERVICE鏉冮檺锛屾墠鑳藉浣跨敤鍓嶅彴鏈嶅姟 -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
diff --git a/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs b/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs
index df7ec49..0d8deb3 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs
@@ -147,7 +147,7 @@
}
} else {
//鎼滅储澶辫触锛屽惎鐢ㄨ繙绋嬭繛鎺�
- MainPage.AddTip ("Gateway not found, enable remote connection.");
+ MainPage.AddTip ("Gateway cannot be searched locally.");
}
} else {
@@ -165,12 +165,13 @@
if (UserConfig.Instance.CheckHomeGateways ()) {
if (!string.IsNullOrEmpty (UserConfig.Instance.CurrentRegion.HomeGateways [0].GatewayUniqueId)) {
// 5.1鑳借繙绋�,鏄剧ずCloudUnlink鐘舵�侊紝IsRemote璁句负true寮�濮嬭繙绋�
- MainPage.AddTip ("Starting remote connection mode...");
+ MainPage.AddTip ("Please wait, starting remote connection...");
Utlis.ShowAppLinkStatus (AppLinkStatus.CloudUnlink);
CommonPage.IsRemote = true;
- SmartHome.MqttCommon.IsGatewayOnline = false;
- //await SmartHome.MqttCommon.StartCloudMqtt ();
+ //閲嶇疆鍙傛暟鐘舵��
+ SmartHome.MqttCommon.InitState ();
+
}
}
}
diff --git a/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs b/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs
index cd3fc15..fbed817 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs
@@ -36,8 +36,9 @@
}
//public static Button LogoButton = new Button ();
+
- public static string RequestVersion = "20200422";
+ public static string RequestVersion = "20200423";
public static UserInfo LoginUser;
/// <summary>
/// 鏄惁鏄鐞嗗憳鏉冮檺(鍙樻洿浜�,鎴愬憳鐨勬椂鍊�,杩欎釜涔熶负ture銆備负浠�涔堜細澹版槑杩欐牱鍙橀噺,鍥犱负鏈変簺鎺ュ彛蹇呴』浣跨敤鍘熸潵鐨凾oken)
@@ -219,9 +220,9 @@
try {
bytes = webClient.UploadData (url, Encoding.UTF8.GetBytes (dataStringJson));
} catch (System.Net.WebException webEx) {
- Application.RunOnMainThread (() => {
- MainPage.Loading.Hide ();
- });
+ //Application.RunOnMainThread (() => {
+ // MainPage.Loading.Hide ();
+ //});
return new ResponsePack () { StateCode = ErrorCode.NetworkError };
}
string responseString = Encoding.UTF8.GetString (bytes);
@@ -326,6 +327,13 @@
});
}
+ public static void LoadingSetText (string showString = "")
+ {
+ Application.RunOnMainThread (() => {
+ MainPage.Loading.Text = showString;
+ });
+ }
+
public static void LoadingHide ()
{
Application.RunOnMainThread (() => {
diff --git a/Crabtree/SmartHome/UI/SimpleControl/MqttCommon.cs b/Crabtree/SmartHome/UI/SimpleControl/MqttCommon.cs
index 0774a26..a2f8a98 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/MqttCommon.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/MqttCommon.cs
@@ -17,6 +17,11 @@
{
public static class MqttCommon
{
+ /// <summary>
+ /// 鏄惁鎻愮ず 杩滅▼杩炴帴鐨勯敊璇俊鎭�
+ /// </summary>
+ public static bool IfDEBUG = false;
+
static string mqttEncryptKey = "";
static string checkGatewayTopicBase64 = "";
static RemoteMACInfo CurRemoteMACInfo = null;
@@ -57,7 +62,7 @@
new System.Threading.Thread (async () => {
while (true) {
try {
- System.Threading.Thread.Sleep (100);
+ System.Threading.Thread.Sleep (200);
if (!CommonPage.IsRemote) continue;
await StartCloudMqtt ();
@@ -67,6 +72,15 @@
}
}) { IsBackground = true }.Start ();
}
+
+ public static void InitState ()
+ {
+ IfNeedReadAllDeviceStatus = true;
+ bNeedStartTip = true;
+ IsGatewayOnline = false;
+
+ }
+
/// <summary>
/// 鏄惁璁㈤槄鎴愬姛
@@ -135,7 +149,7 @@
if (CommonPage.IsRemote) {
Utlis.ShowAppLinkStatus (AppLinkStatus.CloudUnlink);
}
- Utlis.WriteLine ($"============>MqttRemoteDisConnectRemoteMqttClient");
+ //Utlis.WriteLine ($"============>MqttRemoteDisConnectRemoteMqttClient");
}
} catch (Exception e) {
@@ -153,7 +167,7 @@
/// <summary>
/// 澶栫綉鐨凪QTT鏄惁姝e湪杩炴帴
/// </summary>
- static bool remoteMqttIsConnecting;
+ public static bool remoteMqttIsConnecting;
static bool remoteIsConnected;
/// <summary>
/// 鍚姩杩滅▼Mqtt
@@ -224,7 +238,7 @@
}
if (RemoteMqttClient.ConnectedHandler == null) {
RemoteMqttClient.UseConnectedHandler (async (e) => {
- IfNeedReadAllDeviceStatus = true;
+ //IfNeedReadAllDeviceStatus = true;
mCheckGatewayTime = DateTime.Now;
CheckGatewayCount = 0;
bNeedStartTip = true;
@@ -273,10 +287,19 @@
}
} catch (Exception ex) {
- Utlis.WriteLine ($"============>Mqtt 杩滅▼杩炴帴閫氳杩炴帴鍑哄紓甯�:{ex.Message}");
+ //Utlis.WriteLine ($"============>Mqtt 杩滅▼杩炴帴閫氳杩炴帴鍑哄紓甯�:{ex.Message}");
+
+ MainPage.LoadingSetText ("Connect error, trying to reconnect.");
+
+ if (IfDEBUG) {
+ MainPage.ShowAlertOnMainThread ("error: " + ex.Message);
+ }
+
} finally {
//鏈�缁堣閲婃斁杩炴帴鐘舵��
remoteMqttIsConnecting = false;
+
+ MainPage.LoadingHide ();
}
});
}
@@ -315,16 +338,25 @@
//----绗笁姝� 寮�濮嬭繛鎺�
await MQTTConnectAsync ();
} else {
- Utlis.WriteLine ("============>Mqtt CurRemoteMACInfo null");
+ //Utlis.WriteLine ("============>Mqtt CurRemoteMACInfo null");
+
+ MainPage.LoadingSetText ("Please wait, failed to get gateway parameters.");
}
}
} else {
- Utlis.WriteLine ("============>Mqtt mqttInfoRequestResult_Obj null");
+ //Utlis.WriteLine ("============>Mqtt mqttInfoRequestResult_Obj null");
+
+ MainPage.LoadingSetText ("Please wait, failed to get user parameters.");
+ //MainPage.LoadingSetText ("Please wait, failed to get parameters.");
}
- } catch { }
+ } catch {
+
+ }
} else {
- Utlis.WriteLine ("============>Mqtt GetInfo 澶辫触");
+ //Utlis.WriteLine ("============>Mqtt GetInfo 澶辫触");
+ MainPage.AddTip ("Please wait, failed to get parameters.");
+ //MainPage.LoadingSetText ("Please wait, failed to get parameters.");
}
}
@@ -350,6 +382,8 @@
mMqttInfo = mqttInfoRequestResult_info;
//--绗簩姝ワ細鑾峰彇褰撳墠浣忓垎浜畢缃戝叧淇℃伅骞惰繛鎺QTT
await GetSingleHomeGatewayPaggerAndMQTTConnectAsync ();
+ } else {
+ MainPage.LoadingSetText ("Please wait, failed to get user parameters.");
}
}
}
@@ -363,7 +397,10 @@
//鑾峰彇鍙傛暟鎴愬姛锛屽紑濮嬭繛鎺�...
- MainPage.AddTip ("Successfully obtained parameters, starting to connect...");
+ //MainPage.AddTip ("Successfully obtained parameters, starting to connect...");
+
+ MainPage.LoadingStart ("Please wait, connecting remotely...");
+
//try {
// var url = mMqttInfo.connEmqDomainPort;
// var clientId = mMqttInfo.connEmqClientId;
@@ -389,7 +426,7 @@
// Console.WriteLine ("Connect error: " + ex.Message);
//}
- string mes = "";
+ //string mes = "";
try {
var url = mMqttInfo.connEmqDomainPort;
@@ -397,7 +434,7 @@
var username = mMqttInfo.connEmqUserName;
var passwordRemote = mMqttInfo.connEmqPwd;
- mes = "step1.Set Data";
+ //mes = "step1.Set Data";
CurRemoteMACInfo.LoginAccessToken = MainPage.LoginUser.LoginTokenString;
mqttEncryptKey = CurRemoteMACInfo.aesKey;
var options1 = new MQTTnet.Client.Options.MqttClientOptionsBuilder ()
@@ -408,14 +445,16 @@
// .WithCommunicationTimeout (new TimeSpan (0, 0, 20))
.Build ();
- mes = "step2.DisConnect";
+ //mes = "step2.DisConnect";
await DisConnectRemoteMqttClient ("StartRemoteMqtt");
//MainPage.AddTip ("Start to connect...");
- mes = "step3.Start to connect";
+ //mes = "step3.Start to connect";
await RemoteMqttClient.ConnectAsync (options1);
- mes = "step4.Connected Success";
+ //mes = "step4.Connected Success";
remoteIsConnected = true;
IsDisConnectingWithSendCatch = false;
+
+ MainPage.LoadingSetText ("Remote connection succeeded.");
//MainPage.AddTip ("Connection succeeded!");
//await MqttRemoteSend (new byte [] { 0 }, 1);
@@ -423,12 +462,17 @@
//await MqttRemoteSend (new byte [] { 0 }, 4);
} catch (Exception ex) {
- mes = ex.Message;
+ //mes = ex.Message;
//options1 寮傚父鎻愮ず
- //Console.WriteLine("Connect error: " + ex.Message);
- //MainPage.ShowAlertOnMainThread ("Connect error: " + ex.Message);
+ //Console.WriteLine ("Connect error: " + ex.Message);
+
+ MainPage.LoadingSetText ("Connect error.");
+
+ if (IfDEBUG) {
+ MainPage.ShowAlertOnMainThread ("Connect error: " + ex.Message);
+ }
} finally {
- MainPage.ShowAlertOnMainThread ("finally: " + mes);
+ //MainPage.ShowAlertOnMainThread ("finally: " + mes);
//MainPage.AddTip ("finally: " + mes);
}
@@ -447,7 +491,8 @@
if (bNeedStartTip) {
bNeedStartTip = false;
if (CommonPage.IsRemote) {
- MainPage.AddTip ("Getting remote connection parameters...");
+ //MainPage.AddTip ("Getting remote connection parameters...");
+ MainPage.LoadingStart ("Please wait, getting connection parameters...");
}
}
}
@@ -545,6 +590,8 @@
if (mGatewayRes != null) {
CurRemoteMACInfo.aesKey = mGatewayRes.AesKey;
mqttEncryptKey = CurRemoteMACInfo.aesKey;
+ } else {
+ MainPage.LoadingSetText ("Please wait, failed to get gateway parameters.");
}
}
diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/HelpView.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/HelpView.cs
index 5ea1451..72271e2 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/HelpView.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/HelpView.cs
@@ -32,8 +32,15 @@
title.MouseLongEventHandler += (sd, ds) => {
//#if DEBUG
try {
- //2020-01-15 闀挎寜鏄剧ず褰撳墠浣忓畢ID
- new Alert ("", UserConfig.Instance.CurrentRegion.Id, "close").Show ();
+ ////2020-01-15 闀挎寜鏄剧ず褰撳墠浣忓畢ID
+ //new Alert ("", UserConfig.Instance.CurrentRegion.Id, "close").Show ();
+
+ //2020-04-23 闀挎寜鍚敤 Remote DEBUG Tip
+ SmartHome.MqttCommon.IfDEBUG = !SmartHome.MqttCommon.IfDEBUG;
+ string mes = "Remote DEBUG Tip" + (SmartHome.MqttCommon.IfDEBUG ? "Open" : "Close");
+ new Alert ("", mes, "close").Show ();
+
+
} catch { }
//#endif
diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs
index a246b63..6299a4e 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs
@@ -75,7 +75,7 @@
Width = Application.GetRealWidth (640),
Height = Application.GetRealHeight (1136 - 126 - 90 - 90),
BackgroundColor = SkinStyle.Current.ViewColor,
- ScrollEnabled = false
+ //ScrollEnabled = true
};
public static Button btnVersion = new Button () {
Y = Application.GetRealHeight (1136 - 90 - 90),
@@ -284,9 +284,38 @@
}
}
UserConfig.Instance.SaveUserConfig ();
- btnLinkStatus.MouseUpEventHandler += (dd, ff) => {
- EquipmentPublicClass.CheckLinkRemote (UserConfig.Instance.internetStatus);
+
+
+ EventHandler<MouseEventArgs> btnLinkEvent = (sender, e) => {
+ try {
+ if (SmartHome.MqttCommon.remoteMqttIsConnecting && CommonPage.IsRemote) {
+ Alert alert = new Alert ("", "Being connected remotely, do you still want to cancel and re-detect?", Language.StringByID (R.MyInternationalizationString.Cancel), Language.StringByID (R.MyInternationalizationString.Confrim));
+ alert.ResultEventHandler += (sender2, e2) => {
+ if (e2) {
+ EquipmentPublicClass.CheckLinkRemote (UserConfig.Instance.internetStatus);
+ }
+ };
+ alert.Show ();
+ //MainPage.ShowAlertOnMainThread ("Please wait, connecting remotely...");
+ } else {
+ EquipmentPublicClass.CheckLinkRemote (UserConfig.Instance.internetStatus);
+ }
+ } catch { }
};
+
+ try {
+ //2020-04-23 瑙e喅瀹夊崜閲嶅寮圭獥闂
+ if (btnLinkStatus.MouseUpEventHandler == null) {
+ btnLinkStatus.MouseUpEventHandler += btnLinkEvent;
+ } else {
+ btnLinkStatus.MouseUpEventHandler -= btnLinkEvent;
+ btnLinkStatus.MouseUpEventHandler += btnLinkEvent;
+ }
+
+ } catch {
+ //Utlis.WriteLine ("ccc");
+ }
+
}
@@ -311,31 +340,33 @@
return;
}
+
+ Language.CurrentLanguage = "English";
#if DEBUG
//UserConfig.Instance.SkinCode = 1;
Language.CurrentLanguage = "English";
- var lii = new LightLogic () { Type = DeviceType.LightRGB, LoopID = 1, DeviceID = 4, SubnetID = 42, Name = "RGB" };
- IO.FileUtils.SaveEquipmentMessage (lii, lii.LoopID.ToString ());
- var lii1 = new LightSwitch () { LoopID = 1, DeviceID = 2, SubnetID = 232, Name = "缁х數鍣�" };
- IO.FileUtils.SaveEquipmentMessage (lii1, lii1.LoopID.ToString ());
- //var lii11 = new LightDimming () { LoopID = 1, DeviceID = 1, SubnetID = 232, Name = "璋冨厜鍣�" };
- //IO.FileUtils.SaveEquipmentMessage (lii11, lii11.LoopID.ToString ());
- //var lii111 = new LightDimming () { LoopID = 1, DeviceID = 8, SubnetID = 232, Name = "璋冨厜鍣�2" };
- //IO.FileUtils.SaveEquipmentMessage (lii111, lii111.LoopID.ToString ());
+ //var lii = new LightLogic () { Type = DeviceType.LightRGB, LoopID = 1, DeviceID = 4, SubnetID = 42, Name = "RGB" };
+ //IO.FileUtils.SaveEquipmentMessage (lii, lii.LoopID.ToString ());
+ //var lii1 = new LightSwitch () { LoopID = 1, DeviceID = 2, SubnetID = 232, Name = "缁х數鍣�" };
+ //IO.FileUtils.SaveEquipmentMessage (lii1, lii1.LoopID.ToString ());
+ ////var lii11 = new LightDimming () { LoopID = 1, DeviceID = 1, SubnetID = 232, Name = "璋冨厜鍣�" };
+ ////IO.FileUtils.SaveEquipmentMessage (lii11, lii11.LoopID.ToString ());
+ ////var lii111 = new LightDimming () { LoopID = 1, DeviceID = 8, SubnetID = 232, Name = "璋冨厜鍣�2" };
+ ////IO.FileUtils.SaveEquipmentMessage (lii111, lii111.LoopID.ToString ());
- var mCurtainModel1 = new CurtainModel () { LoopID = 1, DeviceID = 9, SubnetID = 42, Name = "绐楀笜" };
- IO.FileUtils.SaveEquipmentMessage (mCurtainModel1, mCurtainModel1.LoopID.ToString ());
- //var mCurtainModel2 = new CurtainModel () { LoopID = 2, DeviceID = 9, SubnetID = 42, Name = "绐楀笜2" };
- //IO.FileUtils.SaveEquipmentMessage (mCurtainModel2, mCurtainModel2.LoopID.ToString ());
- //var mCurtainModel3 = new CurtainModel () { LoopID = 1, DeviceID = 2, SubnetID = 42, Name = "绐楀笜3" };
- //IO.FileUtils.SaveEquipmentMessage (mCurtainModel3, mCurtainModel3.LoopID.ToString ());
+ //var mCurtainModel1 = new CurtainModel () { LoopID = 1, DeviceID = 9, SubnetID = 42, Name = "绐楀笜" };
+ //IO.FileUtils.SaveEquipmentMessage (mCurtainModel1, mCurtainModel1.LoopID.ToString ());
+ ////var mCurtainModel2 = new CurtainModel () { LoopID = 2, DeviceID = 9, SubnetID = 42, Name = "绐楀笜2" };
+ ////IO.FileUtils.SaveEquipmentMessage (mCurtainModel2, mCurtainModel2.LoopID.ToString ());
+ ////var mCurtainModel3 = new CurtainModel () { LoopID = 1, DeviceID = 2, SubnetID = 42, Name = "绐楀笜3" };
+ ////IO.FileUtils.SaveEquipmentMessage (mCurtainModel3, mCurtainModel3.LoopID.ToString ());
- var mCurtainRoller = new CurtainRoller () { LoopID = 1, DeviceID = 88, SubnetID = 42, Name = "绐楀笜CurtainRoller" };
- IO.FileUtils.SaveEquipmentMessage (mCurtainRoller, mCurtainRoller.LoopID.ToString ());
+ //var mCurtainRoller = new CurtainRoller () { LoopID = 1, DeviceID = 88, SubnetID = 42, Name = "绐楀笜CurtainRoller" };
+ //IO.FileUtils.SaveEquipmentMessage (mCurtainRoller, mCurtainRoller.LoopID.ToString ());
- var mCurtainTrietex = new CurtainTrietex () { LoopID = 1, DeviceID = 87, SubnetID = 42, Name = "绐楀笜CurtainTrietex" };
- IO.FileUtils.SaveEquipmentMessage (mCurtainTrietex, mCurtainTrietex.LoopID.ToString ());
+ //var mCurtainTrietex = new CurtainTrietex () { LoopID = 1, DeviceID = 87, SubnetID = 42, Name = "绐楀笜CurtainTrietex" };
+ //IO.FileUtils.SaveEquipmentMessage (mCurtainTrietex, mCurtainTrietex.LoopID.ToString ());
@@ -346,20 +377,20 @@
//var s2 = new LightEnergySwitch () { LoopID = 11, DeviceID = 1, SubnetID = 44, Name = "EnergySwitch" };
//IO.FileUtils.SaveEquipmentMessage (s2, s2.LoopID.ToString ());
- InfraredMode infraredMode = new InfraredMode () { LoopID = 1, SubnetID = 100, DeviceID = 12, InfraredType = InfraredType.TV, Name = "娴嬭瘯鐢佃" };
- IO.FileUtils.SaveEquipmentMessage (infraredMode, "1");
- ACInfrared aCInfrared = new ACInfrared () { LoopID = 1, SubnetID = 100, DeviceID = 112, Name = "绌鸿皟ACInfrared" };
- IO.FileUtils.SaveEquipmentMessage (aCInfrared, "1");
+ //InfraredMode infraredMode = new InfraredMode () { LoopID = 1, SubnetID = 100, DeviceID = 12, InfraredType = InfraredType.TV, Name = "娴嬭瘯鐢佃" };
+ //IO.FileUtils.SaveEquipmentMessage (infraredMode, "1");
+ //ACInfrared aCInfrared = new ACInfrared () { LoopID = 1, SubnetID = 100, DeviceID = 112, Name = "绌鸿皟ACInfrared" };
+ //IO.FileUtils.SaveEquipmentMessage (aCInfrared, "1");
- ACPanel mACPanel = new ACPanel () { LoopID = 1, SubnetID = 100, DeviceID = 42, Name = "绌鸿皟闈㈡澘ACPanel" };
- IO.FileUtils.SaveEquipmentMessage (mACPanel, "1");
+ //ACPanel mACPanel = new ACPanel () { LoopID = 1, SubnetID = 100, DeviceID = 42, Name = "绌鸿皟闈㈡澘ACPanel" };
+ //IO.FileUtils.SaveEquipmentMessage (mACPanel, "1");
- CustomAC mCustomAC = new CustomAC () { LoopID = 1, SubnetID = 99, DeviceID = 42, Name = "绌鸿皟CustomAC" };
- IO.FileUtils.SaveEquipmentMessage (mCustomAC, "1");
+ //CustomAC mCustomAC = new CustomAC () { LoopID = 1, SubnetID = 99, DeviceID = 42, Name = "绌鸿皟CustomAC" };
+ //IO.FileUtils.SaveEquipmentMessage (mCustomAC, "1");
- HVAC mHVAC = new HVAC () { LoopID = 1, SubnetID = 98, DeviceID = 42, Name = "绌鸿皟HVAC" };
- IO.FileUtils.SaveEquipmentMessage (mHVAC, "1");
+ //HVAC mHVAC = new HVAC () { LoopID = 1, SubnetID = 98, DeviceID = 42, Name = "绌鸿皟HVAC" };
+ //IO.FileUtils.SaveEquipmentMessage (mHVAC, "1");
//var fanM = new FanModule () { Name = "Fan Module",SubnetID = 2,DeviceID = 1,LoopID = 1};
@@ -368,8 +399,8 @@
//IO.FileUtils.SaveEquipmentMessage (fanLoop1, "1");
//var fanLoop2 = new FanModule () { Name = "Fan 2", SubnetID = 2, DeviceID = 1, LoopID = 2 };
//IO.FileUtils.SaveEquipmentMessage (fanLoop2, "2");
- LightEnergySocket sddd = new LightEnergySocket () { LoopID = 1, SubnetID = 100, DeviceID = 122, Name = "娴嬭瘯鎻掑骇" };
- IO.FileUtils.SaveEquipmentMessage (sddd, "1");
+ //LightEnergySocket sddd = new LightEnergySocket () { LoopID = 1, SubnetID = 100, DeviceID = 122, Name = "娴嬭瘯鎻掑骇" };
+ //IO.FileUtils.SaveEquipmentMessage (sddd, "1");
//var ud = new UniversalDevice () { LoopID = 1,SubnetID = 42,DeviceID = 6,ActionType = 2,Name = "Universal-1",obj1 = 1,TargetType = 0};
//ud.SendBytes = new List<byte> () { 1 ,0};
diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserSettingView.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserSettingView.cs
index a98af5c..7dea5d0 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserSettingView.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserSettingView.cs
@@ -234,6 +234,7 @@
};
DataReceptionView.AddChidren (btnDataReceptionTitle);
EventHandler<MouseEventArgs> DataReceptionEventHandler = (sender, e) => {
+
GoData ();
};
DataReceptionView.MouseUpEventHandler += DataReceptionEventHandler;
--
Gitblit v1.8.0