From 365eadb33ee86b05ac74d408025d102a758c2efd Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 10 一月 2020 15:27:17 +0800
Subject: [PATCH] 2020-01-10 2020-01-10 1.修改切换本地和远程问题。 2.修改判断住宅网关方案。 3.其它优化修改。

---
 Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/AlexaSettingPage.cs |  238 ++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 121 insertions(+), 117 deletions(-)

diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/AlexaSettingPage.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/AlexaSettingPage.cs
index 02ed091..f20d349 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/AlexaSettingPage.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/AlexaSettingPage.cs
@@ -318,135 +318,139 @@
                             };
                             deviceRow.AddChidren (btnEquipment);
 
-                            Button btnFindDevcie = new Button () {
-                                X = btnEquipment.Right,
-                                Width = Application.GetRealWidth (75),
-                                Height = Application.GetRealHeight (72),
-                                Gravity = Gravity.CenterVertical,
-                                UnSelectedImagePath = "CrabtreeAdd/Position.png",
-                                SelectedImagePath = "CrabtreeAdd/PositionOn.png",
-                            };
-                            deviceRow.AddChidren (btnFindDevcie);                        
+                            //2020-01-10 闅愯棌瀹氫綅鎸夐挳
+                            //Button btnFindDevcie = new Button () {
+                            //    X = btnEquipment.Right,
+                            //    Width = Application.GetRealWidth (75),
+                            //    Height = Application.GetRealHeight (72),
+                            //    Gravity = Gravity.CenterVertical,
+                            //    UnSelectedImagePath = "CrabtreeAdd/Position.png",
+                            //    SelectedImagePath = "CrabtreeAdd/PositionOn.png",
+                            //};
+                            //deviceRow.AddChidren (btnFindDevcie);                        
 
-                            btnFindDevcie.MouseUpEventHandler += (sdd, dds) => {
-                                btnFindDevcie.IsSelected = true;
-                                Control.ControlBytesSend (Command.PositioningEquipment, commonDevice.SubnetID, commonDevice.DeviceID, new byte [] { 5 });
-                                System.Threading.Tasks.Task.Run (() => {
-                                    System.Threading.Thread.Sleep (3000);
-                                    Application.RunOnMainThread (() => {
-                                        btnFindDevcie.IsSelected = false;
-                                    });
-                                });
-                            };
+                            //btnFindDevcie.MouseUpEventHandler += (sdd, dds) => {
+                            //    btnFindDevcie.IsSelected = true;
+                            //    Control.ControlBytesSend (Command.PositioningEquipment, commonDevice.SubnetID, commonDevice.DeviceID, new byte [] { 5 });
+                            //    System.Threading.Tasks.Task.Run (() => {
+                            //        System.Threading.Thread.Sleep (3000);
+                            //        Application.RunOnMainThread (() => {
+                            //            btnFindDevcie.IsSelected = false;
+                            //        });
+                            //    });
+                            //};
 
                             if (selectedDeviceType != "Scene") {
-                                var btnEdit = new Button () {
-                                    X = btnEquipment.Right + Application.GetRealWidth (80),
-                                    Width = Application.GetRealWidth (75),
-                                    Height = Application.GetRealHeight (72),
-                                    Gravity = Gravity.CenterVertical,
-                                    UnSelectedImagePath = "CrabtreeAdd/Edit.png",
-                                    SelectedImagePath = "CrabtreeAdd/EditOn.png",
-                                };
-                                deviceRow.AddChidren (btnEdit);
-                                btnEdit.MouseUpEventHandler += (sd, ds) => {
-                                    Dialog dialog = new Dialog ();
+                                //2020-01-10 闅愯棌淇敼鎸夐挳
+                                //return;
+                                //var btnEdit = new Button () {
+                                //    X = btnEquipment.Right + Application.GetRealWidth (80),
+                                //    Width = Application.GetRealWidth (75),
+                                //    Height = Application.GetRealHeight (72),
+                                //    Gravity = Gravity.CenterVertical,
+                                //    UnSelectedImagePath = "CrabtreeAdd/Edit.png",
+                                //    SelectedImagePath = "CrabtreeAdd/EditOn.png",
+                                //};
+                                //deviceRow.AddChidren (btnEdit);
+                                //btnEdit.MouseUpEventHandler += (sd, ds) => {
+                                //    Dialog dialog = new Dialog ();
 
-                                    var dialogView = new FrameLayout () {
-                                        Gravity = Gravity.Center,
-                                        Width = Application.GetRealWidth (500),
-                                        Height = Application.GetRealHeight (300),
-                                        BackgroundColor = SkinStyle.Current.DialogColor,
-                                        Radius = 5,
-                                        BorderColor = SkinStyle.Current.Transparent,
-                                        BorderWidth = 1,
-                                    };
-                                    dialog.AddChidren (dialogView);
+                                //    var dialogView = new FrameLayout () {
+                                //        Gravity = Gravity.Center,
+                                //        Width = Application.GetRealWidth (500),
+                                //        Height = Application.GetRealHeight (300),
+                                //        BackgroundColor = SkinStyle.Current.DialogColor,
+                                //        Radius = 5,
+                                //        BorderColor = SkinStyle.Current.Transparent,
+                                //        BorderWidth = 1,
+                                //    };
+                                //    dialog.AddChidren (dialogView);
 
-                                    var etDeviceName = new EditText () {
-                                        Y = Application.GetRealHeight (80),
-                                        Gravity = Gravity.CenterHorizontal,
-                                        Width = Application.GetRealWidth (350),
-                                        Height = Application.GetRealHeight (70),
-                                        Text = commonDevice.Name,
-                                        TextAlignment = TextAlignment.Center,
-                                        TextColor = SkinStyle.Current.TextColor,
-                                        Radius = 1,
-                                        BorderWidth = 1,
-                                        BorderColor = SkinStyle.Current.BorderColor,
-                                    };
-                                    dialogView.AddChidren (etDeviceName);
+                                //    var etDeviceName = new EditText () {
+                                //        Y = Application.GetRealHeight (80),
+                                //        Gravity = Gravity.CenterHorizontal,
+                                //        Width = Application.GetRealWidth (350),
+                                //        Height = Application.GetRealHeight (70),
+                                //        Text = commonDevice.Name,
+                                //        TextAlignment = TextAlignment.Center,
+                                //        TextColor = SkinStyle.Current.TextColor,
+                                //        Radius = 1,
+                                //        BorderWidth = 1,
+                                //        BorderColor = SkinStyle.Current.BorderColor,
+                                //    };
+                                //    dialogView.AddChidren (etDeviceName);
 
-                                    etDeviceName.EditorEnterAction += (obj2) => {
-                                        Application.HideSoftInput ();
-                                    };
+                                //    etDeviceName.EditorEnterAction += (obj2) => {
+                                //        Application.HideSoftInput ();
+                                //    };
 
-                                    var dialogBottomView = new FrameLayout () {
-                                        Y = Application.GetRealHeight (213),
-                                        Height = Application.GetRealHeight (90),
-                                        BackgroundColor = SkinStyle.Current.Black50Transparent,
-                                    };
-                                    dialogView.AddChidren (dialogBottomView);
+                                //    var dialogBottomView = new FrameLayout () {
+                                //        Y = Application.GetRealHeight (213),
+                                //        Height = Application.GetRealHeight (90),
+                                //        BackgroundColor = SkinStyle.Current.Black50Transparent,
+                                //    };
+                                //    dialogView.AddChidren (dialogBottomView);
 
-                                    var btnClose = new Button () {
-                                        Width = Application.GetRealWidth (250),
-                                        TextAlignment = TextAlignment.Center,
-                                        TextID = R.MyInternationalizationString.cancel,
-                                        TextColor = SkinStyle.Current.TextColor,
-                                        BackgroundColor = SkinStyle.Current.ButtonColor,
-                                    };
-                                    dialogBottomView.AddChidren (btnClose);
-                                    btnClose.MouseUpEventHandler += (ddss, dddsss) => {
-                                        dialog.Close ();
-                                    };
+                                //    var btnClose = new Button () {
+                                //        Width = Application.GetRealWidth (250),
+                                //        TextAlignment = TextAlignment.Center,
+                                //        TextID = R.MyInternationalizationString.cancel,
+                                //        TextColor = SkinStyle.Current.TextColor,
+                                //        BackgroundColor = SkinStyle.Current.ButtonColor,
+                                //    };
+                                //    dialogBottomView.AddChidren (btnClose);
+                                //    btnClose.MouseUpEventHandler += (ddss, dddsss) => {
+                                //        dialog.Close ();
+                                //    };
 
-                                    var editor = new Button () {
-                                        X = btnClose.Right + 1,
-                                        Width = Application.GetRealWidth (250),
-                                        TextAlignment = TextAlignment.Center,
-                                        TextID = R.MyInternationalizationString.SAVE,
-                                        TextColor = SkinStyle.Current.TextColor,
-                                        BackgroundColor = SkinStyle.Current.ButtonColor,
-                                    };
-                                    dialogBottomView.AddChidren (editor);
+                                //    var editor = new Button () {
+                                //        X = btnClose.Right + 1,
+                                //        Width = Application.GetRealWidth (250),
+                                //        TextAlignment = TextAlignment.Center,
+                                //        TextID = R.MyInternationalizationString.SAVE,
+                                //        TextColor = SkinStyle.Current.TextColor,
+                                //        BackgroundColor = SkinStyle.Current.ButtonColor,
+                                //    };
+                                //    dialogBottomView.AddChidren (editor);
 
-                                    editor.MouseUpEventHandler += (dff, ffd) => {
-                                        MainPage.Loading.Start ();
-                                        byte [] remakeBytes = CommonPage.MyEncodingGB2312.GetBytes (etDeviceName.Text.Trim ());
-                                        System.Threading.Tasks.Task.Run (() => {
-                                            byte [] updateBytes = Control.ControlBytesSendHasReturn (Command.ReadDeviceLoopInfo, commonDevice.SubnetID, commonDevice.DeviceID, new byte [] { commonDevice.BigClass, commonDevice.MinClass, commonDevice.LoopID });
-                                            if (updateBytes == null) {
-                                                Application.RunOnMainThread (() => {
-                                                    new Alert ("", Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
-                                                    MainPage.Loading.Hide ();
-                                                    dialog.Close ();
-                                                });
-                                                return;
-                                            }
-                                            byte [] uBytes = new byte [20];
-                                            Array.Copy (remakeBytes, 0, uBytes, 0, remakeBytes.Length < 20 ? remakeBytes.Length : 20);
-                                            Array.Copy (uBytes, 0, updateBytes, 3, 20 < uBytes.Length ? 20 : uBytes.Length);
-                                            var reBytes = Control.ControlBytesSendHasReturn (Command.SetDeviceLoopInfo, commonDevice.SubnetID, commonDevice.DeviceID, updateBytes);
-                                            if (reBytes != null) {
-                                                Application.RunOnMainThread (() => {
-                                                    btnEquipment.Text = commonDevice.Name = etDeviceName.Text.Trim ();
-                                                    IO.FileUtils.SaveEquipmentMessage (commonDevice, commonDevice.LoopID.ToString ());
-                                                    MainPage.Loading.Hide ();
-                                                    dialog.Close ();
-                                                });
-                                            } else {
-                                                Application.RunOnMainThread (() => {
-                                                    new Alert ("", Language.StringByID (R.MyInternationalizationString.FailureToModify), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
-                                                    MainPage.Loading.Hide ();
-                                                    dialog.Close ();
-                                                });
-                                            }
-                                        });
-                                    };
+                                //    editor.MouseUpEventHandler += (dff, ffd) => {
+                                //        MainPage.Loading.Start ();
+                                //        byte [] remakeBytes = CommonPage.MyEncodingGB2312.GetBytes (etDeviceName.Text.Trim ());
+                                //        System.Threading.Tasks.Task.Run (() => {
+                                //            byte [] updateBytes = Control.ControlBytesSendHasReturn (Command.ReadDeviceLoopInfo, commonDevice.SubnetID, commonDevice.DeviceID, new byte [] { commonDevice.BigClass, commonDevice.MinClass, commonDevice.LoopID });
+                                //            if (updateBytes == null) {
+                                //                Application.RunOnMainThread (() => {
+                                //                    new Alert ("", Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                                //                    MainPage.Loading.Hide ();
+                                //                    dialog.Close ();
+                                //                });
+                                //                return;
+                                //            }
+                                //            byte [] uBytes = new byte [20];
+                                //            Array.Copy (remakeBytes, 0, uBytes, 0, remakeBytes.Length < 20 ? remakeBytes.Length : 20);
+                                //            Array.Copy (uBytes, 0, updateBytes, 3, 20 < uBytes.Length ? 20 : uBytes.Length);
+                                //            var reBytes = Control.ControlBytesSendHasReturn (Command.SetDeviceLoopInfo, commonDevice.SubnetID, commonDevice.DeviceID, updateBytes);
+                                //            if (reBytes != null) {
+                                //                Application.RunOnMainThread (() => {
+                                //                    btnEquipment.Text = commonDevice.Name = etDeviceName.Text.Trim ();
+                                //                    IO.FileUtils.SaveEquipmentMessage (commonDevice, commonDevice.LoopID.ToString ());
+                                //                    MainPage.Loading.Hide ();
+                                //                    dialog.Close ();
+                                //                });
+                                //            } else {
+                                //                Application.RunOnMainThread (() => {
+                                //                    new Alert ("", Language.StringByID (R.MyInternationalizationString.FailureToModify), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                                //                    MainPage.Loading.Hide ();
+                                //                    dialog.Close ();
+                                //                });
+                                //            }
+                                //        });
+                                //    };
 
-                                    dialog.Show ();
-                                };
+                                //    dialog.Show ();
+                                //};
                             }
+
                             var btnChoose = new Button () {
                                 X = Application.GetRealWidth (472 + 80),
                                 Width = Application.GetRealWidth (75),

--
Gitblit v1.8.0