| | |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | var bodyView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(463), |
| | | Height = Application.GetRealHeight(375), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | div.AddChidren(bodyView); |
| | | |
| | | var contentView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(16), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(296), |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | var row = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(60), |
| | | }; |
| | | contentView.AddChidren(row); |
| | | |
| | | int index = 0; |
| | | foreach (var attr in device.attributes) |
| | | { |
| | | if (attr.key == FunctionAttributeKey.Mode |
| | | || attr.key == FunctionAttributeKey.OnOff |
| | | || attr.key == FunctionAttributeKey.SetTemp |
| | | || attr.key == FunctionAttributeKey.SetTempStep |
| | | || attr.key == FunctionAttributeKey.FanSpeed |
| | | || attr.key == FunctionAttributeKey.FanManual |
| | | || attr.key == FunctionAttributeKey.FanAuto |
| | | ) |
| | | { |
| | | continue; |
| | | } |
| | | if (index != 0 && index % 3 == 0) |
| | | { |
| | | row = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(200), |
| | | Height = Application.GetRealHeight(56), |
| | | }; |
| | | contentView.AddChidren(row); |
| | | } |
| | | |
| | | var btn = new Button() |
| | | { |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(88), |
| | | Height = Application.GetRealHeight(40), |
| | | Radius = (uint)Application.GetRealHeight(18), |
| | | BorderColor = CSS_Color.PromptingColor1, |
| | | BorderWidth = (uint)Application.GetRealWidth(2), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainBackgroundColor, |
| | | SelectedBackgroundColor = CSS_Color.MainColor, |
| | | }; |
| | | if (attr.value.Count > 0) |
| | | { |
| | | btn.Text = attr.value[0]; |
| | | } |
| | | if (index % 3 == 1) |
| | | { |
| | | btn.Gravity = Gravity.Center; |
| | | } |
| | | else if (index % 3 == 2) |
| | | { |
| | | btn.X = Application.GetRealWidth(208); |
| | | } |
| | | row.AddChidren(btn); |
| | | |
| | | btn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Key, attr.key); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btn.IsSelected = false; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | |
| | | |
| | | index++; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |