From 1a2061079e97a738ec7b8959bfd9a6e6c6997403 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期四, 31 十月 2019 09:59:29 +0800
Subject: [PATCH] 2019.10.31

---
 ZigbeeApp/Shared/Phone/UserCenter/SharedContent/SearchConfigureSharedMainForm.cs |  375 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 375 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/SearchConfigureSharedMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/SearchConfigureSharedMainForm.cs
new file mode 100755
index 0000000..9e8b9cd
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/SearchConfigureSharedMainForm.cs
@@ -0,0 +1,375 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using ZigBee.Device;
+
+namespace Shared.Phone.UserCenter.SharedContent
+{
+    /// <summary>
+    /// 鏌ョ湅宸查厤缃叡浜唴瀹圭殑涓荤晫闈�
+    /// </summary>
+    public class SearchConfigureSharedMainForm : EditorCommonForm
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 璁惧鍒楄〃鎺т欢
+        /// </summary>
+        private VerticalScrolViewLayout listDeviceView = null;
+        /// <summary>
+        /// 鍦烘櫙鍒楄〃鎺т欢
+        /// </summary>
+        private VerticalScrolViewLayout listSceneView = null;
+        /// <summary>
+        /// 鎴愬憳淇℃伅
+        /// </summary>
+        private MemberInfoRes memberResult = null;
+        /// <summary>
+        /// 鎴愬憳鐨勫垎浜暟鎹�
+        /// </summary>
+        private MemberShardInfoData memberShardInfo = null;
+        /// <summary>
+        /// 鎴块棿瀵硅薄
+        /// </summary>
+        private Common.Room room = null;
+        /// <summary>
+        /// Tab鐨勯�夋嫨銆�1锛氬姛鑳絋ab  2锛氬満鏅疶ab
+        /// </summary>
+        private int TabSelectIndex = 1;
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
+        /// <summary>
+        /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
+        /// </summary>
+        /// <param name="i_room">鎴块棿淇℃伅</param>
+        /// <param name="i_memberResult">鎴愬憳淇℃伅</param>
+        /// <param name="i_memberShardInfo">鎴愬憳鐨勫垎浜暟鎹�</param>
+        public void ShowForm(Common.Room i_room, MemberInfoRes i_memberResult, MemberShardInfoData i_memberShardInfo)
+        {
+            this.memberResult = i_memberResult;
+            this.room = i_room;
+            this.memberShardInfo = i_memberShardInfo;
+
+            //璁剧疆澶撮儴淇℃伅
+            base.SetTitleText(i_room.Name);
+
+            //鍒濆鍖栦腑閮ㄤ俊鎭�
+            //this.InitMiddleFrame();
+        }
+
+        ///// <summary>
+        ///// 鍒濆鍖栦腑閮ㄤ俊鎭�
+        ///// </summary>
+        //private void InitMiddleFrame()
+        //{
+        //    //娓呯┖bodyFrame
+        //    this.ClearBodyFrame();
+
+        //    //鍒濆鍖朤ab鎺т欢
+        //    var frame = this.InitTabControl();
+
+        //    this.listDeviceView = new VerticalScrolViewLayout();
+        //    listDeviceView.Y = frame.Bottom;
+        //    listDeviceView.Height = bodyFrameLayout.Height - frame.Bottom;
+        //    listDeviceView.Visible = this.TabSelectIndex == 1;
+        //    bodyFrameLayout.AddChidren(listDeviceView);
+
+        //    this.listSceneView = new VerticalScrolViewLayout();
+        //    listSceneView.Y = frame.Bottom;
+        //    listSceneView.Height = bodyFrameLayout.Height - frame.Bottom;
+        //    listSceneView.Visible = this.TabSelectIndex == 2;
+        //    bodyFrameLayout.AddChidren(listSceneView);
+
+        //    HdlThreadLogic.Current.Run(() =>
+        //    {
+        //        //鍒濆鍖栧姛鑳絋ab鍒楄〃
+        //        this.InitFunctionTabList();
+        //        //鍒濆鍖栧満鏅疶ab鍒楄〃
+        //        this.InitSceneTabList();
+        //    });
+        //}
+
+        #endregion
+
+        //#region 鈻� 鍒濆鍖朤ab鎺т欢______________________
+
+        ///// <summary>
+        ///// 鍒濆鍖朤ab鎺т欢
+        ///// </summary>
+        ///// <returns></returns>
+        //private FrameLayout InitTabControl()
+        //{
+        //    //Tab鍒囨崲鎺т欢
+        //    var frameSwich = new FrameLayout();
+        //    frameSwich.Height = Application.GetRealHeight(150);
+        //    frameSwich.BackgroundColor = UserCenterColor.Current.TopFrameLayout;
+        //    bodyFrameLayout.AddChidren(frameSwich);
+
+        //    //鍔熻兘
+        //    var btnFunction = new NormalViewControl(frameSwich.Width / 2, Application.GetRealHeight(100));
+        //    btnFunction.Gravity = Gravity.CenterVertical;
+        //    btnFunction.TextID = R.MyInternationalizationString.uFunction;
+        //    btnFunction.TextAlignment = TextAlignment.Center;
+        //    btnFunction.TextColor = UserCenterColor.Current.SelectTextColor;
+        //    btnFunction.TextAlignment = TextAlignment.Center;
+        //    frameSwich.AddChidren(btnFunction);
+
+        //    //鍦烘櫙
+        //    var btnScene = new NormalViewControl(frameSwich.Width / 2, Application.GetRealHeight(100));
+        //    btnScene.Gravity = Gravity.CenterVertical;
+        //    btnScene.X = frameSwich.Width / 2;
+        //    btnScene.TextID = R.MyInternationalizationString.uScence;
+        //    btnScene.TextAlignment = TextAlignment.Center;
+        //    frameSwich.AddChidren(btnScene);
+
+        //    //绾�
+        //    var btnLine = new ProgressLine();
+        //    btnLine.Gravity = Gravity.BottomLeft;
+        //    frameSwich.AddChidren(btnLine);
+        //    btnLine.SetValue(50, true);
+
+        //    if (this.TabSelectIndex == 2)
+        //    {
+        //        btnScene.TextColor = UserCenterColor.Current.SelectTextColor;
+        //        btnFunction.TextColor = Common.ZigbeeColor.Current.TextColor;
+        //        btnLine.SetValue(50, false);
+        //    }
+
+        //    //鍔熻兘Tab
+        //    btnFunction.MouseUpEventHandler += (sender, e) =>
+        //    {
+        //        if (this.TabSelectIndex == 1)
+        //        {
+        //            return;
+        //        }
+        //        btnScene.TextColor = Common.ZigbeeColor.Current.TextColor;
+        //        btnFunction.TextColor = UserCenterColor.Current.SelectTextColor;
+        //        btnLine.SetValue(50);
+        //        this.TabSelectIndex = 1;
+
+        //        //闅愯棌鍦烘櫙鍒楄〃鎺т欢,鏄剧ず璁惧鍒楄〃鎺т欢
+        //        this.listSceneView.Visible = false;
+        //        this.listDeviceView.Visible = true;
+        //    };
+
+        //    //鍦烘櫙Tab
+        //    btnScene.MouseUpEventHandler += (sender, e) =>
+        //    {
+        //        if (this.TabSelectIndex == 2)
+        //        {
+        //            return;
+        //        }
+        //        btnScene.TextColor = UserCenterColor.Current.SelectTextColor;
+        //        btnFunction.TextColor = Common.ZigbeeColor.Current.TextColor;
+        //        btnLine.SetValue(50, false);
+        //        this.TabSelectIndex = 2;
+
+        //        //闅愯棌璁惧鍒楄〃鎺т欢,鏄剧ず鍦烘櫙鍒楄〃鎺т欢
+        //        this.listDeviceView.Visible = false;
+        //        this.listSceneView.Visible = true;
+        //    };
+
+        //    return frameSwich;
+        //}
+
+        //#endregion
+
+        //#region 鈻� 鏄剧ず鍔熻兘Tab鍒楄〃____________________
+
+        ///// <summary>
+        ///// 鍒濆鍖栧姛鑳絋ab鍒楄〃
+        ///// </summary>
+        //private void InitFunctionTabList()
+        //{
+        //    //鑾峰彇鍒嗕韩鐨勮澶�
+        //    var listDevice = this.GetShardListDevice();
+
+        //    foreach (var device in listDevice)
+        //    {
+        //        Application.RunOnMainThread(() =>
+        //        {
+        //            if (this.Parent != null)
+        //            {
+        //                //娣诲姞璁惧鐨勬槑缁嗚
+        //                this.AddDeviceDetailRow(device);
+        //            }
+        //        });
+        //    }
+        //}
+
+        ///// <summary>
+        ///// 娣诲姞璁惧鐨勬槑缁嗚
+        ///// </summary>
+        ///// <param name="device">璁惧瀵硅薄</param>
+        //private void AddDeviceDetailRow(CommonDevice device)
+        //{
+        //    var row = new StatuRowLayout(listDeviceView);
+
+        //    //鍥剧墖
+        //    var btnIcon = new RowLeftIconView();
+        //    Common.LocalDevice.Current.SetDeviceIconToControl(btnIcon, device);
+        //    row.AddChidren(btnIcon, ChidrenBindMode.NotBind);
+
+        //    //璁惧绫诲瀷鐨勭炕璇戝悕瀛�
+        //    var btnName = new RowCenterView();
+        //    btnName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device);
+        //    row.AddChidren(btnName, ChidrenBindMode.NotBind);
+
+        //    //绉婚櫎
+        //    var btnDelete = new RowDeleteButton();
+        //    btnDelete.TextID = R.MyInternationalizationString.RemoveBotton;
+        //    row.AddRightView(btnDelete);
+        //    btnDelete.MouseUpEventHandler += (sender, e) =>
+        //    {
+        //        //纭畾绉婚櫎閫変腑鐨勮澶囷紵
+        //        string msg = Language.StringByID(R.MyInternationalizationString.uConfirmRemoveSelectDeviceMsg);
+        //        this.ShowConfirmMsg(msg, "DeleteShardDevice", row, device);
+        //    };
+        //}
+
+        ///// <summary>
+        ///// 鍒犻櫎鍏变韩璁惧
+        ///// </summary>
+        ///// <param name="row"></param>
+        ///// <param name="device"></param>
+        //public async void DeleteShardDevice(StatuRowLayout row, CommonDevice device)
+        //{
+        //    var result = await HdlShardLogic.Current.DoDeleteSharedContent(memberShardInfo, this.room, new List<CommonDevice>() { device }, new List<Common.SceneUI>());
+        //    if (result == true)
+        //    {
+        //        Application.RunOnMainThread(() =>
+        //        {
+        //            row?.RemoveFromParent();
+        //            if (this.listDeviceView != null && this.listDeviceView.ChildrenCount == 0 && this.listSceneView.ChildrenCount == 0)
+        //            {
+        //                //浠�涔堥兘娌℃湁浜�,鍒欏叧闂晫闈�
+        //                this.CloseForm();
+        //            }
+        //        });
+        //    }
+        //}
+
+        //#endregion
+
+        //#region 鈻� 鏄剧ず鍦烘櫙Tab鍒楄〃____________________
+
+        ///// <summary>
+        ///// 鍒濆鍖栧満鏅疶ab鍒楄〃
+        ///// </summary>
+        //private void InitSceneTabList()
+        //{
+        //    foreach (var sceneUi in this.room.SceneUIList)
+        //    {
+        //        if (sceneUi == null || memberShardInfo.dicAllMemberShard[this.room.FileName].Contains(sceneUi.FileName) == false)
+        //        {
+        //            //寮傚父锛屾垨鑰呬笉瀛樺湪,鍒欎笉鏄剧ず
+        //            continue;
+        //        }
+        //        Application.RunOnMainThread(() =>
+        //        {
+        //            if (this.Parent != null)
+        //            {
+        //                //娣诲姞鍦烘櫙琛�
+        //                this.AddSceneDetailRow(sceneUi);
+        //            }
+        //        });
+        //    }
+        //}
+
+        ///// <summary>
+        ///// 娣诲姞鍦烘櫙鐨勬槑缁嗚
+        ///// </summary>
+        ///// <param name="sceneUI">鍦烘櫙瀵硅薄</param>
+        //private void AddSceneDetailRow(Common.SceneUI sceneUI)
+        //{
+        //    var sceneRow = new SceneViewRow(this.listSceneView, sceneUI);
+
+        //    //绉婚櫎
+        //    var btnDelete = new RowDeleteButton();
+        //    btnDelete.TextID = R.MyInternationalizationString.RemoveBotton;
+        //    sceneRow.AddRightView(btnDelete);
+        //    btnDelete.MouseUpEventHandler += (sender, e) =>
+        //    {
+        //        //纭畾绉婚櫎閫変腑鐨勫満鏅紵
+        //        string msg = Language.StringByID(R.MyInternationalizationString.uConfirmRemoveSelectSceneMsg);
+        //        this.ShowConfirmMsg(msg, "DeleteShardScene", sceneRow, sceneUI);
+        //    };
+        //}
+
+        ///// <summary>
+        ///// 鍒犻櫎鍏变韩鍦烘櫙
+        ///// </summary>
+        ///// <param name="row"></param>
+        ///// <param name="sceneUI"></param>
+        //public async void DeleteShardScene(SceneViewRow row, Common.SceneUI sceneUI)
+        //{
+        //    var result = await HdlShardLogic.Current.DoDeleteSharedContent(memberShardInfo, this.room, new List<CommonDevice>(), new List<Common.SceneUI>() { sceneUI });
+        //    if (result == true)
+        //    {
+        //        Application.RunOnMainThread(() =>
+        //        {
+        //            row?.RemoveFromParent();
+        //            if (this.listDeviceView != null && this.listDeviceView.ChildrenCount == 0 && this.listSceneView.ChildrenCount == 0)
+        //            {
+        //                //浠�涔堥兘娌℃湁浜�,鍒欏叧闂晫闈�
+        //                this.CloseForm();
+        //            }
+        //        });
+        //    }
+        //}
+
+        //#endregion
+
+        //#region 鈻� 鑾峰彇鍙互鍒嗕韩鐨勮澶嘷________________
+
+        ///// <summary>
+        ///// 鑾峰彇鍒嗕韩鐨勮澶�
+        ///// </summary>
+        ///// <returns></returns>
+        //private List<CommonDevice> GetShardListDevice()
+        //{
+        //    //鑾峰彇杩欎釜鎴块棿閲岄潰鐨勫垎浜澶囩殑璺緞
+        //    var listDeviceFile = new List<string>();
+        //    foreach (var ui in this.room.DeviceUIList)
+        //    {
+        //        if (ui.CommonDevice != null && memberShardInfo.dicAllMemberShard[this.room.FileName].Contains(ui.CommonDevice.FilePath) == true)
+        //        {
+        //            listDeviceFile.Add(ui.CommonDevice.FilePath);
+        //        }
+        //    }
+
+        //    var listFile = HdlShardLogic.Current.GetLocalAllShardFile();
+        //    var listDevice = new List<CommonDevice>();
+        //    foreach (string file in listFile)
+        //    {
+        //        //濡傛灉涓嶆槸璁惧鏂囦欢锛屾垨鑰呰繖涓埧闂撮噷闈㈡病鏈夎繖涓澶�
+        //        if (file.StartsWith(Common.LocalDevice.deviceFirstName) == false || listDeviceFile.Contains(file) == false)
+        //        {
+        //            continue;
+        //        }
+        //        var strArry = file.Split('_');
+        //        if (strArry.Length < 3)
+        //        {
+        //            continue;
+        //        }
+        //        //浠庡垎浜枃浠朵腑搴忓垪鍖栧洖鏉�
+        //        var deviceData = HdlShardLogic.Current.GetShardFileContent(file);
+        //        var device = ZigBee.Device.CommonDevice.CommonDeviceByByteString(strArry[1], System.Text.Encoding.UTF8.GetString(deviceData));
+        //        if (device != null)
+        //        {
+        //            listDevice.Add(device);
+        //        }
+        //    }
+        //    return listDevice;
+        //}
+
+        //#endregion
+
+        //#region 鈻� 涓�鑸柟娉昣__________________________
+
+        //#endregion
+    }
+}

--
Gitblit v1.8.0