| | |
| | | { |
| | | static AcstParentPage basePage; |
| | | |
| | | VerticalScrolViewLayout bodyView; |
| | | VerticalScrolViewLayout contentView; |
| | | |
| | | |
| | | #region 天气控件 |
| | | Button btnOutdoorTemp; |
| | |
| | | basePage = this; |
| | | this.function = FunctionList.List.GetAcstParentList()[0]; |
| | | this.BackgroundColor = CSS.CSS_Color.BackgroundColor; |
| | | bodyView = new VerticalScrolViewLayout(); |
| | | this.AddChidren(bodyView); |
| | | contentView = new VerticalScrolViewLayout() { |
| | | Height = Application.GetRealHeight(667 - 56), |
| | | }; |
| | | this.AddChidren(contentView); |
| | | subViewList = new Dictionary<string, AcstSubControlView>(); |
| | | } |
| | | /// <summary> |
| | |
| | | Height = Application.GetRealHeight(180), |
| | | BackgroundImagePath = $"FunctionIcon/Acst/{imageFolder}/TopViewBg.png", |
| | | }; |
| | | bodyView.AddChidren(topView); |
| | | contentView.AddChidren(topView); |
| | | |
| | | var backView = new FrameLayout() |
| | | { |
| | |
| | | |
| | | #endregion |
| | | |
| | | bodyView.AddChidren(new Button |
| | | contentView.AddChidren(new Button |
| | | { |
| | | Height = Application.GetRealHeight(8), |
| | | }); |
| | |
| | | Height = Application.GetRealHeight(104), |
| | | BackgroundColor = CSS.CSS_Color.MainBackgroundColor, |
| | | }; |
| | | bodyView.AddChidren(infoView); |
| | | contentView.AddChidren(infoView); |
| | | |
| | | var infoContentView = new FrameLayout() |
| | | { |
| | |
| | | |
| | | if (tempObj != null) |
| | | { |
| | | sensorDiyView_Temp = new SensorDiyView(sensorListView, curColor, tempObj.state == "" ? "--" : tempObj.state, "°", Language.StringByID(StringId.Temp)); |
| | | string tempValues = tempObj.state == "" ? "--" : tempObj.state; |
| | | if (tempValues.Contains(".")) |
| | | { |
| | | tempValues = tempValues.Remove(tempValues.IndexOf('.'), tempValues.Length - tempValues.IndexOf('.')); |
| | | } |
| | | sensorDiyView_Temp = new SensorDiyView(sensorListView, curColor, tempValues, "°", Language.StringByID(StringId.Temp)); |
| | | } |
| | | if (humiObj != null) |
| | | { |
| | | sensorDiyView_Humi = new SensorDiyView(sensorListView, curColor, humiObj.state == "" ? "--" : humiObj.state, "%", Language.StringByID(StringId.Humidity)); |
| | | string humiValues = humiObj.state == "" ? "--" : humiObj.state; |
| | | if (humiValues.Contains(".")) |
| | | { |
| | | humiValues = humiValues.Remove(humiValues.IndexOf('.'), humiValues.Length - humiValues.IndexOf('.')); |
| | | } |
| | | sensorDiyView_Humi = new SensorDiyView(sensorListView, curColor, humiValues , "%", Language.StringByID(StringId.Humidity)); |
| | | } |
| | | if (pm25Obj != null) |
| | | { |
| | |
| | | { |
| | | Height = Application.GetRealHeight(54-11), |
| | | }; |
| | | bodyView.AddChidren(subTitleView); |
| | | contentView.AddChidren(subTitleView); |
| | | |
| | | var btnCollection = new Button() |
| | | { |
| | |
| | | { |
| | | Height = Application.GetRealHeight(88), |
| | | }; |
| | | bodyView.AddChidren(subFunctionListView); |
| | | contentView.AddChidren(subFunctionListView); |
| | | |
| | | |
| | | subFunctionListView.AddChidren(new Button { Width = Application.GetRealWidth(9) }); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | foreach (var sub in FunctionList.List.GetAcstSubList()) |
| | | { |
| | | if (subViewList.ContainsKey(sub.sid)) |
| | |
| | | continue; |
| | | } |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (subFunctionCount > 0 && subFunctionCount % 2 == 0) |
| | | { |
| | | subFunctionListView = new HorizontalScrolViewLayout() |
| | | { |
| | | Height = Application.GetRealHeight(93), |
| | | }; |
| | | bodyView.AddChidren(subFunctionListView); |
| | | contentView.AddChidren(subFunctionListView); |
| | | subFunctionListView.AddChidren(new Button { Width = Application.GetRealWidth(9) }); |
| | | } |
| | | |
| | | AcstSubControlView subFunctionView = new AcstSubControlView(sub, subFunctionListView,imageFolder); |
| | | |
| | | subViewList.Add(sub.sid, subFunctionView); |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | Control.Ins.SendReadCommand(sub); |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | subFunctionCount++; |
| | | } |
| | | }); |
| | | |
| | | System.Threading.Thread.Sleep(10); |
| | | } |
| | | } |
| | | catch { } |
| | | finally{ |
| | | |
| | | } |
| | | }).Start(); |
| | | #endregion |
| | | |
| | | bodyView.AddChidren(new Button() |
| | | { |
| | | Height = Application.GetRealHeight(72), |
| | | }); |
| | | |
| | | #region 底部控制栏 |
| | | var bottomView = new FrameLayout() |
| | |
| | | Language.StringByID(StringId.AtHome), curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.at_home.ToString()); |
| | | atHomeIconButton.Click(() => |
| | | { |
| | | btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAtHome2.png"; |
| | | btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAtHome2.png"; |
| | | dialog.Close(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | |
| | | Language.StringByID(StringId.AwayHome), curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.leave_home.ToString()); |
| | | awayHomeIconButton.Click(() => |
| | | { |
| | | btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAwayHomeIcon2.png"; |
| | | btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAwayHomeIcon2.png"; |
| | | dialog.Close(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | |
| | | Language.StringByID(StringId.Sleep), curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.sleep.ToString()); |
| | | sleepIconButton.Click(() => |
| | | { |
| | | btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneSleepIcon2.png"; |
| | | btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneSleepIcon2.png"; |
| | | dialog.Close(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | |
| | | |
| | | InitGetWeatherAction(); |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | Control.Ins.SendReadCommand(function); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | |
| | |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = 0xFF949AA5, |
| | | TextSize = 12, |
| | | Text = text + "(" + unitString+")", |
| | | Text = text , |
| | | }; |
| | | contentView.AddChidren(btnText); |
| | | |
| | | if(!string.IsNullOrEmpty(unitString)) |
| | | { |
| | | btnText.Text += "(" + unitString + ")"; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | { |
| | | value = value.Remove(value.IndexOf('.'), value.Length - value.IndexOf('.')); |
| | | } |
| | | btnValue.Text = value + unitString; |
| | | btnValue.Text = value; |
| | | } |
| | | } |
| | | |