예제 #1
0
        public WelcomePage(GitHubAuthenticationService gitHubAuthenticationService,
                           IAnalyticsService analyticsService,
                           WelcomeViewModel welcomeViewModel,
                           IMainThread mainThread,
                           IAppInfo appInfo)
            : base(welcomeViewModel, analyticsService, mainThread, shouldUseSafeArea: true)
        {
            _appInfo = appInfo;

            RemoveDynamicResource(BackgroundColorProperty);
            On <iOS>().SetModalPresentationStyle(UIModalPresentationStyle.OverFullScreen);

            var pageBackgroundColor = Color.FromHex(BaseTheme.LightTealColorHex);

            BackgroundColor = pageBackgroundColor;

            gitHubAuthenticationService.DemoUserActivated         += HandleDemoUserActivated;
            gitHubAuthenticationService.AuthorizeSessionCompleted += HandleAuthorizeSessionCompleted;

            var browserLaunchOptions = new Xamarin.Essentials.BrowserLaunchOptions
            {
                PreferredToolbarColor = pageBackgroundColor.MultiplyAlpha(0.75),
                PreferredControlColor = Color.White,
                Flags = Xamarin.Essentials.BrowserLaunchFlags.PresentAsFormSheet
            };

            Content = new Grid
            {
                RowSpacing = 24,

                RowDefinitions = Rows.Define(
                    (Row.WelcomeLabel, StarGridLength(2)),
                    (Row.Image, StarGridLength(4)),
                    (Row.GitHubButton, StarGridLength(2)),
                    (Row.DemoButton, StarGridLength(1)),
                    (Row.VersionLabel, StarGridLength(1))),

                Children =
                {
                    new WelcomeLabel()
                    .Row(Row.WelcomeLabel),
                    new Image {
                        Source = "WelcomeImage"
                    }.Center()
                    .Row(Row.Image),
                    new ConnectToGitHubButton(_connectToGitHubCancellationTokenSource.Token, browserLaunchOptions)
                    .Row(Row.GitHubButton),
                    new DemoLabel()
                    .Row(Row.DemoButton),
                    new ConnectToGitHubActivityIndicator()
                    .Row(Row.DemoButton),
                    new VersionNumberLabel(_appInfo)
                    .Row(Row.VersionLabel)
                }
            };
        }
예제 #2
0
 public ConnectToGitHubButton(CancellationToken cancellationToken, Xamarin.Essentials.BrowserLaunchOptions browserLaunchOptions) : base(WelcomePageAutomationIds.ConnectToGitHubButton, cancellationToken, browserLaunchOptions)
 {
     HorizontalOptions = LayoutOptions.Center;
     VerticalOptions   = LayoutOptions.End;
 }