Dim
tnaddress
As
String
=
"https://api.recognition.microsoft.com/v1/user/"
& userId &
"/ detail? Locale = en-US"
New
WebClient System.Net.WebClient
result
= webClient.DownloadString (tnaddress)
Public
Class
UserFeed
UserId
Property
Points
Long
Percentile
Integer
GoldAchievements
Medal ()
SilverAchievements
BronzeAchievements
End
Medal
Title
Description
AchievementId
Earned
uf
UserFeed = JsonConvert.DeserializeObject (Of UserFeed) (result)
TypedMedal
Inherits
Level
MyMedals
List (Of TypedMedal)
myMedals.AddRange (From m
In
uf.GoldAchievements
Select
With
{TypedMedal .title = m.Title,
.description = M.Description,
.AchievementId = M.AchievementId,
.Earned = M.Earned,
.level =
"Gold Achievements"
})
uf.SilverAchievements
"Silver Achievements"
uf.BronzeAchievements
"Bronze Achievements"
From m
For
Each
m
'Do something
Next
view
CollectionView = CollectionViewSource.GetDefaultView (myMedals)
view.GroupDescriptions.Add (
PropertyGroupDescription (
"Level"
))
MedalList.ItemsSource = view
<
ListBox
Name
"medalist"
HorizontalAlignment
"Stretch"
Margin
"10,96,10,10"
VerticalAlignment
Width
"Auto"
AlternationCount
"2"
>
ListBox.ItemTemplate
DataTemplate
StackPanel
Orientation
"Vertical"
"0,6,5,2"
"auto"
TextBlock
FontSize
"14"
FontWeight
"Bold"
Foreground
"Black"
Text
"{Binding Title}"
"0,0,0,0"
/>
"10"
"Normal"
TextWrapping
"Wrap"
FontStyle
"Italic"
"{Binding} Description"
"0,2,0,0"
</
ListBox.GroupStyle
GroupStyle
GroupStyle.HeaderTemplate
"Horizontal"
Background
"LightBlue"
"15"
"{Binding Name}"
"5,4,10,4"
"blue"
"{Binding} ItemCount"
"0,4,0,0"
Imports
System.Net
Newtonsoft.Json
System.ComponentModel
MainWindow
Private
Sub
QueryTechnet (userId
)
If
userId.CompareTo (
""
) = 0
Then
MsgBox (
"Please enter a valid UserId in the textbox"
, MsgBoxStyle.Exclamation)
Exit
Button_Click (sender
Object
, e
RoutedEventArgs)
QueryTechnet (txtUserId.Text)
Window
x:
"MainWindow"
xmlns
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:
x
"http://schemas.microsoft.com/winfx/2006/xaml"
"My Technet Medals"
Height
"550"
width
"562"
WindowStartupLocation
"CenterScreen"
WindowStyle
"ThreeDBorderWindow"
ResizeMode
"noresize"
Window.Resources
Style
TargetType
"{x: Type ListBoxItem}"
Style.Triggers
Trigger
"ItemsControl.AlternationIndex"
Value
"0"
Setter
"Background"
"WhiteSmoke"
> </
Triggers
"1"
"White"
Grid
"10,119,10,10"
"Left"
"109"
"10,10,0,0"
"top"
"529"
Label
Content
"Insert TechNet User Id, then press"
Refresh ""
"If you do not know what your User Id is, please read my article to find out!"
TextBox
"23"
"txtUserId"
"XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
Button
"Refresh"
"415,0,0,0"
"30"
Click
"Button_Click"