Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Karuna;
- public class EventSDKSample {
- void CreateEventHandler() {
- // Check user is logged in. If they are not we log them in
- // and wait for a successful response before creating the event.
- if (User.CurrentUser.Username == null) {
- API.Create(new Login() {
- Username = "karunademo",
- Password = "Karuna1!"
- }).AddListeners(
- onSuccess: (_request, _response) => { CreateEvent(); }
- );
- return;
- }
- // otherwise we can continue without waiting for login...
- CreateEvent();
- }
- void CreateEvent() {
- var e = new Karuna.Event() {
- Created = DateTime.Now,
- EventType = "My event type",
- EventValue = "My event value",
- // The patient still needs to be added,
- // but will look like so
- // Patient = Patient.CurrentPatient
- };
- API.Create(e);
- }
- }
Add Comment
Please, Sign In to add comment