Registers an app to receive notifications for any achievements that are unlocked.
public:
static AchievementSource^ GetUnfilteredSource()
Type: AchievementSource
Returns an AchievementSource object which can be used to assign an event handler for achievement unlocked events.
Namespace: Windows.Xbox.Achievements
Metadata: windows.winmd
using namespace Windows::Xbox::Achievements;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
class MyApp
{
void registerForAchievementUnlocked()
{
AchievementSource^ achievementSource = AchievementNotifier->GetUnfilteredSource();
achievementSource.AchievementUnlocked = ref new EventHandler<AchievementUnlockedEventArgs^>(
[&] (Object^, AchievementUnlockedEventArgs^ args)
{
Windows::Xbox::System::IUser^ unlockingUser = args->User;
String^ unlockingTitle = args->TitleId;
String^ achievementId = args->AchievementId;
// App can now update UI, etc, based on achievement being unlocked
});
}
};