// Constructor
        public ItemsShowcaseView()
        {
            InitializeComponent();

            DataContext = new ItemsShowcaseViewModel();
            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
            SearchBox.TextChanged += SearchBox_TextChanged;
            Loaded += ItemsShowcaseView_Loaded;
        }
        public static void MonitorLoadingItems(ItemsShowcaseViewModel itemsShowcaseViewModel)
        {
            itemsShowcaseViewModel.LoadCompleted += eventHandler;

            if (!waitHandle.WaitOne(loadingOfDataSourcesTimeOutInMilliseconds, false))
            {
                Assert.Fail("Loading of DataSources timed out after " + loadingOfDataSourcesTimeOutInMilliseconds + " ms");
            }

            itemsShowcaseViewModel.LoadCompleted -= eventHandler;
        }
        public static void ClassInitialize(TestContext t)
        {
            ServiceLocator.AzureMobileService = new AzureMobileService();
            ServiceLocator.ResourceFileService = new TestResourceFileService();
            ServiceLocator.MessageService = new TestMessageService();

            var iocProvider = MvxSimpleIoCContainer.Initialize();
            Mvx.RegisterSingleton<IMvxFileStore>(new MvxWpfFileStore());

            itemsShowcaseViewModel = new ItemsShowcaseViewModel();
            MonitorLoadingItems();
            Debug.WriteLine("Initial DataSources Loaded " + DateTime.Now.ToString());
        }
        public void ValidateRemoteAppSettingsService()
        {
            Debug.WriteLine("Initial App Name = " + AppSettings.ApplicationName);
            Assert.IsFalse(AppSettings.ApplicationName.Contains("Remote Application"), "Application currently uses an inconclusive name of " + AppSettings.ApplicationName);

            AppSettings.EnableRemoteAppSettings = true;
            AppSettings.RemoteAppSettingsService = "http://pjdecarlo.com/playground/XPCKSampleRemoteAppSettings/AppSettings.html";

            var itemsShowcaseViewModel = new ItemsShowcaseViewModel(true); // Ignore cache to retrieve AppSettings file from remote source
            MonitorLoadingItems(itemsShowcaseViewModel);
            Debug.WriteLine("Initial DataSources Loaded " + DateTime.Now.ToString());

            Debug.WriteLine("Final App Name = " + AppSettings.ApplicationName);
            Assert.IsTrue(AppSettings.ApplicationName.Contains("Remote Application"),
                "Expected Remote Application Identifier not found."); // Will fail if invalid or no AppSettings file was retrieved
        }
        // Constructor
        public ItemsShowcaseView()
        {
            InitializeComponent();
            
            DataContext = new ItemsShowcaseViewModel();
            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
            SearchBox.TextChanged += SearchBox_TextChanged;
            Loaded += ItemsShowcaseView_Loaded;

            if (AppSettings.EnablePhoneBackground8X == true)
            {
                LayoutRoot.Background = Application.Current.Resources["WallPaperBrush"] as ImageBrush;
                LayoutRoot.Background.Opacity = .5;
            }

            if (AppSettings.EnableAppPromoRatingReminder)
            {
                RateReminder rateReminder = new RateReminder();
                rateReminder.RunsBeforeReminder = AppSettings.NumberOfRunsBeforeRateReminder;
                LayoutRoot.Children.Add(rateReminder);
            }

            if (AppSettings.EnablePubcenterAdsPhone8)
            {
                if (AppSettings.HideAdsIfPurchasedPhone8)
                    if (!licenseInfo.IsTrial())
                        return;

                var advertisingControlPlaceholder = new RowDefinition();
                advertisingControlPlaceholder.Height = new GridLength(80);
                LayoutRoot.RowDefinitions.Add(advertisingControlPlaceholder);
                var appbarSpacer = new RowDefinition();
                appbarSpacer.Height = new GridLength(30);
                LayoutRoot.RowDefinitions.Add(appbarSpacer);
                AdControl adControl = new AdControl(AppSettings.PubcenterApplicationIdPhone8, AppSettings.PubcenterAdUnitIdPhone8, true);
                adControl.Width = 480;
                adControl.Height = 80;
                Grid.SetRow(adControl, 2);
                LayoutRoot.Children.Add(adControl);
            }
        }