private void NextTestcase() { _pressButton = NavigationButton.Next; if (!ManualTest.IsConfirmed()) { _tsettings.TCResult = StrResult.NOTRUN; ManualTest.Confirm(); } else { Next(); } }
private void PreviousTestcase() { _pressButton = NavigationButton.Previous; if (!ManualTest.IsConfirmed()) { _tsettings.TCResult = StrResult.NOTRUN; ManualTest.Confirm(); } else { Previous(); } }
private void MakeTestPage() { _mainLayout = new StackLayout() { Orientation = StackOrientation.Vertical, IsVisible = true, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Spacing = 10, Padding = new Thickness(10), }; _descriptionTitle = new Label() { Text = "DESCRIPTION:", HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Start, HeightRequest = 50, TextColor = Color.White }; // layout StackLayout functionLayout = new StackLayout() { Orientation = StackOrientation.Horizontal, IsVisible = true, HorizontalOptions = LayoutOptions.FillAndExpand, Spacing = 10, VerticalOptions = LayoutOptions.End, }; _mainBtn = new Button() { HorizontalOptions = LayoutOptions.Start, Text = "Home", HeightRequest = 80, }; _mainBtn.Clicked += (sender, e) => { _pressButton = NavigationButton.Home; if (!ManualTest.IsConfirmed()) { _tsettings.TCResult = StrResult.NOTRUN; ManualTest.Confirm(); } else { _navigationPage.PopAsync(); } }; _prevBtn = new Button() { HorizontalOptions = LayoutOptions.Start, Text = "<<", HeightRequest = 80, }; _prevBtn.Clicked += (sender, e) => { PreviousTestcase(); }; _nextBtn = new Button() { Text = ">>", HorizontalOptions = LayoutOptions.Start, HeightRequest = 80, }; _nextBtn.Clicked += (sender, e) => { NextTestcase(); }; _tcResultText = new Label() { HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, HeightRequest = 80, }; functionLayout.Children.Add(_mainBtn); functionLayout.Children.Add(_tcResultText); functionLayout.Children.Add(_prevBtn); functionLayout.Children.Add(_nextBtn); // Show description ShowDescription(); var navigationLayout = new StackLayout() { Orientation = StackOrientation.Horizontal, IsVisible = true, HorizontalOptions = LayoutOptions.FillAndExpand, Spacing = 10, VerticalOptions = LayoutOptions.End, }; _passBtn = new Button() { HorizontalOptions = LayoutOptions.Start, Text = "Pass", HeightRequest = 80, IsEnabled = false, }; _passBtn.Clicked += (sender, e) => { if (!ManualTest.IsConfirmed()) { _tsettings.TCResult = StrResult.PASS; ManualTest.Confirm(); } }; _failBtn = new Button() { HorizontalOptions = LayoutOptions.Start, Text = "Fail", HeightRequest = 80, IsEnabled = false, }; _failBtn.Clicked += (sender, e) => { if (!ManualTest.IsConfirmed()) { _tsettings.TCResult = StrResult.FAIL; ManualTest.Confirm(); } }; _blockBtn = new Button() { HorizontalOptions = LayoutOptions.Start, Text = "Block", HeightRequest = 80, IsEnabled = false, }; _blockBtn.Clicked += (sender, e) => { if (!ManualTest.IsConfirmed()) { _tsettings.TCResult = StrResult.BLOCK; ManualTest.Confirm(); } }; _runBtn = new Button() { HorizontalOptions = LayoutOptions.Start, Text = "Run", HeightRequest = 80, }; _runBtn.Clicked += (sender, e) => { LockUIButton(); _pressButton = NavigationButton.NA; _tsettings.Testcase_ID = _tcIDList[_tcIndex]; _tsettings.TCResult = ""; _tunitRunner.Execute(); }; navigationLayout.Children.Add(_passBtn); navigationLayout.Children.Add(_failBtn); navigationLayout.Children.Add(_blockBtn); navigationLayout.Children.Add(_runBtn); _tcUILayout = new StackLayout() { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 200 }; _mainLayout.Children.Add(_summaryLabel); _mainLayout.Children.Add(_descriptionTitle); _mainLayout.Children.Add(_tcDescriptions); _mainLayout.Children.Add(_tcUILayout); _mainLayout.Children.Add(navigationLayout); _mainLayout.Children.Add(functionLayout); _tcContentPage = new ContentPage() { Content = _mainLayout }; NavigationPage.SetHasNavigationBar(_tcContentPage, false); }