| | |
| | | /// bodyFrameLayout |
| | | /// </summary> |
| | | private FrameLayout bodyFrameLayout; |
| | | |
| | | private Button addBtn; |
| | | /// <summary> |
| | | /// top |
| | | /// </summary> |
| | | private TopFrameLayout top; |
| | | private Button selectAllBtn; |
| | | |
| | | private FrameLayout itemView; |
| | | /// <summary> |
| | | /// editStatus |
| | | /// </summary> |
| | | private bool SelectAll; |
| | | |
| | | /// <summary> |
| | | /// low_High |
| | | /// </summary> |
| | |
| | | sceneList = Shared.Common.Room.CurrentRoom.GetUnalloctedScenes(); |
| | | typeDeviceDic.Clear(); |
| | | typeIdDic.Clear(); |
| | | if (devList == null) |
| | | { |
| | | return; |
| | | } |
| | | foreach (var device in devList) |
| | | { |
| | | var info = Common.LocalDevice.Current.GetNotHdlMyDeviceEnumInfo(new List<CommonDevice> { device.CommonDevice }); |
| | | var info = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device.CommonDevice); |
| | | if (typeDeviceDic.ContainsKey(info.BeloneTextId) == false) |
| | | { |
| | | var sameDevList = new List<DeviceUI> { }; |
| | |
| | | /// </summary> |
| | | public void AddTop() |
| | | { |
| | | var top = new TopFrameLayout(); |
| | | top = new TopFrameLayout(); |
| | | AddChidren(top); |
| | | top.InitTopview(); |
| | | top.SetTopTitle(R.MyInternationalizationString.Unallocated); |
| | |
| | | { |
| | | RemoveFromParent(); |
| | | }; |
| | | |
| | | addBtn = new Button() |
| | | { |
| | | X = Application.GetRealWidth(1080-150-80), |
| | | Width = Application.GetRealWidth(150), |
| | | Height = Application.GetRealHeight(80), |
| | | Gravity = Gravity.CenterVertical, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextSize = CommonFormResouce.TopTitle_TextSize, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextID = R.MyInternationalizationString.AllSelect |
| | | }; |
| | | top.topView.AddChidren(addBtn); |
| | | |
| | | addBtn.MouseUpEventHandler += Edit_MouseUpEventHandler; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | RefreshBodyView(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 编辑 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="mouseEventArgs"></param> |
| | | private void Edit_MouseUpEventHandler(object sender, MouseEventArgs mouseEventArgs) |
| | | { |
| | | SelectAll = !SelectAll; |
| | | if (SelectAll) |
| | | { |
| | | addBtn.TextID = R.MyInternationalizationString.Cancel; |
| | | } |
| | | else |
| | | { |
| | | addBtn.TextID = R.MyInternationalizationString.AllSelect; |
| | | } |
| | | |
| | | if (functionBtn.IsSelected) |
| | | { |
| | | functionSceneBodyView.RemoveAll(); |
| | | ShowFunction(SelectAll); |
| | | } |
| | | else if (sceneBtn.IsSelected) |
| | | { |
| | | functionSceneBodyView.RemoveAll(); |
| | | ShowScene(SelectAll); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 刷新____________________________ |
| | |
| | | public void RefreshBodyView() |
| | | { |
| | | functionSceneBodyView.RemoveAll(); |
| | | SelectAll = false; |
| | | |
| | | if (functionBtn.IsSelected) |
| | | { |
| | | ShowFunction(SelectAll); |
| | | ShowFunction(); |
| | | } |
| | | else if (sceneBtn.IsSelected) |
| | | { |
| | | ShowScene(SelectAll); |
| | | ShowScene(); |
| | | } |
| | | } |
| | | |
| | |
| | | /// <summary> |
| | | /// 功能 |
| | | /// </summary> |
| | | public void ShowFunction(bool selectAll) |
| | | public void ShowFunction() |
| | | { |
| | | SelectAll = selectAll; |
| | | if (typeIdDic.Count == 0) |
| | | { |
| | | ShowNoFunctionTip(); |
| | |
| | | }; |
| | | string imgPath=string.Empty; |
| | | string imgSeletedPath=string.Empty; |
| | | Common.LocalDevice.Current.GetDeviceBeloneIcon(deviceType.Value, ref imgPath ,ref imgSeletedPath); |
| | | Common.LocalDevice.Current.GetDeviceObjectIcon(deviceType.Value, ref imgPath ,ref imgSeletedPath); |
| | | functionTypeIMG.Init(imgPath,imgSeletedPath); |
| | | functionTypeIMG.SetTitle(deviceType.Key); |
| | | typeRowLayout.AddChidren(functionTypeIMG); |
| | |
| | | ShowSameTypeFunction(functionTypeIMG.ImageBtn, null); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> |
| | | private void ShowSameTypeFunction(object typeSender, MouseEventArgs mouseEventArgs) |
| | | { |
| | | //选择功能--直接从房间的devicelist中获取 |
| | | tempFunctionTypeBtn.IsSelected = false; |
| | | tempFunctionTypeBtn = (typeSender as Button).Parent as FunctionButton; |
| | | ((typeSender as Button).Parent as FunctionButton).IsSelected = true; |
| | |
| | | var selectedList = new List<DeviceUI> { }; |
| | | sameTypeList = typeDeviceDic[int.Parse((typeSender as Button).Tag.ToString())]; |
| | | |
| | | if (SelectAll) |
| | | { |
| | | selectedList.AddRange(sameTypeList); |
| | | } |
| | | foreach (var deviceUI in sameTypeList) |
| | | { |
| | | var deviceTypeRowLayout = new FrameLayout() |
| | |
| | | var deviceRow = new SelectFunctionView(0, 35); |
| | | deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | deviceRow.IsSelected = SelectAll; |
| | | deviceTypeRowLayout.AddChidren(deviceRow); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | |
| | | } |
| | | }; |
| | | deviceRow.ClickBtn.MouseUpEventHandler += eventHandler; |
| | | |
| | | var addBackground = new Button |
| | | { |
| | | Y = Application.GetRealHeight(1405), |
| | | Width = Application.GetMinRealAverage(1080), |
| | | Height = Application.GetMinRealAverage(202), |
| | | UnSelectedImagePath = "Room/AddBackground.png" |
| | | }; |
| | | functionSceneBodyView.AddChidren(addBackground); |
| | | var add = new Button |
| | | { |
| | | Y = Application.GetRealHeight(1428), |
| | | Width = Application.GetRealWidth(1034), |
| | | Height = Application.GetRealHeight(156), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, |
| | | Radius = (uint)Application.GetRealHeight(35), |
| | | TextID = R.MyInternationalizationString.AddTo, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextSize=17 |
| | | }; |
| | | functionSceneBodyView.AddChidren(add); |
| | | add.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var selectZone = new SelectZone(); |
| | | AddChidren(selectZone); |
| | | selectZone.Init(); |
| | | selectZone.ZoneAction = (r) => |
| | | { |
| | | foreach (var d in selectedList) |
| | | { |
| | | r.AddDevice(d.CommonDevice,true); |
| | | deviceListScrolView.RemoveViewByTag(d); |
| | | } |
| | | RefreshData(); |
| | | }; |
| | | }; |
| | | } |
| | | |
| | | selectAllBtn?.RemoveFromParent(); |
| | | selectAllBtn = new Button() |
| | | { |
| | | X = Application.GetRealWidth(1080 - 150 - 80), |
| | | Width = Application.GetRealWidth(150), |
| | | Height = Application.GetRealHeight(80), |
| | | Gravity = Gravity.CenterVertical, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | SelectedTextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextSize = CommonFormResouce.TopTitle_TextSize, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextID = R.MyInternationalizationString.AllSelect |
| | | }; |
| | | top.topView.AddChidren(selectAllBtn); |
| | | selectAllBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | try |
| | | { |
| | | (sender as Button).IsSelected = !(sender as Button).IsSelected; |
| | | for (int i = 0; i < deviceListScrolView.ChildrenCount; i++) |
| | | { |
| | | var frame = deviceListScrolView.GetChildren(i) as FrameLayout; |
| | | (frame.GetChildren(0) as SelectFunctionView).IsSelected = (sender as Button).IsSelected; |
| | | } |
| | | if ((sender as Button).IsSelected) |
| | | { |
| | | (sender as Button).TextID = R.MyInternationalizationString.Cancel; |
| | | selectedList.Clear(); |
| | | selectedList.AddRange(sameTypeList); |
| | | } |
| | | else |
| | | { |
| | | (sender as Button).TextID = R.MyInternationalizationString.AllSelect; |
| | | selectedList.Clear(); |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | }; |
| | | |
| | | var addBackground = new Button |
| | | { |
| | | Y = Application.GetRealHeight(1405), |
| | | Width = Application.GetMinRealAverage(1080), |
| | | Height = Application.GetMinRealAverage(202), |
| | | UnSelectedImagePath = "Room/AddBackground.png" |
| | | }; |
| | | functionSceneBodyView.AddChidren(addBackground); |
| | | var add = new Button |
| | | { |
| | | Y = Application.GetRealHeight(1428), |
| | | Width = Application.GetRealWidth(1034), |
| | | Height = Application.GetRealHeight(156), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, |
| | | Radius = (uint)Application.GetRealHeight(35), |
| | | TextID = R.MyInternationalizationString.AddTo, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextSize = 17 |
| | | }; |
| | | functionSceneBodyView.AddChidren(add); |
| | | add.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var selectZone = new SelectZone(); |
| | | AddChidren(selectZone); |
| | | selectZone.Init(); |
| | | selectZone.ZoneAction = (r) => |
| | | { |
| | | foreach (var d in selectedList) |
| | | { |
| | | r.AddDevice(d.CommonDevice, true); |
| | | deviceListScrolView.RemoveViewByTag(d); |
| | | } |
| | | |
| | | if (sameTypeList.Count == selectedList.Count) |
| | | { |
| | | RefreshData(); |
| | | RefreshBodyView(); |
| | | } |
| | | else |
| | | { |
| | | RefreshData(); |
| | | sameTypeList = typeDeviceDic[int.Parse((typeSender as Button).Tag.ToString())]; |
| | | } |
| | | }; |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <summary> |
| | | /// 选择场景--所有房间的所有场景 |
| | | /// </summary> |
| | | public void ShowScene(bool selectAll) |
| | | public void ShowScene() |
| | | { |
| | | List<SceneUI> selectedList = new List<SceneUI>(); |
| | | if (sceneList == null || sceneList.Count == 0) |
| | |
| | | } |
| | | else |
| | | {
|
| | | if (selectAll)
|
| | | {
|
| | | selectedList.AddRange(sceneList);
|
| | | } |
| | | var sceneScrolView = new VerticalScrolViewLayout |
| | | { |
| | | Y = Application.GetRealHeight(22), |
| | |
| | | Height = Application.GetMinRealAverage(60), |
| | | UnSelectedImagePath = "Room/ItemUnSelected.png", |
| | | SelectedImagePath = "Room/ItemSelected.png", |
| | | IsSelected = selectAll |
| | | }; |
| | | sceneFL.AddChidren(selectedBtn); |
| | | |
| | |
| | | sceneImg.MouseUpEventHandler += eventHandler; |
| | | } |
| | | |
| | | selectAllBtn?.RemoveFromParent(); |
| | | selectAllBtn = new Button() |
| | | { |
| | | X = Application.GetRealWidth(1080 - 150 - 80), |
| | | Width = Application.GetRealWidth(150), |
| | | Height = Application.GetRealHeight(80), |
| | | Gravity = Gravity.CenterVertical, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | SelectedTextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextSize = CommonFormResouce.TopTitle_TextSize, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextID = R.MyInternationalizationString.AllSelect |
| | | }; |
| | | top.topView.AddChidren(selectAllBtn); |
| | | selectAllBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | try |
| | | { |
| | | (sender as Button).IsSelected = !(sender as Button).IsSelected; |
| | | for (int i = 0; i < sceneScrolView.ChildrenCount; i++) |
| | | { |
| | | var frame = sceneScrolView.GetChildren(i) as FrameLayout; |
| | | (frame.GetChildren(1) as Button).IsSelected = (sender as Button).IsSelected; |
| | | } |
| | | |
| | | if ((sender as Button).IsSelected) |
| | | { |
| | | (sender as Button).TextID = R.MyInternationalizationString.Cancel; |
| | | selectedList.AddRange(sceneList); |
| | | } |
| | | else |
| | | { |
| | | (sender as Button).TextID = R.MyInternationalizationString.AllSelect; |
| | | selectedList.Clear(); |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | }; |
| | | |
| | | var addBackground = new Button |
| | | { |
| | | Y = Application.GetRealHeight(1405), |