| | |
| | | { |
| | | |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | if (titleId == StringId.Lights) |
| | | if (titleId == StringId.Lights && !DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl) |
| | | { |
| | | Action action = () => |
| | | { |
| | |
| | | if (titleId == StringId.Lights) |
| | | { |
| | | functionList.AddRange(FunctionList.List.GetLightList()); |
| | | functionList.AddRange(FunctionList.List.groupControls); |
| | | |
| | | |
| | | var lightScene = FunctionList.List.scenes.FindAll((obj) => obj.sceneType == SceneType.LightScene); |
| | | |
| | | foreach (var scene in lightScene) |
| | |
| | | { |
| | | functionList.AddRange(FunctionList.List.GetAirFreshList()); |
| | | } |
| | | functionList.OrderByDescending(o => o.controlCounter).ToList(); |
| | | else if(titleId == StringId.MechanicalArm) |
| | | { |
| | | functionList.AddRange(FunctionList.List.GetMechanicalArmList()); |
| | | } |
| | | else if(titleId == StringId.SecurityMonitoring) |
| | | { |
| | | functionList.AddRange(FunctionList.List.GetIpCamImouList()); |
| | | } |
| | | functionList = functionList.OrderByDescending(o => o.controlCounter).ToList(); |
| | | |
| | | ShowFunctionRow(functionList); |
| | | |
| | | LoadDialog_ChangeFloor(); |
| | | } |
| | | |
| | | |
| | | #region 加载组合调光场景 |
| | | if (titleId == StringId.Lights) |
| | | { |
| | | foreach (var lightScene in FunctionList.List.scenes) |
| | | { |
| | | if (lightScene.sceneType == SceneType.LightScene) |
| | | if (lightScene != null) |
| | | { |
| | | functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) }); |
| | | var sceneRow = new SceneControlZone(lightScene); |
| | | functionListView.AddChidren(sceneRow); |
| | | sceneRow.LoadView(); |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 显示的设备的总数 |
| | | /// </summary> |
| | | int showCount = 0; |
| | | /// <summary> |
| | | /// 加载功能row |
| | | /// </summary> |
| | | void ShowFunctionRow(List<Function> showList) |
| | | void ShowFunctionRow(List<Function> showList, bool isAppend = false) |
| | | { |
| | | functionListView.RemoveAll(); |
| | | foreach (var function in showList) |
| | | { |
| | | if(function.spk == SPK.SensorDryContact|| function.spk == SPK.SensorDryContact2) |
| | | { |
| | | continue; |
| | | } |
| | | if (function.spk == SPK.LightRGBW || function.spk == SPK.LightRGB || function.spk == SPK.LightDimming) |
| | | { |
| | | var functionDiv = new FunctionControlZone(function) |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(116), |
| | | Radius = (uint)Application.GetMinRealAverage(12), |
| | | BorderColor = 0x00FFFFFF, |
| | | BorderWidth = 1, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Tag = function.spk + function.sid |
| | | }; |
| | | functionDiv.LoadFunctionDiv(); |
| | | functionListView.AddChidren(functionDiv); |
| | | } |
| | | else |
| | | { |
| | | var functionDiv = new FunctionControlZone(function) |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(96), |
| | | Radius = (uint)Application.GetMinRealAverage(12), |
| | | BorderColor = 0x00FFFFFF, |
| | | BorderWidth = 1, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Tag = function.spk + function.sid |
| | | }; |
| | | functionDiv.LoadFunctionDiv(); |
| | | functionListView.AddChidren(functionDiv); |
| | | } |
| | | functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(10) }); |
| | | } |
| | | } |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(""); |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (!isAppend) |
| | | { |
| | | showCount = 0; |
| | | functionListView.RemoveAll(); |
| | | } |
| | | int i = 0; |
| | | foreach (var function in showList) |
| | | { |
| | | i++; |
| | | if (i > 50) |
| | | { |
| | | break; |
| | | } |
| | | showCount++; |
| | | |
| | | if (function.spk == SPK.SensorDryContact || function.spk == SPK.SensorDryContact2) |
| | | { |
| | | continue; |
| | | } |
| | | if (function.spk == SPK.LightRGBW || function.spk == SPK.LightRGB || function.spk == SPK.LightDimming) |
| | | { |
| | | var functionDiv = new FunctionControlZone(function,null) |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(116), |
| | | Radius = (uint)Application.GetMinRealAverage(12), |
| | | BorderColor = 0x00FFFFFF, |
| | | BorderWidth = 1, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Tag = function.spk + function.sid |
| | | }; |
| | | functionDiv.LoadFunctionDiv(); |
| | | functionDiv.OrderEvent = OrderEvent; |
| | | functionListView.AddChidren(functionDiv); |
| | | } |
| | | else if (function.spk == SPK.IpCam_Imou) |
| | | { |
| | | var functionDiv = new FunctionControlZone(function,null) |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(96), |
| | | Radius = (uint)Application.GetMinRealAverage(12), |
| | | BorderColor = 0x00FFFFFF, |
| | | BorderWidth = 1, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Tag = function.spk + function.sid |
| | | }; |
| | | functionDiv.LoadFunctionDiv(); |
| | | functionListView.AddChidren(functionDiv); |
| | | |
| | | } |
| | | else |
| | | { |
| | | var functionDiv = new FunctionControlZone(function,null) |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(96), |
| | | Radius = (uint)Application.GetMinRealAverage(12), |
| | | BorderColor = 0x00FFFFFF, |
| | | BorderWidth = 1, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Tag = function.spk + function.sid |
| | | }; |
| | | functionDiv.LoadFunctionDiv(); |
| | | functionDiv.OrderEvent = OrderEvent; |
| | | functionListView.AddChidren(functionDiv); |
| | | } |
| | | functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(10) }); |
| | | } |
| | | if (showList.Count > showCount) |
| | | { |
| | | var btnAppend = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(60), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | Text = "加载更多", |
| | | }; |
| | | if (Language.CurrentLanguage != "Chinese") |
| | | { |
| | | btnAppend.Text = "Load more"; |
| | | } |
| | | functionListView.AddChidren(btnAppend); |
| | | btnAppend.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnAppend.RemoveFromParent(); |
| | | ShowFunctionRow(showList, true); |
| | | }; |
| | | } |
| | | |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log("ShowFunctionRowError : " + ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | /// <summary> |
| | | /// 排序事件 |
| | | /// </summary> |
| | | void OrderEvent() |
| | | { |
| | | Action action = () => |
| | | { |
| | | functionList = functionList.OrderBy(o => o.FunctionOrderNumber).ToList(); |
| | | ShowFunctionRow(functionList); |
| | | }; |
| | | var skipView = new OrderFunctionPage(); |
| | | MainPage.BasePageView.AddChidren(skipView); |
| | | skipView.LoadPage(functionList, action); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | |
| | | ///// <summary> |
| | | ///// 加载功能类型控制卡片 |