How do I instantiate LiveConnectClient?
LiveConnectClient liveClient = new LiveConnectClient(); // ERROR
LiveConnectClient
the constructor requires a LiveConnectSession
varaiable, but LiveConnectSession
does not have a public constructor, and the reference cannot be assigned without initialization.
How do I fix the error above?
source to share
Sorry for the previous bad answer; I've taken too much. So the error simply means that you shouldn't create the LiveConnectClient this way.
See this Microsoft post for example code and this post which has some similar code.
source to share
The LiveConnectClient needs to be created with a valid LiveConnectSession, as you learned. This is for use with the SignInButton from the Live SDK. After installing the Live SDK, add SignInButton to your XAML and handle the SessionChanged event in code.
The LiveConnectSessionChangedEventArgs parameter included in the SessionChanged event contains a LiveConnectSession that you can use to create a LiveConnectClient. Just keep this session for the life of your application.
Cheers Laurent
source to share