| | |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | |
| | | public class VerticalScrolViewLayoutJinmao : VerticalScrolViewLayout |
| | | { |
| | | public VerticalScrolViewLayoutJinmao() |
| | | { |
| | | #if __IOS__ |
| | | try |
| | | { |
| | | //自动偏移取消 |
| | | if (UIKit.UIDevice.CurrentDevice.CheckSystemVersion(11, 0)) |
| | | { |
| | | (this.uiView as UIKit.UIScrollView).ContentInsetAdjustmentBehavior = UIKit.UIScrollViewContentInsetAdjustmentBehavior.Never; |
| | | } |
| | | }catch(Exception ex) |
| | | { |
| | | MainPage.Log("error", "金茂iOS 滚动容器偏移值设置异常:" + ex.Message); |
| | | } |
| | | #endif |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绿建科技系统 |
| | |
| | | { |
| | | static AcstParentPage basePage; |
| | | |
| | | VerticalScrolViewLayout contentView; |
| | | VerticalScrolViewLayoutJinmao contentView; |
| | | |
| | | string helloText = "上午好"; |
| | | |
| | |
| | | /// </summary> |
| | | Dictionary<string, AcstSubControlView> subViewList; |
| | | |
| | | |
| | | Button btnWorkSceneControl; |
| | | |
| | | Button btnModeControl; |
| | | Button btnPowerControl; |
| | | |
| | |
| | | this.function = FunctionList.List.GetAcstParentList()[0]; |
| | | this.BackgroundColor = CSS.CSS_Color.BackgroundColor; |
| | | //this.AddChidren(new Button() { Height = Application.GetRealHeight(50), BackgroundColor = curColor }); |
| | | contentView = new VerticalScrolViewLayout() { |
| | | contentView = new VerticalScrolViewLayoutJinmao() |
| | | { |
| | | Height = Application.GetRealHeight(667 - 56), |
| | | VerticalScrollBarEnabled = false, |
| | | }; |
| | | this.AddChidren(contentView); |
| | | basePage.AddChidren(contentView); |
| | | |
| | | |
| | | subViewList = new Dictionary<string, AcstSubControlView>(); |
| | | } |
| | | /// <summary> |
| | |
| | | switch (temp.GetAttrState("mode")) |
| | | { |
| | | case "cool"://制冷 |
| | | basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeCoolIcon2.png"; |
| | | basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeCoolIcon2.png"; |
| | | basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeCoolIcon2.png"; |
| | | break; |
| | | case "heat"://制热 |
| | | basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHeatIcon2.png"; |
| | | basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHeatIcon2.png"; |
| | | basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHeatIcon2.png"; |
| | | break; |
| | | case "fan"://通风 |
| | | basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeFanIcon2.png"; |
| | | basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeFanIcon2.png"; |
| | | basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeFanIcon2.png"; |
| | | break; |
| | | case "dry"://除湿 |
| | | basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeDeHumiIcon2.png"; |
| | | basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeDeHumiIcon2.png"; |
| | | basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeDeHumiIcon2.png"; |
| | | break; |
| | | case "humidity"://加湿 |
| | | basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHumiIcon2.png"; |
| | | basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHumiIcon2.png"; |
| | | basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHumiIcon2.png"; |
| | | break; |
| | | case "heat_humidity"://制热加湿 |
| | | basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHeatHumiIcon2.png"; |
| | | basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHeatHumiIcon2.png"; |
| | | basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHeatHumiIcon2.png"; |
| | | break; |
| | | } |
| | | switch (temp.GetAttrState("scene")) |
| | | { |
| | | case "at_home"://在家 |
| | | basePage.btnWorkSceneControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneAtHome2.png"; |
| | | basePage.btnWorkSceneControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneAtHome2.png"; |
| | | basePage.btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/SceneAtHome2.png"; |
| | | break; |
| | | case "leave_home"://离家 |
| | | basePage.btnWorkSceneControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneAwayHomeIcon2.png"; |
| | | basePage.btnWorkSceneControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneAwayHomeIcon2.png"; |
| | | basePage.btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/SceneAwayHomeIcon2.png"; |
| | | break; |
| | | case "sleep"://睡眠 |
| | | basePage.btnWorkSceneControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneSleepIcon2.png"; |
| | | basePage.btnWorkSceneControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneSleepIcon2.png"; |
| | | basePage.btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/SceneSleepIcon2.png"; |
| | | break; |
| | | } |
| | | basePage.btnModeControl.IsSelected = basePage.btnWorkSceneControl.IsSelected = basePage.btnPowerControl.IsSelected = temp.GetAttrState("on_off") == "on"; |
| | | }); |
| | | }catch (Exception ex) |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log("科技系统更新数据失败"); |
| | | MainPage.Log("科技系统更新数据失败:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 更新子控信息 |
| | |
| | | basePage.subViewList.TryGetValue(temp.sid, out view); |
| | | if (view != null) |
| | | { |
| | | view.btnSubHumidityValues.Text = temp.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString()) + "%"; |
| | | view.btnSubTempValues.Text = temp.GetAttrState(AcstSub_AttrEnum.room_temp.ToString()) + "°"; |
| | | view.btnSubPower.IsSelected = temp.GetAttrState(AcstSub_AttrEnum.on_off.ToString()) == "on"; |
| | | if (temp.spk == SPK.AcstSub) |
| | | { |
| | | view.btnSubHumidityValues.Text = temp.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString()) + "%"; |
| | | view.btnSubTempValues.Text = temp.GetAttrState(AcstSub_AttrEnum.room_temp.ToString()) + "°"; |
| | | view.btnSubPower.IsSelected = temp.GetAttrState(AcstSub_AttrEnum.on_off.ToString()) == "on"; |
| | | } |
| | | else if (temp.spk == SPK.WaterHeaterJinmao) |
| | | { |
| | | view.btnSubTempValues.Text = temp.GetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString()) + "°"; |
| | | view.btnSubPower.IsSelected = temp.GetAttrState(WaterHeaterJinmao_AttrEnum.on_off.ToString()) == "on"; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex ) { |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"科技系统更新异常1:{ex.Message}"); |
| | | } |
| | | }); |
| | |
| | | Button btnBackClick = new Button(); |
| | | backView.AddChidren(btnBackClick); |
| | | |
| | | btnBackClick.MouseUpEventHandler = (sender, e) => { |
| | | btnBackClick.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | this.RemoveFromParent(); |
| | | }; |
| | | |
| | |
| | | { |
| | | tempValues = tempValues.Remove(tempValues.IndexOf('.'), tempValues.Length - tempValues.IndexOf('.')); |
| | | } |
| | | sensorDiyView_Temp = new SensorDiyView(sensorListView, curColor, tempValues, "°","", Language.StringByID(StringId.Temp)); |
| | | sensorDiyView_Temp = new SensorDiyView(sensorListView, curColor, tempValues, "°", "", Language.StringByID(StringId.Temp)); |
| | | } |
| | | if (humiObj != null) |
| | | { |
| | |
| | | { |
| | | humiValues = humiValues.Remove(humiValues.IndexOf('.'), humiValues.Length - humiValues.IndexOf('.')); |
| | | } |
| | | sensorDiyView_Humi = new SensorDiyView(sensorListView, curColor, humiValues , "%", "", Language.StringByID(StringId.Humidity)); |
| | | sensorDiyView_Humi = new SensorDiyView(sensorListView, curColor, humiValues, "%", "", Language.StringByID(StringId.Humidity)); |
| | | } |
| | | if (pm25Obj != null) |
| | | { |
| | |
| | | |
| | | var subTitleView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(54-11), |
| | | Height = Application.GetRealHeight(54 - 11), |
| | | }; |
| | | contentView.AddChidren(subTitleView); |
| | | |
| | |
| | | }; |
| | | subTitleView.AddChidren(btnCollection); |
| | | //收藏 |
| | | btnCollection.MouseUpEventHandler = (sender, e) => { |
| | | btnCollection.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | function.collect = !function.collect; |
| | | btnCollection.IsSelected = function.collect; |
| | | |
| | |
| | | #if DEBUG |
| | | System.Threading.Thread.Sleep(200); |
| | | #endif |
| | | |
| | | foreach (var sub in FunctionList.List.GetAcstSubList()) |
| | | var showList = FunctionList.List.GetAcstSubList(); |
| | | showList.AddRange(FunctionList.List.GetWaterHeaterJinmaoList()); |
| | | foreach (var sub in showList) |
| | | { |
| | | if (subViewList.ContainsKey(sub.sid)) |
| | | { |
| | |
| | | subFunctionListView = new HorizontalScrolViewLayout() |
| | | { |
| | | Height = Application.GetRealHeight(93), |
| | | ScrollEnabled = false, |
| | | }; |
| | | contentView.AddChidren(subFunctionListView); |
| | | subFunctionListView.AddChidren(new Button { Width = Application.GetRealWidth(9) }); |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | subFunctionCount++; |
| | | subFunctionCount++; |
| | | }); |
| | | |
| | | System.Threading.Thread.Sleep(10); |
| | | } |
| | | } |
| | | catch { } |
| | | finally{ |
| | | |
| | | finally |
| | | { |
| | | |
| | | } |
| | | }).Start(); |
| | | #endregion |
| | |
| | | #region 底部控制栏 |
| | | var bottomView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(667 - 56), |
| | | Height = Application.GetRealHeight(56), |
| | | Y = Application.GetRealHeight(667 - 66), |
| | | Height = Application.GetRealHeight(66+16), |
| | | BackgroundColor = CSS.CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealHeight(16), |
| | | BorderColor = 0x00FFFFFF, |
| | | BorderWidth = 0, |
| | | }; |
| | | this.AddChidren(bottomView); |
| | | |
| | |
| | | |
| | | var dialogView = new FrameLayout(); |
| | | dialog.AddChidren(dialogView); |
| | | dialogView.MouseUpEventHandler = (sender, e) => { |
| | | dialogView.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | var dialogContentView = new VerticalScrolViewLayout() { |
| | | var dialogContentView = new VerticalScrolViewLayout() |
| | | { |
| | | X = Application.GetRealWidth(34), |
| | | Y = Application.GetRealHeight(291), |
| | | Width = Application.GetRealWidth(148), |
| | |
| | | }; |
| | | dialogView.AddChidren(dialogContentView); |
| | | |
| | | var titleView = new FrameLayout() { |
| | | var titleView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(2), |
| | | Y = Application.GetRealHeight(3), |
| | | Width = Application.GetRealWidth(144), |
| | |
| | | |
| | | btnWorkSceneControl.MouseUpEventHandler = (sender2, e2) => |
| | | { |
| | | //if (function.trait_on_off.state == "off") |
| | | //{ |
| | | // return; |
| | | //} |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | var dialogView = new FrameLayout(); |
| | | dialog.AddChidren(dialogView); |
| | | dialogView.MouseUpEventHandler = (sender, e) => { |
| | | dialogView.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | |
| | | public string Tag; |
| | | public string unitString; |
| | | |
| | | public SensorDiyView(HorizontalScrolViewLayout view,uint color,string value,string unitStr, string unitStr2, string text,int setWidth = 60) |
| | | public SensorDiyView(HorizontalScrolViewLayout view, uint color, string value, string unitStr, string unitStr2, string text, int setWidth = 60) |
| | | { |
| | | unitString = unitStr; |
| | | if (string.IsNullOrEmpty(value)) |
| | |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = 0xFF949AA5, |
| | | TextSize = 12, |
| | | Text = text , |
| | | Text = text, |
| | | }; |
| | | contentView.AddChidren(btnText); |
| | | |
| | | if(!string.IsNullOrEmpty(unitStr2)) |
| | | if (!string.IsNullOrEmpty(unitStr2)) |
| | | { |
| | | btnText.Text += "(" + unitStr2 + ")"; |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | public void UpdateValue(string value,bool isInt) |
| | | public void UpdateValue(string value, bool isInt) |
| | | { |
| | | if (value.Contains(".") && isInt) |
| | | { |
| | |
| | | public Button btnSubPower; |
| | | public string Tag; |
| | | |
| | | public AcstSubControlView(Function sub, HorizontalScrolViewLayout subFunctionListView,string imageFolder) |
| | | public AcstSubControlView(Function sub, HorizontalScrolViewLayout subFunctionListView, string imageFolder) |
| | | { |
| | | Tag = sub.sid; |
| | | |
| | |
| | | Width = Application.GetRealWidth(35), |
| | | TextColor = 0xFF1b3035, |
| | | TextSize = 10, |
| | | Text = sub.GetAttrState(AcstSub_AttrEnum.room_temp.ToString()) + "°C", |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | subFunctionView.AddChidren(btnSubTempValues); |
| | | |
| | | Button btnSubHumidityIcon = new Button() |
| | | { |
| | | X = btnSubTempValues.Right + Application.GetRealWidth(5), |
| | | Y = Application.GetRealHeight(47 + 11), |
| | | Width = Application.GetMinRealAverage(11), |
| | | Height = Application.GetMinRealAverage(11), |
| | | UnSelectedImagePath = "FunctionIcon/CAC/HvacCacHumidityIcon.png", |
| | | }; |
| | | subFunctionView.AddChidren(btnSubHumidityIcon); |
| | | |
| | | btnSubHumidityValues = new TextButton() |
| | | { |
| | | X = btnSubHumidityIcon.Right, |
| | | Y = Application.GetRealHeight(45 + 11), |
| | | Height = Application.GetRealHeight(14), |
| | | Width = Application.GetRealWidth(35), |
| | | TextColor = 0xFF1b3053, |
| | | TextSize = 10, |
| | | Text = sub.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString()) + "%", |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | subFunctionView.AddChidren(btnSubHumidityValues); |
| | | |
| | | btnSubPower = new Button() |
| | | { |
| | |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | subFunctionView.AddChidren(btnSubPower); |
| | | btnSubPower.MouseUpEventHandler = (sender, e) => { |
| | | btnSubPower.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnSubPower.IsSelected = !btnSubPower.IsSelected; |
| | | string onoff = btnSubPower.IsSelected ? "on" : "off"; |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | |
| | | Control.Ins.SendWriteCommand(sub, d); |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => { |
| | | var page = new AcstSubPage(sub,imageFolder); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(()=> { |
| | | btnRoomInfo.Text = sub.name; |
| | | }); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | if (sub.spk == SPK.AcstSub) |
| | | { |
| | | btnSubTempValues.Text = sub.GetAttrState(AcstSub_AttrEnum.room_temp.ToString()) + "°C"; |
| | | Button btnSubHumidityIcon = new Button() |
| | | { |
| | | X = btnSubTempValues.Right + Application.GetRealWidth(5), |
| | | Y = Application.GetRealHeight(47 + 11), |
| | | Width = Application.GetMinRealAverage(11), |
| | | Height = Application.GetMinRealAverage(11), |
| | | UnSelectedImagePath = "FunctionIcon/CAC/HvacCacHumidityIcon.png", |
| | | }; |
| | | subFunctionView.AddChidren(btnSubHumidityIcon); |
| | | |
| | | btnRoomInfo.MouseUpEventHandler = eventHandler; |
| | | btnSubHumidityIcon.MouseUpEventHandler = eventHandler; |
| | | btnSubHumidityValues.MouseUpEventHandler = eventHandler; |
| | | btnSubTempIcon.MouseUpEventHandler = eventHandler; |
| | | btnSubTempValues.MouseUpEventHandler = eventHandler; |
| | | subFunctionView.MouseUpEventHandler = eventHandler; |
| | | btnSubHumidityValues = new TextButton() |
| | | { |
| | | X = btnSubHumidityIcon.Right, |
| | | Y = Application.GetRealHeight(45 + 11), |
| | | Height = Application.GetRealHeight(14), |
| | | Width = Application.GetRealWidth(35), |
| | | TextColor = 0xFF1b3053, |
| | | TextSize = 10, |
| | | Text = sub.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString()) + "%", |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | subFunctionView.AddChidren(btnSubHumidityValues); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | var page = new AcstSubPage(sub, imageFolder); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(() => |
| | | { |
| | | btnRoomInfo.Text = sub.name; |
| | | }); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | btnRoomInfo.MouseUpEventHandler = eventHandler; |
| | | btnSubTempIcon.MouseUpEventHandler = eventHandler; |
| | | btnSubTempValues.MouseUpEventHandler = eventHandler; |
| | | subFunctionView.MouseUpEventHandler = eventHandler; |
| | | btnSubHumidityIcon.MouseUpEventHandler = eventHandler; |
| | | btnSubHumidityValues.MouseUpEventHandler = eventHandler; |
| | | } |
| | | else if (sub.spk == SPK.WaterHeaterJinmao) |
| | | { |
| | | btnSubTempValues.Text = sub.GetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString()) + "°C"; |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | var page = new WaterHeaterJinmaoPage(sub); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(() => |
| | | { |
| | | btnRoomInfo.Text = sub.name; |
| | | }); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | btnRoomInfo.MouseUpEventHandler = eventHandler; |
| | | btnSubTempIcon.MouseUpEventHandler = eventHandler; |
| | | btnSubTempValues.MouseUpEventHandler = eventHandler; |
| | | subFunctionView.MouseUpEventHandler = eventHandler; |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | public Button btnText; |
| | | |
| | | public IconButton(string iconPath,string iconPath2,string text,uint color,bool isSelect) |
| | | public IconButton(string iconPath, string iconPath2, string text, uint color, bool isSelect) |
| | | { |
| | | view = this; |
| | | view.Width = Application.GetRealWidth(144); |
| | |
| | | }; |
| | | view.AddChidren(btnText); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | public void Click(Action action) |
| | | { |
| | | view.MouseUpEventHandler = (sender, e) => { |
| | | view.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | action(); |
| | | }; |
| | | btnText.MouseUpEventHandler = (sender, e) => { |
| | | btnText.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | action(); |
| | | }; |
| | | btnIcon.MouseUpEventHandler = (sender, e) => { |
| | | btnIcon.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | action(); |
| | | }; |
| | | } |