예제 #1
0
파일: MyScene.cs 프로젝트: sgrizan/Samples
        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);
        }