Setting Up the InnerTube WPF Application
Now that you've seen the core libraries, let's show how you can build a WPF application that can display our list of videos. The first thing we need to do is set up a couple of conventions for our application, namely where we will store global variables, such as the list of feeds and our application setting variables, whether iTunes or Zune is installed, and what location we will save downloaded videos to.
Global Variables
When you create a WPF project, it includes an Application class named App.xaml, which includes a code-behind file that, since it's an application-level scope class, would be a perfect place for us to store our global variables. To do that, we declare our list of feeds and our application settings as static properties, as shown in Example 4-53 and Example 4-54.
Example 4-53.
C# code for InnerTube's global variables
public partial class App : Application
{
public static ObservableCollection<InnerTubeFeed> InnerTubeFeeds { get; set; }
public static Setting Settings { get; set; }
...Example 4-54.
Visual Basic code for InnerTube's global variables
Partial Public Class App Inherits Application Private Shared privateInnerTubeFeeds As ObservableCollection(Of InnerTubeFeed) Public Shared Property InnerTubeFeeds() As ObservableCollection(Of ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access