| | |
| | | /// </summary> |
| | | Button btnFloor; |
| | | /// <summary> |
| | | /// 全选按钮 |
| | | /// </summary> |
| | | Button btnChooseAll; |
| | | /// <summary> |
| | | /// 功能列表集合显示区域 |
| | | /// </summary> |
| | | static VerticalScrolViewLayout functionListView; |
| | |
| | | btnFloor = new Button() |
| | | { |
| | | X = btnFloorDownIcon.Right, |
| | | Y = Application.GetRealHeight(18), |
| | | //Y = Application.GetRealHeight(18), |
| | | Width = Application.GetRealWidth(200), |
| | | Height = Application.GetMinRealAverage(16), |
| | | //Height = Application.GetMinRealAverage(16+18*2), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = DB_ResidenceData.Instance.CurFloor.roomName, |
| | | }; |
| | | roomFloorChangeView.AddChidren(btnFloor); |
| | | |
| | | btnChooseAll = new Button() |
| | | { |
| | | X = Application.GetRealWidth(245), |
| | | Width = Application.GetRealWidth(109), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextID = StringId.SelectedAll, |
| | | }; |
| | | if(sceneLishtList.Count>0) |
| | | { |
| | | btnChooseAll.TextID = StringId.Cancel; |
| | | } |
| | | roomFloorChangeView.AddChidren(btnChooseAll); |
| | | btnChooseAll.MouseUpEventHandler = (sender, e) => { |
| | | if (sceneLishtList.Count > 0) |
| | | { |
| | | sceneLishtList.Clear(); |
| | | btnChooseAll.TextID = StringId.SelectAll; |
| | | btnConfrim.IsSelected = false; |
| | | } |
| | | else |
| | | { |
| | | sceneLishtList.AddRange(lightList); |
| | | btnChooseAll.TextID = StringId.Cancel; |
| | | btnConfrim.IsSelected = true; |
| | | } |
| | | LoadLightRow(lightList); |
| | | }; |
| | | |
| | | #endregion |
| | | |
| | | functionListView = new VerticalScrolViewLayout() |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 显示的设备的总数 |
| | | /// </summary> |
| | | int showCount = 0; |
| | | |
| | | /// <summary> |
| | | /// 加载功能row |
| | | /// </summary> |
| | | /// <param name="lightList"></param> |
| | | void LoadLightRow(List<Function> functions) |
| | | void LoadLightRow(List<Function> functions, bool isAppend = false) |
| | | { |
| | | functionListView.RemoveAll(); |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(""); |
| | | |
| | | foreach (var function in functions) |
| | | new System.Threading.Thread(() => |
| | | { |
| | | var functionDiv = new LightRow(function) |
| | | try |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(62), |
| | | Radius = (uint)Application.GetMinRealAverage(12), |
| | | BorderColor = 0x00FFFFFF, |
| | | BorderWidth = 1, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Tag = function.spk + function.sid |
| | | }; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (!isAppend) |
| | | { |
| | | showCount = 0; |
| | | functionListView.RemoveAll(); |
| | | } |
| | | int i = 0; |
| | | foreach (var function in functions) |
| | | { |
| | | i++; |
| | | if (i > 100) |
| | | { |
| | | break; |
| | | } |
| | | showCount++; |
| | | var functionDiv = new LightRow(function) |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(62), |
| | | Radius = (uint)Application.GetMinRealAverage(12), |
| | | BorderColor = 0x00FFFFFF, |
| | | BorderWidth = 1, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Tag = function.spk + function.sid |
| | | }; |
| | | |
| | | Action setAction = () => |
| | | Action setAction = () => |
| | | { |
| | | if (sceneLishtList.Count > 0) |
| | | { |
| | | btnConfrim.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | btnConfrim.IsSelected = false; |
| | | } |
| | | }; |
| | | |
| | | functionDiv.LoadDiv(sceneLishtList, setAction); |
| | | functionListView.AddChidren(functionDiv); |
| | | |
| | | functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) }); |
| | | } |
| | | |
| | | if (functions.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(); |
| | | LoadLightRow(functions, true); |
| | | }; |
| | | } |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | if (sceneLishtList.Count > 0) |
| | | MainPage.Log("ShowFunctionRowError : " + ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnConfrim.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | btnConfrim.IsSelected = false; |
| | | } |
| | | }; |
| | | |
| | | functionDiv.LoadDiv(sceneLishtList,setAction); |
| | | functionListView.AddChidren(functionDiv); |
| | | |
| | | functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) }); |
| | | } |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | |
| | |
| | | var form = new FloorRoomSelectPopupView(); |
| | | form.ShowDeviceFunctionView(btnFloor, this.lightList, (selectId, listFunc) => |
| | | { |
| | | btnChooseAll.MouseUpEventHandler = (sender2, e2) => { |
| | | if (sceneLishtList.Count > 0) |
| | | { |
| | | sceneLishtList.Clear(); |
| | | btnChooseAll.TextID = StringId.SelectAll; |
| | | btnConfrim.IsSelected = false; |
| | | } |
| | | else |
| | | { |
| | | sceneLishtList.AddRange(listFunc); |
| | | btnChooseAll.TextID = StringId.Cancel; |
| | | btnConfrim.IsSelected = true; |
| | | } |
| | | LoadLightRow(listFunc); |
| | | }; |
| | | nowSelectId = selectId; |
| | | //重新加载界面 |
| | | LoadLightRow(listFunc); |