// Constructor
        public MainPage()
        {
            this.InitializeComponent();

            DispatcherHelper.Initialize();

            var backgroundBrush = this.RequestReviewPopup.Background as SolidColorBrush;
            var backgroundColor = backgroundBrush.Color;

            backgroundColor.A     = 0x66;
            backgroundBrush.Color = backgroundColor;

            // Set the data context of the listbox control to the sample data
            this.Loaded       += this.MainPage_Loaded;
            this.Unloaded     += this.MainPage_Unloaded;
            this.BackKeyPress += this.MainPage_BackKeyPress;

            // Create all the menu items
            this.ApplicationBar.AddMenuItem(Strings.Menu_CardLookup, this.CardLookup_Click);
            this.ApplicationBar.AddMenuItem(Strings.Menu_BlackMarket, this.BlackMarket_Click);
            this.ApplicationBar.AddMenuItem(Strings.Menu_Settings, this.Settings_Click);
            this.ApplicationBar.AddMenuItem(Strings.Menu_About, this.About_Click);

            if (Debugger.IsAttached)
            {
                this.ApplicationBar.AddMenuItem("Debug", (s, a) => NavigationServiceHelper.Navigate(PickerView.Debug));
            }

            // Create all the app bar buttons as well.
            this.resetSettingsButton = ApplicationBarHelper.CreateIconButton(
                Strings.MainPage_Reset,
                @"\Images\appbar.reset.png",
                this.ResetSettings_Click);

            this.addFavoriteButton = ApplicationBarHelper.CreateIconButton(
                Strings.MainPage_Save,
                @"\Images\appbar.favs.addto.png",
                this.AddFavorite_Click);

            this.resetFavoritesButton = ApplicationBarHelper.CreateIconButton(
                Strings.MainPage_Reset,
                @"\Images\appbar.reset.png",
                this.ResetFavorites_Click);
        }
        public ResultsViewer()
        {
            this.InitializeComponent();

            this.BackKeyPress += this.ResultsViewer_BackKeyPress;

            // This resolves the issue with the "The data necessary to complete
            // this operation is not yet available." exception.  We ignore the
            // card list items until after it's completed loading, at which point
            // we enable the hit test again.
            this.GroupedCardsList.IsHitTestVisible = false;
            this.GroupedCardsList.Loaded          += (sender, args) => { this.GroupedCardsList.IsHitTestVisible = true; };

            var refreshButton = new ApplicationBarIconButton
            {
                IconUri = new Uri(@"/Images/appbar.refresh.png", UriKind.Relative),
                Text    = Strings.Results_Regenerate,
            };

            refreshButton.Click += this.Refresh_Click;
            this.ApplicationBar.Buttons.Add(refreshButton);

            this.SortButton = ApplicationBarHelper.CreateIconButton(
                Strings.Results_SortName,
                @"/Images/appbar.sort.name.png",
                this.Sort_Click);
            this.ApplicationBar.Buttons.Add(this.SortButton);

            this.ApplicationBar.AddIconButton(
                Strings.Results_Save,
                @"/Images/appbar.favs.addto.png",
                this.AddFavorite_Click);

            // Create all the menu items
            this.ApplicationBar.AddMenuItem(Strings.Menu_CardLookup, this.CardLookup_Click);
            this.ApplicationBar.AddMenuItem(Strings.Menu_BlackMarket, this.BlackMarket_Click);
            this.ApplicationBar.AddMenuItem(Strings.Menu_Settings, this.Settings_Click);
            this.ApplicationBar.AddMenuItem(Strings.Menu_About, this.About_Click);
        }