Exemplo n.º 1
0
        private void CreateLoginPanel()
        {
            // Login
            var login = new Button()
            {
                Width           = _buttonWidth,
                Height          = _buttonHeight,
                Text            = "Login into service",
                Foreground      = _foregroundButton,
                BackgroundColor = _backgroundColor,
            };

            login.Click += async(s, e) =>
            {
                var properties = new Dictionary <string, string>();
                _socialService.Initialize(properties);
                var loggedIn = await _socialService.Login();

                if (!loggedIn)
                {
                    await WaveServices.Platform.ShowMessageBoxAsync("Error", "Not logged in");
                }
            };

            // Logout
            var logout = new Button()
            {
                Width           = _buttonWidth,
                Height          = _buttonHeight,
                Text            = "Logout",
                Foreground      = _foregroundButton,
                BackgroundColor = _backgroundColor,
                Margin          = new Thickness(_spaceControl, 0, 0, 0)
            };

            logout.Click += async(s, e) => { await _socialService.Logout(); };

            var sp1 = new StackPanel
            {
                Orientation = Orientation.Horizontal,
                Margin      = new Thickness(_leftMargin, _topMargin, 0, 0),
            };

            sp1.Add(login);
            sp1.Add(logout);

            EntityManager.Add(sp1);
        }