in order for the exploit to work, youll need to set the Attach() function to a button.

Attach the Api

You can use the Attach method like this:

private void YOURBUTTON_CLICK(object sender, RoutedEventArgs e)
{
    Api.inject(); 
}

here is a sample usage:

private void inject_Click(object sender, RoutedEventArgs e)
{
    Api.inject();
}