コード例 #1
0
ファイル: App.cs プロジェクト: MAtchane/speed-tester
        private void UpdateTestsHistory()
        {
            string newTest = string.Format("{0};{1};{2};{3};{4}", DateTime.Now.ToString("MM-dd-yy"), printableDownloadSpeed.speed, printableDownloadSpeed.label,
                                           printableUploadSpeed.speed, printableUploadSpeed.label);
            var currentNumberOfTests = HistoryTab.GetNumberOfHistoryEntries();

            currentNumberOfTests++;
            Application.Current.Properties["currentNumberOfTests"] = currentNumberOfTests;
            var newTestKey = "test#" + currentNumberOfTests;

            Application.Current.Properties[newTestKey] = newTest;
        }
コード例 #2
0
ファイル: App.cs プロジェクト: MAtchane/speed-tester
        public App()
        {
            //Initializing the tabs
            speedTestTab = new SpeedTestTab();
            historyTab   = new HistoryTab();
            aboutTab     = new AboutTab();

            //setting references to the UI views
            testBtn      = speedTestTab.FindByName <Button>("TestBtn");
            testBtnLabel = speedTestTab.FindByName <ActivityIndicator>("TestBtnLabel");

            resultsBoard = speedTestTab.FindByName <Grid>("ResultsBoard");
            indicators   = speedTestTab.FindByName <StackLayout>("Indicators");
            indicator    = speedTestTab.FindByName <Label>("Indicator");
            inAppLogo    = speedTestTab.FindByName <Image>("InAppLogo");

            downloadSpeedIcon  = speedTestTab.FindByName <Image>("DownloadSpeedIcon");
            downloadSpeedValue = speedTestTab.FindByName <Label>("DownloadSpeedValue");
            downloadSpeedLabel = speedTestTab.FindByName <Label>("DownloadSpeedLabel");

            uploadSpeedIcon  = speedTestTab.FindByName <Image>("UploadSpeedIcon");
            uploadSpeedValue = speedTestTab.FindByName <Label>("UploadSpeedValue");
            uploadSpeedLabel = speedTestTab.FindByName <Label>("UploadSpeedLabel");

            historyBtn = speedTestTab.FindByName <TapGestureRecognizer>("TapHistory");
            aboutBtn   = speedTestTab.FindByName <TapGestureRecognizer>("TapAbout");
            serverInfo = speedTestTab.FindByName <Label>("ServerInfo");

            //setting the click handelers
            testBtn.Clicked   += OnTestBtnClicked;
            historyBtn.Tapped += OnHistoryBtnClicked;
            aboutBtn.Tapped   += OnAboutBtnClicked;

            //State zero
            myTestState = TestState.Start;

            //Using a NavigationPage to handle multiple tabs(pages)
            MainPage = new NavigationPage(speedTestTab)
            {
                BarBackgroundColor = Color.FromHex("#141526"),
                BarTextColor       = Color.FromHex("#FFFFFF")
            };
        }