Project Details
- Author: James Studdart
- Date Created: Dec 2009
- Visual Studio Version: 2010
Download Xbox360Client
Home > Projects > ASP.Net > Xbox360Client
Xbox360Client
This class enables you to consume the API feeds provided by 3rd parties for XBOX
LIVES.
Currently Supported:
Requirements
- Microsoft XBOX360 LIVE Account
- FREE 360Voice.com Account
Implementation
To simply use this project, add the project to your solution, and add the reference
to your website or application.
Then all you need to do is add the Application Settings in your web.config or app.config
defining the Account you which to display.
Web.config/App.config
<appSettings>
<add key="XboxGamerTag" value="darkv1p3r"/>
</appSettings>
Below is an example of how to implement this class.
Example Code
C# Example
var xboxManager = XboxFactory.GetXboxManager();
var xboxGamer = xboxManager.GetGamer();
if (xboxGamer.HasValue)
{
var profile = xboxGamer.Value.Profile[0];
imgProfilePic.ImageUrl = profile.ProfilePictureMiniUrl;
lblGamerName.Text = profile.GamerTag;
lblScore.Text = int.Parse(profile.GamerScore).ToString("G
0,000");
lblZone.Text = "Zone: " + profile.PlayerZone;
}
else
{
imgProfilePic.Visible = false;
lblGamerName.Visible = false;
lblScore.Visible = false;
lblZone.Visible = false;
}
VB.Net Example:
Dim xboxManager = XboxFactory.GetXboxManager()
Dim xboxGamer = xboxManager.GetGamer()
If xboxGamer.HasValue Then
Dim profile = xboxGamer.Value.Profile(0)
imgProfilePic.ImageUrl = profile.ProfilePictureMiniUrl
lblGamerName.Text = profile.GamerTag
lblScore.Text = Integer.Parse(profile.GamerScore).ToString("G
0,000")
lblZone.Text = "Zone: " & profile.PlayerZone
Else
imgProfilePic.Visible = False
lblGamerName.Visible = False
lblScore.Visible = False
lblZone.Visible = False
End If
There is also an overloaded method on .GetGamer()
which gives you the ability to get anyones profile by defining their name in the
call.
You do not need the web/app.config ApplicationSetting when using this method.
This is simply called as below:
Example Code
C# Example
var xboxManager = XboxFactory.GetXboxManager();
var xboxGamer = xboxManager.GetGamer("DarkV1p3r");
if (xboxGamer.HasValue)
{
var profile = xboxGamer.Value.Profile[0];
imgProfilePic.ImageUrl = profile.ProfilePictureMiniUrl;
lblGamerName.Text = profile.GamerTag;
lblScore.Text = int.Parse(profile.GamerScore).ToString("G
0,000");
lblZone.Text = "Zone: " + profile.PlayerZone;
}
else
{
imgProfilePic.Visible = false;
lblGamerName.Visible = false;
lblScore.Visible = false;
lblZone.Visible = false;
}
VB.Net Example:
Dim xboxManager = XboxFactory.GetXboxManager()
Dim xboxGamer = xboxManager.GetGamer("DarkV1p3r")
If xboxGamer.HasValue Then
Dim profile = xboxGamer.Value.Profile(0)
imgProfilePic.ImageUrl = profile.ProfilePictureMiniUrl
lblGamerName.Text = profile.GamerTag
lblScore.Text = Integer.Parse(profile.GamerScore).ToString("G
0,000")
lblZone.Text = "Zone: " & profile.PlayerZone
Else
imgProfilePic.Visible = False
lblGamerName.Visible = False
lblScore.Visible = False
lblZone.Visible = False
End If