Ejemplo n.º 1
0
        private void Migrate(string Username, string Password)
        {
            WebInterface.VerifyWebsite(this);
            var Result = WebInterface.Migrate(Username, Password);

            switch (Result.Result)
            {
            case WebInterface.MigrationResult.OK:
            {
                DataInterface.Save("token", Result.Token);
                Dispatcher.Invoke(() =>
                    {
                        MessageBox.Show(
                            "You have successfully migrated your Synapse account!\n\nYou can now restart Synapse X to use the software.",
                            "Synapse X", MessageBoxButton.OK, MessageBoxImage.Information);
                    });
                Environment.Exit(0);
                return;
            }

            case WebInterface.MigrationResult.ALREADY_EXISTING_ACCOUNT:
            {
                Dispatcher.Invoke(() =>
                    {
                        MessageBox.Show(
                            "You already have a Synapse account! Please log into the account you have already created.",
                            "Synapse X", MessageBoxButton.OK, MessageBoxImage.Error);
                        LoginButton.Content = "Login";
                        LoggingIn           = false;
                    });
                return;
            }

            case WebInterface.MigrationResult.INVALID_USER_PASS:
            {
                Dispatcher.Invoke(() =>
                    {
                        MessageBox.Show(
                            "Invalid username/email or password.",
                            "Synapse X", MessageBoxButton.OK, MessageBoxImage.Error);
                        LoginButton.Content = "Login";
                        LoggingIn           = false;
                    });
                return;
            }

            case WebInterface.MigrationResult.INVALID_REQUEST:
            case WebInterface.MigrationResult.UNKNOWN:
            {
                Dispatcher.Invoke(() =>
                    {
                        MessageBox.Show(
                            "Failed to migrate Synapse account. Please contact 3dsboy08 on Discord.",
                            "Synapse X", MessageBoxButton.OK, MessageBoxImage.Error);
                        LoginButton.Content = "Login";
                        LoggingIn           = false;
                    });
                return;
            }
            }
        }