コード例 #1
0
        private void loginButton_Click(object sender, RoutedEventArgs e)
        {
            string email    = emailText.Text;
            string password = passwordBox.Password;

            if (rememberCheckBox.IsChecked.Value)
            {
                //store the creds locally and then auto fill when this page is loaded
                try
                {
                    settings["email"]    = email;
                    settings["password"] = password;
                    settings["checkbox"] = rememberCheckBox.IsChecked.Value;
                }
                catch (KeyNotFoundException)
                {
                    settings.Add("email", email);
                    settings.Add("password", password);
                    settings.Add("checkbox", rememberCheckBox.IsChecked.Value);
                }
            }

            CrackApi.login(email, password, doneLogin);

            loginProgress.Visibility = System.Windows.Visibility.Visible;
        }
コード例 #2
0
        void gameClicked(object sender, RoutedEventArgs e)
        {
            Game g = (Game)sender;

            game_id = g.id;
            CrackApi.games(user_id, session_id, game_id, gameCallback);
        }
コード例 #3
0
        void loginCallback(string result)
        {
            JObject jo = JObject.Parse(result);

            //Debug.WriteLine(jo.ToString());

            session_id = jo["session"].Value <string>("session");
            user_id    = jo.Value <string>("id");
            //got the session id and user id
            //now we need to load the active games
            CrackApi.dashboard(user_id, session_id, dashboardCallback);
        }
コード例 #4
0
        void gameCallback(string result)
        {
            JObject jo = JObject.Parse(result);

            //Debug.WriteLine(jo.ToString());
            if (jo["game_status"].Value <string>() == "ENDED")
            {
                //we win go home
                InitializeComponent();
                //reload active games
                CrackApi.dashboard(user_id, session_id, dashboardCallback);
            }
            else
            {
                Question q = new Question(jo, questionDone);
                this.Content = q;
            }
        }
コード例 #5
0
 void gotAnswer(string result)
 {
     //get next question
     CrackApi.games(user_id, session_id, game_id, gameCallback);
 }
コード例 #6
0
 void questionDone(JToken answer)
 {
     //send answer to server
     CrackApi.answer(user_id, session_id, game_id, answer, gotAnswer);
 }