From 404cdc88627f942df7944af04ee05b9d527752d6 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 30 九月 2019 13:22:40 +0800 Subject: [PATCH] 合并了徐梅的按键面板绑定 --- ZigbeeApp/Shared/Phone/UserCenter/SharedContent/ConfigureNewSharedMainForm.cs | 553 ++++++++++++++++++++++++++++--------------------------- 1 files changed, 281 insertions(+), 272 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/ConfigureNewSharedMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/ConfigureNewSharedMainForm.cs index 0ac589b..d5b5737 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/ConfigureNewSharedMainForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/ConfigureNewSharedMainForm.cs @@ -9,7 +9,7 @@ /// <summary> /// 閰嶇疆鏂板叡浜唴瀹圭殑涓荤晫闈� /// </summary> - public class ConfigureNewSharedMainForm : UserCenterCommonForm + public class ConfigureNewSharedMainForm : EditorCommonForm { #region 鈻� 鍙橀噺澹版槑___________________________ @@ -35,7 +35,7 @@ private Common.Room room = null; /// <summary> /// Tab鐨勯�夋嫨銆�1锛氬姛鑳絋ab 2锛氬満鏅疶ab - /// </summary> + /// </summary> private int TabSelectIndex = 1; #endregion @@ -46,300 +46,309 @@ /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) /// </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) => - { - new System.Threading.Thread(() => - { - //纭鍒嗕韩 - this.DoSaveSharedContent(); - }) - { IsBackground = true }.Start(); - }; - - //鍒濆鍖栦腑閮ㄤ俊鎭� - this.InitMiddleFrame(); - } - - /// <summary> - /// 鍒濆鍖栦腑閮ㄤ俊鎭� - /// </summary> - private void InitMiddleFrame() - { - bodyFrameLayout.RemoveAll(); - - //鍒濆鍖朤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); - - new System.Threading.Thread(() => - { - //鍒濆鍖栧姛鑳絋ab鍒楄〃 - this.InitFunctionTabList(); - //鍒濆鍖栧満鏅疶ab鍒楄〃 - this.InitSceneTabList(); - }) - { IsBackground = true }.Start(); - } - - #endregion - - #region 鈻� 鍒濆鍖朤ab鎺т欢______________________ - - /// <summary> - /// 鍒濆鍖朤ab鎺т欢 - /// </summary> - /// <returns></returns> - private FrameLayout InitTabControl() + /// <param name="i_memberResult">鎴愬憳淇℃伅</param> + /// <param name="i_memberShardInfo">鎴愬憳鐨勫垎浜暟鎹�</param> + public void ShowForm(Common.Room i_room, MemberInfoRes i_memberResult, MemberShardInfoData i_memberShardInfo) { - //Tab鍒囨崲鎺т欢 - var frameSwich = new FrameLayout(); - frameSwich.Height = Application.GetRealHeight(150); - frameSwich.BackgroundColor = UserCenterColor.Current.TopFrameLayout; - bodyFrameLayout.AddChidren(frameSwich); - - //鍔熻兘 - var btnFunction = new ViewNormalControl(frameSwich.Width / 2, Application.GetRealHeight(100)); - btnFunction.Gravity = Gravity.CenterVertical; - btnFunction.TextID = R.MyInternationalizationString.Function; - btnFunction.TextAlignment = TextAlignment.Center; - btnFunction.TextColor = UserCenterColor.Current.SelectTextColor; - btnFunction.TextAlignment = TextAlignment.Center; - frameSwich.AddChidren(btnFunction); - - //鍦烘櫙 - var btnScene = new ViewNormalControl(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); + this.memberResult = i_memberResult; + this.memberShardInfo = i_memberShardInfo; + this.room = i_room; - 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; + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(this.room.Name); - //闅愯棌鍦烘櫙鍒楄〃鎺т欢,鏄剧ず璁惧鍒楄〃鎺т欢 - 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; + //鍒嗕韩 + //var btnShard = new TopLayoutFinshView(); + //btnShard.TextID = R.MyInternationalizationString.uShared; + //topFrameLayout.AddChidren(btnShard); + //btnShard.MouseUpEventHandler += (sender, e) => + //{ + // new System.Threading.Thread(() => + // { + // //纭鍒嗕韩 + // this.DoSaveSharedContent(); + // }) + // { IsBackground = true }.Start(); + //}; - //闅愯棌璁惧鍒楄〃鎺т欢,鏄剧ず鍦烘櫙鍒楄〃鎺т欢 - this.listDeviceView.Visible = false; - this.listSceneView.Visible = true; - }; - - return frameSwich; + ////鍒濆鍖栦腑閮ㄤ俊鎭� + //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); + + // new System.Threading.Thread(() => + // { + // //鍒濆鍖栧姛鑳絋ab鍒楄〃 + // this.InitFunctionTabList(); + // //鍒濆鍖栧満鏅疶ab鍒楄〃 + // this.InitSceneTabList(); + // }) + // { IsBackground = true }.Start(); + //} #endregion - #region 鈻� 鏄剧ず鍔熻兘Tab鍒楄〃____________________ + //#region 鈻� 鍒濆鍖朤ab鎺т欢______________________ - /// <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]; + ///// <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); - foreach (var deviceUi in this.room.DeviceUIList) - { - var device = deviceUi.CommonDevice; - if (device == null || listCheck.Contains(device.FilePath) == true) - { - //寮傚父锛屾垨鑰呭凡缁忓垎浜簡鐨勶紝涓嶅啀鏄剧ず - continue; - } - Application.RunOnMainThread(() => - { - //娣诲姞璁惧琛� - var deviceRow = new DeviceSelectRow(this.listDeviceView, device); - //涓嶉渶瑕佹埧闂存帶浠� - deviceRow.RemoveRoomControl(); - }); - } - } + // //鍔熻兘 + // var btnFunction = new NormalViewControl(frameSwich.Width / 2, Application.GetRealHeight(100)); + // btnFunction.Gravity = Gravity.CenterVertical; + // btnFunction.TextID = R.MyInternationalizationString.Function; + // btnFunction.TextAlignment = TextAlignment.Center; + // btnFunction.TextColor = UserCenterColor.Current.SelectTextColor; + // btnFunction.TextAlignment = TextAlignment.Center; + // frameSwich.AddChidren(btnFunction); - #endregion + // //鍦烘櫙 + // 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); - #region 鈻� 鏄剧ず鍦烘櫙Tab鍒楄〃____________________ + // //绾� + // var btnLine = new ProgressLine(); + // btnLine.Gravity = Gravity.BottomLeft; + // frameSwich.AddChidren(btnLine); + // btnLine.SetValue(50, true); - /// <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]; + // if (this.TabSelectIndex == 2) + // { + // btnScene.TextColor = UserCenterColor.Current.SelectTextColor; + // btnFunction.TextColor = Common.ZigbeeColor.Current.TextColor; + // btnLine.SetValue(50, false); + // } - foreach (var sceneUi in this.room.SceneUIList) - { - if (sceneUi == null || listCheck.Contains(sceneUi.FileName) == true) - { - //寮傚父锛屾垨鑰呭凡缁忓垎浜簡鐨勶紝涓嶅啀鏄剧ず - continue; - } - Application.RunOnMainThread(() => - { - //娣诲姞鍦烘櫙琛� - var sceneRow = new SceneSelectRow(this.listSceneView, sceneUi); - }); - } - } + // //鍔熻兘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; - #endregion + // //闅愯棌鍦烘櫙鍒楄〃鎺т欢,鏄剧ず璁惧鍒楄〃鎺т欢 + // this.listSceneView.Visible = false; + // this.listDeviceView.Visible = true; + // }; - #region 鈻� 鑾峰彇閫夋嫨鐨勮澶嘷____________________ + // //鍦烘櫙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; - /// <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 = (DeviceSelectRow)myView; - if (selectRow.IsSelected == true && listCheck.Contains(selectRow.device.FilePath) == false) - { - listCheck.Add(selectRow.device.FilePath); - listDevice.Add(selectRow.device); - } - } - return listDevice; - } + // //闅愯棌璁惧鍒楄〃鎺т欢,鏄剧ず鍦烘櫙鍒楄〃鎺т欢 + // this.listDeviceView.Visible = false; + // this.listSceneView.Visible = true; + // }; - #endregion + // return frameSwich; + //} - #region 鈻� 鑾峰彇閫夋嫨鐨勫満鏅痏____________________ + //#endregion - /// <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; - } + //#region 鈻� 鏄剧ず鍔熻兘Tab鍒楄〃____________________ - #endregion + ///// <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]; - #region 鈻� 纭鍒嗕韩___________________________ + // 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(); + // } + // }); + // } + //} - /// <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.ShowTip(msg); - }); - } - } + //#endregion - #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