Skip to content

Instantly share code, notes, and snippets.

@SoulFireMage
Created December 27, 2013 17:01
Show Gist options
  • Save SoulFireMage/8149646 to your computer and use it in GitHub Desktop.
Save SoulFireMage/8149646 to your computer and use it in GitHub Desktop.
OData with Netflix from 2012
type netflix = ODataService<"http://odata.netflix.com/Catalog/">
let films = netflix.GetDataContext()
let FilmSearch title number =
query {
for film in films.Titles do
where (film.Name.Contains title)
take number
}
//This belongs to the F# dll above.
Function buildFilmStackPanel(Title As netflix.ServiceTypes.Title)
Dim stack As New StackPanel
Dim Filmtitle As New Label With {.Content = Title.Name, .ClipToBounds = True}
Dim Synopsis As New TextBlock With {.Text = Title.Synopsis, .TextWrapping = TextWrapping.Wrap, .FontSize = 10, .ClipToBounds = True, .MaxWidth = 400}
Dim imageStr As String = Title.BoxArt.MediumUrl
Dim image As New Image() With {.Source = New BitmapImage(New Uri(imageStr)),
.Width = 256,
.HorizontalAlignment = Windows.HorizontalAlignment.Left}
stack.Children.Add(Filmtitle)
stack.Children.Add(Synopsis)
stack.Children.Add(image)
Return stack
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment