From ed2f4a97aa48cdb4a013d2a389877f52eb3eccdf Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期二, 29 十月 2019 13:15:59 +0800 Subject: [PATCH] Merge branch 'DEV_GXC' of http://172.16.1.23:6688/r/~xm/HomeApp into DEV_GXC --- ZigbeeApp/Shared/Phone/UserCenter/SharedContent/ConfigureNewSharedMainForm.cs | 352 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 352 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/ConfigureNewSharedMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/ConfigureNewSharedMainForm.cs new file mode 100755 index 0000000..3345b21 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/ConfigureNewSharedMainForm.cs @@ -0,0 +1,352 @@ +锘縰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 ConfigureNewSharedMainForm : 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.memberShardInfo = i_memberShardInfo; + this.room = i_room; + + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(this.room.Name); + + //鍒嗕韩 + //var btnShard = new TopLayoutFinshView(); + //btnShard.TextID = R.MyInternationalizationString.uShared; + //topFrameLayout.AddChidren(btnShard); + //btnShard.MouseUpEventHandler += (sender, e) => + //{ + // HdlThreadLogic.Current.Run(() => + // { + // //纭鍒嗕韩 + // this.DoSaveSharedContent(); + // }); + //}; + + ////鍒濆鍖栦腑閮ㄤ俊鎭� + //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() + //{ + // if (memberShardInfo.dicAllMemberShard.ContainsKey(this.room.FileName) == false) + // { + // memberShardInfo.dicAllMemberShard[this.room.FileName] = new HashSet<string>(); + // } + // var listCheck = memberShardInfo.dicAllMemberShard[this.room.FileName]; + + // foreach (var deviceUi in this.room.DeviceUIList) + // { + // var device = deviceUi.CommonDevice; + // if (device == null || listCheck.Contains(device.FilePath) == true) + // { + // //寮傚父锛屾垨鑰呭凡缁忓垎浜簡鐨勶紝涓嶅啀鏄剧ず + // continue; + // } + // Application.RunOnMainThread(() => + // { + // if (this.listDeviceView != null) + // { + // //娣诲姞璁惧琛� + // var deviceRow = new DeviceSelectControl(device); + // this.listDeviceView.AddChidren(deviceRow); + // deviceRow.InitControl(); + // //涓嶉渶瑕佹埧闂存帶浠� + // deviceRow.RemoveRoomControl(); + // } + // }); + // } + //} + + //#endregion + + //#region 鈻� 鏄剧ず鍦烘櫙Tab鍒楄〃____________________ + + ///// <summary> + ///// 鍒濆鍖栧満鏅疶ab鍒楄〃 + ///// </summary> + //private void InitSceneTabList() + //{ + // if (memberShardInfo.dicAllMemberShard.ContainsKey(this.room.FileName) == false) + // { + // memberShardInfo.dicAllMemberShard[this.room.FileName] = new HashSet<string>(); + // } + // var listCheck = memberShardInfo.dicAllMemberShard[this.room.FileName]; + + // foreach (var sceneUi in this.room.SceneUIList) + // { + // if (sceneUi == null || listCheck.Contains(sceneUi.FileName) == true) + // { + // //寮傚父锛屾垨鑰呭凡缁忓垎浜簡鐨勶紝涓嶅啀鏄剧ず + // continue; + // } + // Application.RunOnMainThread(() => + // { + // if (this.listSceneView != null) + // { + // //娣诲姞鍦烘櫙琛� + // var sceneRow = new SceneSelectRow(this.listSceneView, sceneUi); + // } + // }); + // } + //} + + //#endregion + + //#region 鈻� 鑾峰彇閫夋嫨鐨勮澶嘷____________________ + + ///// <summary> + ///// 鑾峰彇閫夋嫨鐨勮澶� + ///// </summary> + ///// <param name="listCheck">閲嶅妫�娴�</param> + ///// <returns></returns> + //private List<CommonDevice> GetSelectedDevice(HashSet<string> listCheck) + //{ + // var listDevice = new List<CommonDevice>(); + // for (int i = 0; i < listDeviceView.ChildrenCount; i++) + // { + // var myView = listDeviceView.GetChildren(i); + // var selectRow = (DeviceSelectControl)myView; + // if (selectRow.IsSelected == true && listCheck.Contains(selectRow.device.FilePath) == false) + // { + // listCheck.Add(selectRow.device.FilePath); + // listDevice.Add(selectRow.device); + // } + // } + // return listDevice; + //} + + //#endregion + + //#region 鈻� 鑾峰彇閫夋嫨鐨勫満鏅痏____________________ + + ///// <summary> + ///// 鑾峰彇閫夋嫨鐨勫満鏅� + ///// </summary> + ///// <param name="listCheck">閲嶅妫�娴�</param> + ///// <returns></returns> + //private List<Common.SceneUI> GetSelectedSceneUI(HashSet<string> listCheck) + //{ + // var listSceneUI = new List<Common.SceneUI>(); + // for (int i = 0; i < listSceneView.ChildrenCount; i++) + // { + // var myView = listSceneView.GetChildren(i); + // var selectRow = (SceneSelectRow)myView; + // if (selectRow.IsSelected == true && listCheck.Contains(selectRow.sceneUI.Id.ToString()) == false) + // { + // listCheck.Add(selectRow.sceneUI.Id.ToString()); + // listSceneUI.Add(selectRow.sceneUI); + // } + // } + // return listSceneUI; + //} + + //#endregion + + //#region 鈻� 纭鍒嗕韩___________________________ + + ///// <summary> + ///// 纭鍒嗕韩 + ///// </summary> + //private async void DoSaveSharedContent() + //{ + // var listCheck = new HashSet<string>(); + // //閫夋嫨鐨勮澶� + // var listSelectDevice = this.GetSelectedDevice(listCheck); + // //閫夋嫨鐨勫満鏅� + // var listSelectScene = this.GetSelectedSceneUI(listCheck); + // if (listSelectDevice.Count == 0 && listSelectScene.Count == 0) + // { + // //璇烽�夋嫨鐩爣鍚庡啀鎵ц鍒嗕韩鎿嶄綔 + // string msg = Language.StringByID(R.MyInternationalizationString.uNotSelectDeviceBeforeSave); + // this.ShowErrorMsg(msg); + // return; + // } + // //鎵ц涓婁紶鍒嗕韩鍐呭 + // var result = await HdlShardLogic.Current.DoUploadSharedContent(memberShardInfo, this.room, listSelectDevice, listSelectScene); + // if (result == true) + // { + // Application.RunOnMainThread(() => + // { + // //閲嶆柊鍒锋柊鐣岄潰 + // this.InitMiddleFrame(); + // //鍒嗕韩鎴愬姛 + // string msg = Language.StringByID(R.MyInternationalizationString.uShardSuccess); + // this.ShowMassage(msg); + // }); + // } + //} + + //#endregion + + } +} -- Gitblit v1.8.0