Esempio n. 1
0
        async void GetBenchmarkResults(int tryCount = 0)
        {
            bool success = false;

            try
            {
                ViewModel.BenchmarkResults = await PerformanceDataManager.GetScenarioResults(_DeviceIdentifier);

                success = true;
            }
            catch (Exception exc)
            {
                if (tryCount < 3)
                {
                    GetBenchmarkResults(++tryCount);
                }
                else
                {
                    nextButton.Text = exc.ToString();
                }
            }

            if (success)
            {
                nextButton.IsEnabled = true;
                nextButton.Text      = Next;
            }
        }
Esempio n. 2
0
        void HandleRenderComplete(PerformanceTracker obj)
        {
            var result = DisplayResults();

            PerformanceDataManager.PostScenarioResults(ViewModel.Scenario,
                                                       result,
                                                       ViewModel.TestRunReferenceId,
                                                       _DeviceIdentifier,
                                                       _DevicePlatform,
                                                       _DeviceVersionNumber,
                                                       _DeviceIdiom,
                                                       _BuildInfo,
                                                       ViewModel.ActualRenderTime,
                                                       _PerformanceProvider.Statistics);
        }
Esempio n. 3
0
        protected override void Init()
        {
            _BuildInfo = GetBuildNumber();

            _DeviceIdentifier = CrossDeviceInfo.Current.Id;
            _DeviceIdiom      = CrossDeviceInfo.Current.Idiom.ToString();
            _DeviceModel      = CrossDeviceInfo.Current.Model;
#if __ANDROID__ && TEST_EXPERIMENTAL_RENDERERS
            _DevicePlatform = "Android Fast Renderers";
#else
            _DevicePlatform = CrossDeviceInfo.Current.Platform.ToString();
#endif
            _DeviceVersionNumber = CrossDeviceInfo.Current.VersionNumber.ToString();

            MessagingCenter.Subscribe <PerformanceTracker>(this, PerformanceTracker.RenderCompleteMessage, HandleRenderComplete);

            BindingContext = new PerformanceViewModel(_PerformanceProvider);
            Performance.SetProvider(_PerformanceProvider);

            _TestCases.AddRange(InflatePerformanceScenarios());

            var nextButton = new Button {
                Text = Pending, IsEnabled = false, AutomationId = NextButtonId
            };
            nextButton.Clicked += NextButton_Clicked;

            ViewModel.TestRunReferenceId = Guid.NewGuid();

            var testRunRef = new Label
            {
                AutomationId            = TestRunRefId,
                Text                    = ViewModel.TestRunReferenceId.ToString(),
                FontSize                = 6,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                BackgroundColor         = Color.Accent,
                TextColor               = Color.White
            };

            Content = new StackLayout {
                Children = { testRunRef, nextButton, _PerformanceTracker }
            };

            ViewModel.BenchmarkResults = Task.Run(() => PerformanceDataManager.GetScenarioResults(_DeviceIdentifier)).GetAwaiter().GetResult();

            nextButton.IsEnabled = true;
            nextButton.Text      = Next;
        }