| | |
| | | private TopFrameLayout top; |
| | | private Button selectAllBtn; |
| | | |
| | | private FrameLayout itemView; |
| | | /// <summary> |
| | | /// low_High |
| | | /// </summary> |
| | | private const int low_High = 127; |
| | | /// <summary> |
| | | /// 功能 |
| | | /// </summary> |
| | | private ButtonLineForm functionBtn; |
| | | /// <summary> |
| | | /// 场景 |
| | | /// </summary> |
| | | private ButtonLineForm sceneBtn; |
| | | /// <summary> |
| | | /// 中部背景bodyView |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// dList |
| | | /// </summary> |
| | | private List<DeviceUI> devList; |
| | | private List<CommonDevice> devList; |
| | | /// <summary> |
| | | /// sceneList |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 相同类型的设备列表 |
| | | /// </summary> |
| | | private Dictionary<int ,List<DeviceUI>> typeDeviceDic; |
| | | private Dictionary<int ,List<CommonDevice>> typeDeviceDic; |
| | | /// <summary> |
| | | /// 设备类型的图id |
| | | /// </summary> |
| | | private Dictionary<int, DeviceConcreteType> typeIdDic; |
| | | /// <summary>
|
| | | /// 当前选择的分支 1:场景 2:功能
|
| | | /// </summary> |
| | | private int NowSelectIndex = 1; |
| | | |
| | | #endregion |
| | | |
| | |
| | | /// </summary> |
| | | private void InitData() |
| | | { |
| | | typeDeviceDic = new Dictionary<int, List<DeviceUI>> { }; |
| | | typeDeviceDic = new Dictionary<int, List<CommonDevice>> { }; |
| | | typeIdDic = new Dictionary<int, DeviceConcreteType> { }; |
| | | |
| | | RefreshData(); |
| | |
| | | /// </summary> |
| | | private void RefreshData() |
| | | { |
| | | devList = Shared.Common.Room.CurrentRoom.GetUnalloctedDeviceUIs(); |
| | | sceneList = Shared.Common.Room.CurrentRoom.GetUnalloctedScenes(); |
| | | devList = UserCenter.HdlRoomLogic.Current.GetUnalloctedDevice(); |
| | | sceneList = UserCenter.HdlSceneLogic.Current.GetUnalloctedScenes(); |
| | | typeDeviceDic.Clear(); |
| | | typeIdDic.Clear(); |
| | | if (devList == null) |
| | |
| | | } |
| | | foreach (var device in devList) |
| | | { |
| | | var info = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device?.CommonDevice); |
| | | var info = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device); |
| | | if (typeDeviceDic.ContainsKey(info.BeloneTextId) == false) |
| | | { |
| | | var sameDevList = new List<DeviceUI> { }; |
| | | var sameDevList = new List<CommonDevice> { }; |
| | | sameDevList.Add(device); |
| | | typeDeviceDic[info.BeloneTextId] = sameDevList; |
| | | } |
| | |
| | | typeIdDic[info.BeloneTextId] = info.ConcreteType; |
| | | } |
| | | } |
| | | |
| | | ///// <summary> |
| | | ///// RefreshView |
| | | ///// </summary> |
| | | //public void RefreshView() |
| | | //{ |
| | | // InitData(); |
| | | // RefreshBodyView(); |
| | | //} |
| | | |
| | | #region Add____________________________________ |
| | | |
| | |
| | | }; |
| | | AddChidren(bodyFrameLayout); |
| | | |
| | | var functionSceneBG = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(low_High), |
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor |
| | | //场景功能切换控件 |
| | | var btnSceneFunctionSwitch = new UserCenter.SceneFunctionSwitchControl(); |
| | | btnSceneFunctionSwitch.Y = Application.GetRealHeight(43); |
| | | bodyFrameLayout.AddChidren(btnSceneFunctionSwitch); |
| | | btnSceneFunctionSwitch.SelectTabEvent += (index) =>
|
| | | {
|
| | | this.NowSelectIndex = index;
|
| | | this.RefreshBodyView();
|
| | | }; |
| | | bodyFrameLayout.AddChidren(functionSceneBG); |
| | | |
| | | //场景 |
| | | sceneBtn = new ButtonLineForm(CommonFormResouce.X_Left, 43); |
| | | functionSceneBG.AddChidren(sceneBtn); |
| | | sceneBtn.Init(); |
| | | sceneBtn.SetTitle(R.MyInternationalizationString.Scence); |
| | | sceneBtn.IsSelected = true; |
| | | |
| | | //功能 |
| | | functionBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 + 20, 43); |
| | | functionSceneBG.AddChidren(functionBtn); |
| | | functionBtn.Init(); |
| | | functionBtn.SetTitle(R.MyInternationalizationString.Function); |
| | | functionBtn.IsSelected = false; |
| | | functionBtn.X = sceneBtn.Right; |
| | | |
| | | //选择功能分栏 |
| | | functionBtn.NameBtn.MouseUpEventHandler += FunctionBtn_MouseUpEventHandler; |
| | | //选择场景分栏 |
| | | sceneBtn.NameBtn.MouseUpEventHandler += SceneBtn_MouseUpEventHandler; |
| | | |
| | | //功能和场景bodyView |
| | | functionSceneBodyView = new FrameLayout() |
| | | { |
| | | Y= Application.GetRealHeight(127), |
| | | Y = Application.GetRealHeight(127), |
| | | Height = Application.GetRealHeight(1607), |
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor |
| | | }; |
| | | bodyFrameLayout.AddChidren(functionSceneBodyView); |
| | | |
| | | RefreshBodyView(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 选择功能分栏 |
| | | /// </summary> |
| | | /// <param name="sender">Sender.</param> |
| | | /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> |
| | | private void FunctionBtn_MouseUpEventHandler(object sender, MouseEventArgs mouseEventArgs) |
| | | { |
| | | functionBtn.IsSelected = true; |
| | | sceneBtn.IsSelected = false; |
| | | RefreshBodyView(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 选择场景分栏 |
| | | /// </summary> |
| | | /// <param name="sender">Sender.</param> |
| | | /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> |
| | | private void SceneBtn_MouseUpEventHandler(object sender, MouseEventArgs mouseEventArgs) |
| | | { |
| | | functionBtn.IsSelected = false; |
| | | sceneBtn.IsSelected = true; |
| | | RefreshBodyView(); |
| | | //开始初始化场景功能切换控件 |
| | | btnSceneFunctionSwitch.InitControl(); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | { |
| | | functionSceneBodyView.RemoveAll(); |
| | | |
| | | if (functionBtn.IsSelected) |
| | | if (this.NowSelectIndex == 2) |
| | | { |
| | | ShowFunction(); |
| | | } |
| | | else if (sceneBtn.IsSelected) |
| | | else if (this.NowSelectIndex == 1) |
| | | { |
| | | ShowScene(); |
| | | } |
| | |
| | | |
| | | deviceListScrolView.RemoveAll(); |
| | | |
| | | var sameTypeList = new List<DeviceUI> { }; |
| | | var selectedList = new List<DeviceUI> { }; |
| | | var sameTypeList = new List<CommonDevice> { }; |
| | | var selectedList = new List<CommonDevice> { }; |
| | | sameTypeList = typeDeviceDic[int.Parse((typeSender as Button).Tag.ToString())]; |
| | | |
| | | foreach (var deviceUI in sameTypeList) |
| | |
| | | |
| | | var deviceRow = new SelectFunctionView(0, 35); |
| | | deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI.CommonDevice)); |
| | | deviceRow.SetTitle(Common.LocalDevice.Current.GetDeviceEpointName(deviceUI)); |
| | | deviceTypeRowLayout.AddChidren(deviceRow); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | |
| | | { |
| | | foreach (var d in selectedList) |
| | | { |
| | | r.AddDevice(d.CommonDevice, true); |
| | | UserCenter.HdlRoomLogic.Current.AddDevice(r, d, true); |
| | | deviceListScrolView.RemoveViewByTag(d); |
| | | } |
| | | |
| | |
| | | {
|
| | | var sceneScrolView = new VerticalScrolViewLayout |
| | | { |
| | | Y = Application.GetRealHeight(22), |
| | | Y = Application.GetRealHeight(81), |
| | | Height=Application.GetRealHeight(1405-22) |
| | | }; |
| | | functionSceneBodyView.AddChidren(sceneScrolView); |
| | |
| | | var sceneFL = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(CommonFormResouce.AppRealWidth), |
| | | Height = Application.GetRealHeight(397 + 58), |
| | | Height = Application.GetRealHeight(397 + 46), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor, |
| | | Tag = sceneUI, |
| | |
| | | var sceneImg = new ImageView() |
| | | { |
| | | X = Application.GetRealWidth(179), |
| | | Y = Application.GetRealHeight(58), |
| | | Width = Application.GetRealWidth(844), |
| | | Height = Application.GetRealHeight(397), |
| | | ImagePath = sceneUI.IconPath, |
| | | Radius = (uint)Application.GetRealHeight(17) |
| | | }; |
| | | sceneFL.AddChidren(sceneImg); |
| | | sceneFL.AddChidren(sceneImg);
|
| | |
|
| | | //阴影
|
| | | var btnShadow = new UserCenter.PicViewControl(sceneImg.Width + Application.GetRealWidth(14 * 2), sceneImg.Height + Application.GetRealHeight(43), false);
|
| | | btnShadow.X = sceneImg.X - Application.GetRealWidth(14);
|
| | | btnShadow.UnSelectedImagePath = "Scene/SceneShadow.png";
|
| | | sceneFL.AddChidren(btnShadow); |
| | | |
| | | var selectedBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(919), |
| | | Y = Application.GetRealHeight(92), |
| | | Y = Application.GetRealHeight(45), |
| | | Width = Application.GetMinRealAverage(60), |
| | | Height = Application.GetMinRealAverage(60), |
| | | UnSelectedImagePath = "Room/ItemUnSelected.png", |
| | |
| | | var leftFL = new FrameLayout |
| | | { |
| | | X = Application.GetRealWidth(CommonFormResouce.X_Left), |
| | | Y = Application.GetRealHeight(58 + 58), |
| | | Y = Application.GetRealHeight(58), |
| | | Width = Application.GetRealWidth(251), |
| | | Height = Application.GetRealHeight(282), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBlackBackgroundColor2 |
| | | BackgroundColor = 0xd6333333, |
| | | Radius = (uint)Application.GetRealHeight(17) |
| | | }; |
| | | sceneFL.AddChidren(leftFL); |
| | | |
| | |
| | | { |
| | | foreach (var s in selectedList) |
| | | { |
| | | r.AddScene(s); |
| | | UserCenter.HdlSceneLogic.Current.AddScene(r, s); |
| | | sceneScrolView.RemoveViewByTag(s); |
| | | } |
| | | RefreshData(); |