コード例 #1
0
 /// <summary>
 /// register a new person base on the input fields
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SubmitButton_Click(Object sender, RoutedEventArgs e)
 {
     //check the information inputed
     if (int.TryParse(IdInputField.Text, out var id) && !string.IsNullOrWhiteSpace(NameInputField.Text))
     {
         //try to register
         if (SheetsAPI.register(id, NameInputField.Text))
         {
             //login
             new Task(() => SheetsAPI.Login(id)).Start();
             NameInputField.Text = "";
             IdInputField.Text   = "";
             MessageBox.Show("User added successfully", "Login suc", MessageBoxButton.OK);
         }
     }
 }
コード例 #2
0
        private void MagReaderHelper_IdRead(Int64 id)
        {
            //check that this form is the active one
            if (!IsVisible)
            {
                return;
            }
            ResponseText.Content = "";
            //try to login
            var name = SheetsAPI.Login(id);

            //give the user feedback
            if (name.isErrored)
            {
                ResponseText.Content = "An Error Occured: " + name.ErrorMessage;
            }
            else
            {
                ResponseText.Content = "Welcome " + name.value;
            }
            ManualIdField.Text = "";
        }
コード例 #3
0
 public App()
 {
     //initialize the required componets
     MagReaderHelper.Init();
     SheetsAPI.InitSheets();
 }