private void LogInWithFacebookButton_Click(object sender, RoutedEventArgs e)
        {
            MainWindow.Instance.PanelLoading     = true;
            MainWindow.Instance.PanelMainMessage = "Enregistrement en cours";

            var dialog = new FacebookLoginWindow()
            {
                AppId = "719645478171450"
            };

            if (dialog.ShowDialog() == true)
            {
                // Get the access token from Facebook
                _user.FacebookToken   = dialog.AccessToken;
                _user.PlayerLoginType = User.LoginType.Facebook;

                // Login with facebook credentials
                var inputDialog = new ChatCanalInputWindow("Please enter your username:"******"Facebook User is invalid - frontend");
                        return;
                    }

                    try
                    {
                        var token = _userAccess.Register(username, "", userId);
                        _user.UserToken   = token;
                        _user.FacebookId  = userId;
                        _user.Name        = username;
                        _user.IsConnected = true;

                        // Go to main menu if login is completed
                        Load.LoadOnLogin();
                        MainWindow.Instance.PanelLoading = false;
                        _eventManager.Notice(new ChangeStateEvent()
                        {
                            NextState = Enums.States.MainMenu
                        });


                        FacebookAccess.PostOnWall(_user.FacebookToken, "Je me suis enregistrer a Princess Love balls (Projet 3 informatique)");
                    }
                    catch (Exception exception)
                    {
                        ShowError(exception.Message);
                    }
                }
            }
        }
Beispiel #2
0
        private void TabItem_MouseUp(object sender, MouseButtonEventArgs e)
        {
            var inputDialog = new ChatCanalInputWindow("Entrez le nom du nouveau canal:");

            if (inputDialog.ShowDialog() == true)
            {
                var result = inputDialog.Answer;
                // Send message to create new canal
                _chatAccess.CreateNewCanal(result, _user.UserToken);

                // Daily create canal
                DailyManager.AchieveDaily(EnumsModel.DailyType.CreateCanal);
            }
        }