private void button1_Click(object sender, RoutedEventArgs e) { Boolean check = false; String index = textbox2.Text; if ((index[1] == '/') || (index[2] == '/')) { check = true; } if ((textbox2.Text != null) && (check == true)) { birthday item = new birthday { Username = "******", Time = textbox2.Text, Name = textbox1.Text }; InsertBirth(item); try { } catch (MobileServiceInvalidOperationException e1) { MessageBox.Show(e1.Message, "添加信息成功!", MessageBoxButton.OK); } } else { try { } catch (MobileServiceInvalidOperationException e2) { MessageBox.Show(e2.Message, "输入格式错误!", MessageBoxButton.OK); } } }
private async void InsertBirth(birthday birth) { await todoTable.InsertAsync(birth); }