public int SetTestPointState(TestPoint testPoint, TestPointState state) { int retCode = CI2cControl.SendI2cCommand(testPoint.ToString() + "_" + state); CheckReturn(retCode); return(retCode); }
Button MenuButton(TestPoint test) { var button = new Button { Text = test.ToString(), AutomationId = test.AutomationId }; button.Clicked += (sender, args) => PushAsync(CreateTestPage(test)); return(button); }
ContentPage CreateTestPage(TestPoint test) { Color backgroundColor = test.BackgroundColor ? _transparentColor : _nontransparentColor; double opacity = test.Opacity ? _transparentOpacity : _nonTransparentOpacity; bool inputTransparent = test.InputTransparent; var grid = new Grid { AutomationId = "testgrid", HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill }; grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Star }); var instructions = new Label { HorizontalOptions = LayoutOptions.Fill, HorizontalTextAlignment = TextAlignment.Center, Text = $"Tap the 'Add Overlay' button, then tap the button labeled 'Button'." + (test.ShouldBeTransparent ? $" If the label below's text changes to {Success} the test has passed." : " If the label below's text remains unchanged, the test has passed.") }; grid.Children.Add(instructions); var results = new Label { HorizontalOptions = LayoutOptions.Fill, HorizontalTextAlignment = TextAlignment.Center, Text = Running }; grid.Children.Add(results); Grid.SetRow(results, 1); var button = new Button { Text = DefaultButtonText, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center }; button.Clicked += (sender, args) => { results.Text = test.ShouldBeTransparent ? Success : Failure; }; var layout = new StackLayout { AutomationId = Overlay, HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, BackgroundColor = backgroundColor, InputTransparent = inputTransparent, Opacity = opacity }; // Bump up the elevation to cover FastRenderer buttons layout.On <Android>().SetElevation(10f); grid.Children.Add(button); Grid.SetRow(button, 3); var addOverlayButton = new Button() { Text = AddOverlay }; addOverlayButton.Clicked += (sender, args) => { grid.Children.Add(layout); Grid.SetRow(layout, 3); }; grid.Children.Add(addOverlayButton); Grid.SetRow(addOverlayButton, 2); return(new ContentPage { Content = grid, Title = test.ToString() }); }