Last active
February 1, 2019 22:31
-
-
Save jasonboukheir/1737896e1c63efe02beb72e07adb7971 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment