PageRenderTime 39ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/toolkit/PhoneToolkitSample/Data/MoviesByCategory.vb

https://bitbucket.org/jeremejevs/word-steps
Visual Basic | 50 lines | 32 code | 14 blank | 4 comment | 0 complexity | e1a79654f2629fed9eca50209445dac6 MD5 | raw file
  1. ' (c) Copyright Microsoft Corporation.
  2. ' This source is subject to the Microsoft Public License (Ms-PL).
  3. ' Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
  4. ' All other rights reserved.
  5. Imports System.Collections.ObjectModel
  6. Namespace Data
  7. Public Class MoviesByCategory
  8. Inherits ObservableCollection(Of MoviesInCategory)
  9. Public Sub New()
  10. Dim sortedCategories As New List(Of String)(Movie.Categories)
  11. sortedCategories.Sort()
  12. For Each category In sortedCategories
  13. Dim group As New MoviesInCategory(category)
  14. Me.Add(group)
  15. For i = 0 To 4
  16. group.Add(Movie.CreateRandom(category))
  17. Next i
  18. Next category
  19. End Sub
  20. End Class
  21. Public Class MoreCommand
  22. Implements ICommand
  23. #Region "ICommand Members"
  24. Public Function CanExecute(ByVal parameter As Object) As Boolean Implements System.Windows.Input.ICommand.CanExecute
  25. Return True
  26. End Function
  27. Public Event CanExecuteChanged As EventHandler Implements System.Windows.Input.ICommand.CanExecuteChanged
  28. Public Sub Execute(ByVal parameter As Object) Implements System.Windows.Input.ICommand.Execute
  29. Dim group = TryCast(parameter, MoviesInCategory)
  30. If group IsNot Nothing Then
  31. group.Add(Movie.CreateRandom(group.Key))
  32. End If
  33. End Sub
  34. #End Region
  35. End Class
  36. End Namespace