예제 #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Title = WebInterface.RandomString(WebInterface.Rnd.Next(10, 32));

            var Resp = WebInterface.GetUsername();

            if (Resp.Result == WebInterface.GetUsernameResult.OK)
            {
                UsernameBox.Text = Resp.Username;
            }
            else
            {
                switch (Resp.Result)
                {
                case WebInterface.GetUsernameResult.INVALID_HWID:
                {
                    MessageBox.Show(
                        "Synapse tried to get your username from the database, but failed. (IH) This should not happen, contact 3dsboy08 on Discord.",
                        "Synapse Xen", MessageBoxButton.OK, MessageBoxImage.Error);
                    Environment.Exit(0);
                    return;
                }

                case WebInterface.GetUsernameResult.INVALID_REQUEST:
                {
                    MessageBox.Show(
                        "Synapse tried to get your username from the database, but failed. (IR) This should not happen, contact 3dsboy08 on Discord.",
                        "Synapse Xen", MessageBoxButton.OK, MessageBoxImage.Error);
                    Environment.Exit(0);
                    return;
                }

                default:
                {
                    MessageBox.Show(
                        "Synapse tried to get your username from the database, but failed. (" + Convert.ToInt32(Resp.Result) + ") This should not happen, contact 3dsboy08 on Discord.",
                        "Synapse Xen", MessageBoxButton.OK, MessageBoxImage.Error);
                    Environment.Exit(0);
                    return;
                }
                }
            }
        }