示例#1
0
    void CreateUser()
    {
        ParseUser.LogOut();
        var user = new ParseUser()
        {
            Username = usuario,
            Password = pwd,
            Email    = email
        };

        // other fields can be set just like with ParseObject
        user["pontuacao"] = (int)scoreInicial;

        user.SignUpAsync().ContinueWith(t => {
            if (t.IsFaulted || t.IsCanceled)
            {
                foreach (var e in t.Exception.InnerExceptions)
                {
                    ParseException parseException = (ParseException)e;
                    Debug.Log("Error message " + parseException.Message);
                    Debug.Log("Error code: " + parseException.Code);
                }
            }
            else
            {
                //SignUpAsync(); //DONE
                Debug.Log("Usuário criado com sucesso");
            }
        });

        ParseUser.LogOut();
    }
    // Use this for initialization
    void Start()
    {
        ParseUser user;

        //   ParseUser.LogOut();
        ParseUser.LogInAsync(nome, pwd).ContinueWith(t =>
        {
            if (t.IsFaulted || t.IsCanceled)
            {
                foreach (var e in t.Exception.InnerExceptions)
                {
                    ParseException parseException = (ParseException)e;
                    Debug.Log("Error message " + parseException.Message);
                    Debug.Log("Error code: " + parseException.Code);
                }
            }
            else
            {
                // Login was successful

                user = t.Result;
                Debug.Log(user.Username);
                user.DeleteAsync();
                ParseUser.LogOut();
            }
        });
    }
示例#3
0
 public static void Logout()
 {
     if (ParseUser.CurrentUser != null)
     {
         ParseUser.LogOut();
     }
 }
        private void seleccionMenu(object sender, SelectionChangedEventArgs e)
        {
            switch (menu.SelectedIndex)
            {
            case 0:
                Contenido.Navigate(typeof(MascotasPage), this);
                paginaPrincipal.BottomAppBar = null;
                break;

            case 1:
                Contenido.Navigate(typeof(MisMascotasPage), this);
                CommandBar   commandBar   = new CommandBar();
                AppBarButton appBarButton = new AppBarButton();
                appBarButton.Icon  = new SymbolIcon(Symbol.Add);
                appBarButton.Label = "Agregar";
                commandBar.PrimaryCommands.Add(appBarButton);
                paginaPrincipal.BottomAppBar = commandBar;
                break;

            case 4:
                ParseUser.LogOut();
                rootFrame.Navigate(typeof(MainPage));
                break;
            }
        }
示例#5
0
 public void ParseFBLogout()
 {
     Events.ResetApp();
     FB.LogOut();
     // FB.Logout();
     ParseUser.LogOut();
 }
 private void OnSignOutButtonClick(object sender, RoutedEventArgs e)
 {
     ParseUser.LogOut();
     if (this.SignOut != null)
     {
         this.SignOut(this, null);
     }
 }
示例#7
0
 public void LogoutUser()
 {
     try {
         ParseUser.LogOut();
     } catch (ParseException e) {
         Console.WriteLine(e.Message);
     }
 }
示例#8
0
        private void logout(object sender, RoutedEventArgs e)
        {
            ParseUser.LogOut();
            var   currentUser = ParseUser.CurrentUser; // this will now be null
            Frame rootFrame   = Window.Current.Content as Frame;

            rootFrame.Navigate(typeof(LoginPage));
        }
示例#9
0
 public void Button_SignOut_Clicked()
 {
     try{
         ParseUser.LogOut();
     }
     catch (UnityException e) {
         Debug.Log("Error logging out: " + e);
     }
 }
示例#10
0
    void OnClick()
    {
        ParseUser.LogOut();
        var currentUser = ParseUser.CurrentUser;

        SettingPage.SetActive(false);
        Profile.SetActive(false);
        LoginPage.SetActive(true);
    }
示例#11
0
        private static void HandleInvalidSessionToken()
        {
            ParseUser.LogOut();

            Device.BeginInvokeOnMainThread(() =>
            {
                var pageFactory = AutofacContainer.Container.Resolve <IPageFactory>();
                Xamarin.Forms.Application.Current.MainPage = new NavigationPage(pageFactory.CreatePage <LoadingPage, LoadingViewModel>());
            });
        }
示例#12
0
    public void LogOut()
    {
        ParseUser.LogOut();
        ParseUser currentUser = ParseUser.CurrentUser;         // this will now be null

        if (currentUser != null)
        {
            throw new UnityException("LogOut failed. Current user not null.");
        }
    }
示例#13
0
 public override void WillTerminate(UIApplication application)
 {
     try
     {
         ParseUser.LogOut();
     }
     catch (ParseException e)
     {
         Debug.WriteLine(e.StackTrace);
     }
 }
示例#14
0
 public static void InitializeParse(string applicationId, string dotNetKey)
 {
     ParseClient.Initialize(applicationId, dotNetKey);
     if (ParseUser.CurrentUser != null)
     {
         try {
             ParseUser.LogOut();
         } catch (Exception) {
         }
     }
 }
 public void ReturnToLoginScreen()
 {
     if (ParseUser.CurrentUser != null)
     {
         Debug.Log("Trying to log out of current user...");
         ParseUser.LogOut();
     }
     else
     {
         Debug.LogError("Error: trying to log out of a user that isn't even logged in.");
     }
     Application.LoadLevel("scnMainMenu");
 }
示例#16
0
 static void InitializeParse(string applicationId, string dotNetKey)
 {
     ParseClient.Initialize(applicationId, dotNetKey);
     Logging.GetLogging().Info("InitializeParse: done");
     if (ParseUser.CurrentUser != null)
     {
         Logging.GetLogging().Info("InitializeParse: user -> " + ParseUser.CurrentUser.Username);
         try {
             ParseUser.LogOut();
         } catch (Exception) {
             Logging.GetLogging().Info("InitializeParse: something fishy");
         }
     }
 }
示例#17
0
 void Update()
 {
     if (testNetwork.isConnect && PlayerPrefs.GetString("account") == "")
     {
         if (!isCallCreateAccount)
         {
             isCallCreateAccount = true;
             if (ParseUser.CurrentUser != null)
             {
                 ParseUser.LogOut();
             }
             myParse.CreateAccount();
         }
     }
 }
示例#18
0
        private void button_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var button = (sender as Grid).Name;

            if (button == "acceptButton")
            {
                ParseUser.LogOut();
                Application.Current.Exit();
            }

            else if (button == "exitButtonForLogOutPanel")
            {
                backgroundPanel.Visibility = Visibility.Collapsed;
                logOutPanel.Visibility     = Visibility.Collapsed;
            }
        }
示例#19
0
 void OnGUI()
 {
     if (GUI.Button(new Rect(width / 2 - 100, height / 2 - 60, 200, 50), "Jogar"))
     {
         Application.LoadLevel("Game");
     }
     if (GUI.Button(new Rect(width / 2 - 100, height / 2, 200, 50), "Recordes"))
     {
         Application.LoadLevel("GameOver");
     }
     if (GUI.Button(new Rect(width / 2 - 100, height / 2 + 60, 200, 50), "Deslogar"))
     {
         ParseUser.LogOut();
         Application.LoadLevel("Login");
     }
 }
示例#20
0
        public AlertDialog UserSyncDialog(Context context)
        {
            ContextThemeWrapper   wrapper = new ContextThemeWrapper(context, GetDialogTheme());
            StorehouseSuperDialog dialog  = new StorehouseSuperDialog(wrapper);

            LayoutInflater inflater = (LayoutInflater)context.GetSystemService(Context.LayoutInflaterService);
            View           layout   = inflater.Inflate(Resource.Layout.DialogUserSyncView, null);
            TextView       username = layout.FindViewById <TextView>(Resource.Id.parseUserName);
            TextView       password = layout.FindViewById <TextView>(Resource.Id.parsePassword);

            dialog.SetTitleTextColor(Color.White);
            dialog.SetTitleBackgroundColor(Android.Resource.Color.Transparent);
            dialog.SetTitle("User Sync");
            dialog.SetMessageTextSize(22);

            if (ParseUser.CurrentUser != null)
            {
                dialog.SetView(null);
                dialog.SetNeutralButton("Log Out", (o, e) =>
                {
                    ParseUser.LogOut();
                });
            }
            else
            {
                dialog.SetView(layout);
            }

            dialog.SetPositiveButton("Sync Up", (o, e) =>
            {
                ParseUserSync(username.Text, password.Text, "up");
            });

            dialog.SetNegativeButton("Sync Down", (o, e) =>
            {
                ParseUserSync(username.Text, password.Text, "down");
            });

            return(dialog.Show());
        }
示例#21
0
 private void FBAPICallback(FBResult result)
 {
     if (!String.IsNullOrEmpty(result.Error))
     {
         Debug.Log("FBAPICallback: Error getting user info: + " + result.Error);
         ParseUser.LogOut();
     }
     else
     {
         //got user profile info, extract name
         var    resultObject = Json.Deserialize(result.Text) as Dictionary <string, object>;
         string name;
         object objectForKey;
         if (resultObject.TryGetValue("name", out objectForKey))
         {
             name = (string)objectForKey;
         }
         else
         {
             name = "anonymous";
         }
         StartCoroutine("saveUserProfile", name);
     }
 }
示例#22
0
 public override void OnEnter()
 {
     ParseUser.LogOut();
 }
示例#23
0
 void SignOut_QuestionPanel_Yes()
 {
     ParseUser.LogOut();
     Application.LoadLevel("Login");
 }
示例#24
0
        async void OnWizardComplete()
        {
            ParseUser.LogOut(); //clear any sessions
            try
            {
                string jsonObj             = null;
                string selectedAccountType = null;
                bool   successFull         = false;
                //sequential checking
                if (DealerProfile != null && DealerProfile.userProfile != null &&
                    DealerProfile.userProfile.userType != null)
                {
                    selectedAccountType = DealerProfile.userProfile.userType;
                }
                else if (UserProfile != null && UserProfile.userType != null)
                {
                    selectedAccountType = UserProfile.userType;
                }

                if (!_alreadyRun)
                {
                    _alreadyRun = true;
                    //now we can post to parse and tell the user that the sign up is successfull
                    if (selectedAccountType == "Dealer")
                    {
                        if (DealerProfile != null)
                        {
                            var licensePath = DealerProfile.dealerLicense;
                            //save the dealer
                            successFull = await _dataManager.signUpDealer(DealerProfile, licensePath);

                            jsonObj = Newtonsoft.Json.JsonConvert.SerializeObject(DealerProfile);
                        }
                    }
                    else if (selectedAccountType == "Private Party")
                    {
                        //save the regular user
                        successFull = await _dataManager.signUpPrivateParty(UserProfile);

                        jsonObj = Newtonsoft.Json.JsonConvert.SerializeObject(UserProfile);
                    }

                    if (successFull)
                    {
                        _message = "Signup Successfull";
                    }
                }

                Android.Util.Log.Info("CustomerWizard", jsonObj);
                Android.Widget.Toast.MakeText(Application.Context, _message, Android.Widget.ToastLength.Long)
                .Show();
                Activity.Finish();
            }
            catch (ParseException ex)
            {
                var message = "Error saving to parse " + ex.Message + ex.StackTrace;
                Console.WriteLine(message);
                MetricsManager.TrackEvent(message);
            }
            catch (Exception ex)
            {
                var message = "Error saving to profile data " + ex.Message + ex.StackTrace;
                Console.WriteLine(message);
                MetricsManager.TrackEvent(message);
            }
        }
示例#25
0
 private void OnLogOutButtonClick(object sender, RoutedEventArgs e)
 {
     ParseUser.LogOut();
     (Window.Current.Content as Frame).Navigate(typeof(LogInPage));
 }
示例#26
0
 public void Logout()
 {
     ParseUser.LogOut();
     var currentUser = ParseUser.CurrentUser; //This is null
 }
示例#27
0
 private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
 {
     ParseUser.LogOut();
     VisualStateManager.GoToState(this, "LoginState", true);
 }
示例#28
0
 void LogoutButton_Click(dfControl control, dfMouseEventArgs mouseEvent)
 {
     LogoutScript.Logout();
     ParseUser.LogOut();
     Application.LoadLevel("DFGUI Login");
 }
示例#29
0
 public void LogOutAsync()
 {
     ParseUser.LogOut();
 }
示例#30
0
 public async void Init()
 {
     TestingHelpers.InitParse();
     ParseUser.LogOut();
 }