private void CreateAdControl_Click(object sender, RoutedEventArgs e)
        {
            var button = (Button)sender;

            button.IsEnabled = false;

            // Programatically create an ad control. This must be done from the UI thread.
            var adControl = new AdControl();

            // Set the application id and ad unit id
            // The application id and ad unit id can be obtained from Dev Center.
            // See "Monetize with Ads" at https://msdn.microsoft.com/en-us/library/windows/apps/mt170658.aspx
            adControl.ApplicationId = "d25517cb-12d4-4699-8bdc-52040c712cab";
            adControl.AdUnitId      = "10043134";

            // Set the dimensions
            adControl.Width  = 160;
            adControl.Height = 600;

            // Add event handlers if you want
            adControl.ErrorOccurred += OnErrorOccurred;
            adControl.AdRefreshed   += OnAdRefreshed;

            // Add the ad control to the page.
            var parent = (Panel)button.Parent;

            parent.Children.Add(adControl);
        }
        private void CreateAdControl_Click(object sender, RoutedEventArgs e)
        {
            var button = (Button)sender;
            button.IsEnabled = false;

            // Programatically create an ad control. This must be done from the UI thread.
            var adControl = new AdControl();

            // Set the application id and ad unit id
            // The application id and ad unit id can be obtained from Dev Center.
            // See "Monetize with Ads" at https://msdn.microsoft.com/en-us/library/windows/apps/mt170658.aspx
            adControl.ApplicationId = "d25517cb-12d4-4699-8bdc-52040c712cab";
            adControl.AdUnitId = "10043134";

            // Set the dimensions
            adControl.Width = 160;
            adControl.Height = 600;

            // Add event handlers if you want
            adControl.ErrorOccurred += OnErrorOccurred;
            adControl.AdRefreshed += OnAdRefreshed;

            // Add the ad control to the page.
            var parent = (Panel)button.Parent;
            parent.Children.Add(adControl);
        }
Beispiel #3
0
        //</Snippet3>


        public MainPage()
        {
            this.InitializeComponent();

            //<Snippet4>
            myAdGrid.Width  = AD_WIDTH;
            myAdGrid.Height = AD_HEIGHT;

            // For mobile device families, use the mobile ad unit info.
            if ("Windows.Mobile" == AnalyticsInfo.VersionInfo.DeviceFamily)
            {
                myAppId    = MAPPLICATIONID;
                myAdUnitId = MADUNITID;
            }

            // Initialize the AdControl.
            myAdControl = new AdControl();
            myAdControl.ApplicationId        = myAppId;
            myAdControl.AdUnitId             = myAdUnitId;
            myAdControl.Width                = AD_WIDTH;
            myAdControl.Height               = AD_HEIGHT;
            myAdControl.IsAutoRefreshEnabled = true;

            myAdGrid.Children.Add(myAdControl);
            //</Snippet4>
        }
Beispiel #4
0
        /*private Dictionary<String, BitmapImage> barImages = new Dictionary<String, BitmapImage>()
         * {
         *  {"minusFull", new BitmapImage(new Uri("bar/minusFull.png", UriKind.Relative))},
         *  {"minusThree", new BitmapImage(new Uri("bar/minusThree.png", UriKind.Relative))},
         *  {"minusTwo", new BitmapImage(new Uri("bar/minusTwo.png", UriKind.Relative))},
         *  {"minusOne", new BitmapImage(new Uri("bar/minusOne.png", UriKind.Relative))},
         *  {"stale", new BitmapImage(new Uri("bar/stale.png", UriKind.Relative))},
         *  {"plusOne", new BitmapImage(new Uri("bar/plusOne.png", UriKind.Relative))},
         *  {"plusTwo", new BitmapImage(new Uri("bar/plusTwo.png", UriKind.Relative))},
         *  {"plusThree", new BitmapImage(new Uri("bar/plusThree.png", UriKind.Relative))},
         *  {"plusFull", new BitmapImage(new Uri("bar/plusFull.png", UriKind.Relative))},
         *  {"minus", new BitmapImage(new Uri("bar/minus.png", UriKind.Relative))},
         *  {"plus", new BitmapImage(new Uri("bar/plus.png", UriKind.Relative))},
         *  {"minusPressed", new BitmapImage(new Uri("bar/minusPressed.png", UriKind.Relative))},
         *  {"plusPressed", new BitmapImage(new Uri("bar/plusPressed.png", UriKind.Relative))}
         * };*/

        public MainPage()
        {
            InitializeComponent();

            AdControl hypeMachineAd = new AdControl()
            {
                ApplicationId = "4d3667ee-44c1-494c-929d-5e661b011918", AdUnitId = "10019312"
            };

            LayoutRoot.Children.Add(hypeMachineAd);
            Grid.SetRow(hypeMachineAd, 1);

            Assets.Instance.Create("PivotBackground", new BitmapImage(new Uri("backgrounds/PivotBackground.png", UriKind.Relative)));
            Assets.Instance.Create("PivotBackgroundDark", new BitmapImage(new Uri("backgrounds/PivotBackgroundDark.png", UriKind.Relative)));

            if (((Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible))
            {
                mainView.Background = new ImageBrush()
                {
                    ImageSource = Assets.Instance.ReadBitmapImage("PivotBackgroundDark"), Stretch = Stretch.None
                };
                mainView.Foreground = new SolidColorBrush(Colors.White);
            }
            else
            {
                mainView.Background = new ImageBrush()
                {
                    ImageSource = Assets.Instance.ReadBitmapImage("PivotBackground"), Stretch = Stretch.None
                };
                mainView.Foreground = new SolidColorBrush(Colors.Black);
            }

            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        }
 public void ReserveAd(string id)
 {
     try
     {
         var user = GetServiceUserEmail();
         AdControl.GetInstance().ReserveAd(id, user);
     }
     catch (AlreadyReservedException ex)
     {
         throw new WebFaultException <AlreadyReservedException>(ex, HttpStatusCode.Forbidden);
     }
     catch (NotEnoughReservationsException ex)
     {
         throw new WebFaultException <NotEnoughReservationsException>(ex, HttpStatusCode.Forbidden);
     }
     catch (PostNotFoundException ex)
     {
         throw new WebFaultException <PostNotFoundException>(ex, HttpStatusCode.Forbidden);
     }
     catch (UserNotFoundException ex)
     {
         throw new WebFaultException <UserNotFoundException>(ex, HttpStatusCode.Forbidden);
     }
     catch (Exception ex)
     {
         throw new WebFaultException <Exception>(ex, HttpStatusCode.InternalServerError);
     }
 }
Beispiel #6
0
        //Wir am Anfang der Seite ausgeführt
        //---------------------------------------------------------------------------------------------------------
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            //xAdImage verstecken
            xAdImage.Visibility = System.Windows.Visibility.Collapsed;

            //Prüfen ob Free Version
            if ((Application.Current as App).IsTrial)
            {
                //Werbung hinzufügen
                if (!string.IsNullOrEmpty(APPLICATION_ID) && !string.IsNullOrEmpty(AD_UNIT_ID))
                {
                    //AdControl
                    AdControl adControl = new AdControl(APPLICATION_ID, AD_UNIT_ID, true);
                    //Bei Fehlern
                    adControl.ErrorOccurred += (o, d) =>
                    {
                        adControl.Visibility = System.Windows.Visibility.Collapsed;
                        adControl_ErrorOccurred();
                    };


                    // Make the AdControl size large enough that it can contain the image
                    adControl.Width             = 480;
                    adControl.Height            = 80;
                    adControl.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
                    LayoutRoot.Children.Add(adControl);
                }
            }
            //Bei Kaufversion
            else
            {
                //Content Panel vergrößern
                ContentPanel.Height = 800;
            }
        }
Beispiel #7
0
 public void Add_Control(AdControl _adControl_L, AdControl _adControl_P, int _marginLeft, int _marginDown)
 {
     adControl_X_L = _adControl_L;
     adControl_X_P = _adControl_P;
     marginLeft    = _marginLeft;
     marginDown    = _marginDown;
 }
    void Start()
    {
        Time.timeScale = 1;

        gameOverScreen     = transform.Find("GameOver").gameObject;
        gameOverStats      = gameOverScreen.transform.Find("Stats").gameObject;
        gameOverScreenpos1 = gameOverScreen.transform.position;

        scoreDisplay     = transform.Find("Score").Find("Text").GetComponent <TextMeshProUGUI>();
        highScoreDisplay = transform.Find("High Score").Find("Text").GetComponent <TextMeshProUGUI>();
        boneCounter      = transform.Find("Bone Counter").gameObject;
        darkener         = transform.Find("Darkener").gameObject;
        pauseMenu        = transform.Find("PauseMenu").gameObject;
        pauseMenu.SetActive(false);
        adControl      = GameObject.Find("Advertisement Manager").GetComponent <AdControl>();
        socialControl  = GameObject.Find("Social").GetComponent <SocialControl>();
        mobileControls = transform.Find("Mobile Controls").gameObject;

        int usingAimJoystick = PlayerPrefs.GetInt("usingAimJoystick", 0);

        if (usingAimJoystick == 1)
        {
            GameObject aimJoystick = mobileControls.transform.Find("Aim Joystick").gameObject;
            aimJoystick.transform.position   = Vector3.zero;
            aimJoystick.transform.localScale = new Vector3(6, 6, 1);
            aimJoystick.transform.Find("Visual").GetComponent <Image>().enabled = false;
            aimJoystick.transform.Find("Handle").GetComponent <Image>().enabled = false;
        }

        highScore             = PlayerPrefs.GetInt("Highscore", 0);
        highScoreDisplay.text = "<color=#EEEEEE>High Score: " + highScore.ToString() + "</color>";
        updateBoneCount(playerBones);
    }
        // Load data for the ViewModel Items
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            LicenseInformation info = new LicenseInformation();
            #if DEBUG
            if (true)
            #else
            if (info.IsTrial())
            #endif
            {
                // running in trial mode
            #if DEBUG
                AdControl ac = new AdControl("TextAd", "test_client", true);
                // Other options in case you want to test other ads
                //AdControl ac = new AdControl("Image480_80", "test_client", true);
                //AdControl ac = new AdControl("Image300_50", "test_client", true);
            #else
                AdControl ac = new AdControl("012345", "01234567-1234-1234-1234-0123456789012", true);
            #endif
                ac.Width = 480;
                ac.Height = 80;

                AdControlHolder.Child = ac;
            }

            if (!App.ViewModel.IsDataLoaded)
            {
                App.ViewModel.LoadData();

            }
        }
Beispiel #10
0
        private void InitializeAdControl()
        {
            // Initialize the AdControl.
            this.adControl = new AdControl
            {
                IsAutoRefreshEnabled = true,
                HorizontalAlignment  = HorizontalAlignment.Stretch,
                VerticalAlignment    = VerticalAlignment.Stretch,
            };

            // For mobile device families, use the mobile ad unit info.
            if (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Mobile")
            {
                this.adControl.ApplicationId = MApplicationId;
                this.adControl.AdUnitId      = MAdUnitId;
                this.adControl.Width         = 480;
                this.adControl.Height        = 80;
            }
            else
            {
                this.adControl.ApplicationId = WApplicationId;
                this.adControl.AdUnitId      = WAdUnitId;
                this.adControl.Width         = 728;
                this.adControl.Height        = 90;
            }

            this.adControl.SetValue(Grid.RowProperty, 3);
            this.adControl.SetValue(Grid.ColumnProperty, 0);
            this.adControl.SetValue(Grid.ColumnSpanProperty, 5);

            this.MainGrid.Children.Add(this.adControl);
        }
Beispiel #11
0
        private void VmOnPropertyChanged(object sender, PropertyChangedEventArgs args)
        {
            if (args.PropertyName == "MenuPaneState")
            {
                var paneState = (sender as MainViewModel).MenuPaneState;
                _paneState = paneState;

                HamburgerControl.Width = _paneState ? 250 : 48;
                HamburgerTopGrid.Width = _paneState ? 250 : 48;
            }
            else if (args.PropertyName == "OffContentVisibility")
            {
                SplitterColumn.Width = new GridLength(ViewModelLocator.GeneralMain.OffContentVisibility ? 16 : 0);
            }
            else if (args.PropertyName == nameof(ViewModelLocator.GeneralMain.AdsContainerVisibility))
            {
                if (ViewModelLocator.GeneralMain.AdsContainerVisibility)
                {
                    AdControl.Resume();
                }
                else
                {
                    AdControl.Suspend();
                }
            }
        }
Beispiel #12
0
        public static void GetAdForGrid(Grid grid, int nRow, int nCol, int nColSpan)
        {
#if DEBUG
            // use test ads when debugging:
            AdControl adControl = new AdControl("test_client", "Image480_80", true);
#else
            // user real ad control when in production:
            AdControl adControl = new AdControl("dc4505ab-798c-48ed-a7d6-2c316de4c50d", "123763", true);
#endif

            // Make the AdControl size large enough that it can contain the image
            adControl.Width  = 480;
            adControl.Height = 80;

            // PLACE THE AD ON THE CANVAS:
            grid.Children.Add(adControl);

            Grid.SetRow(adControl, nRow);
            Grid.SetColumn(adControl, nCol);

            if (nColSpan > 0)
            {
                Grid.SetColumnSpan(adControl, nColSpan);
            }
        }
Beispiel #13
0
        private void VmOnPropertyChanged(object sender, PropertyChangedEventArgs args)
        {
            if (args.PropertyName == "MenuPaneState")
            {
                var paneState = (sender as MainViewModel).MenuPaneState;
                _paneState             = paneState;
                HamburgerControl.Width = paneState ? 250 : 48;
                HamburgerTopGrid.Width = paneState ? 250 : 48;
                TitleBarLeft.Margin    = new Thickness(Math.Max(_paneState ? 250 : 48, CoreApplication.GetCurrentView().TitleBar.SystemOverlayLeftInset), 0, 0, 0);
            }
            else if (args.PropertyName == "OffContentVisibility")
            {
                SplitterColumn.Width = new GridLength(ViewModelLocator.GeneralMain.OffContentVisibility ? 16 : 0);

                var width = ViewModelLocator.GeneralMain.OffContentVisibility ? (DataContext as MainViewModel).OffContentStatusBarWidth + 16 : 0;
                TitleBarRight.Margin = new Thickness(0, 0, Math.Max(width, CoreApplication.GetCurrentView().TitleBar.SystemOverlayRightInset), 0);
            }
            else if (args.PropertyName == nameof(ViewModelLocator.GeneralMain.AdsContainerVisibility))
            {
                if (ViewModelLocator.GeneralMain.AdsContainerVisibility)
                {
                    AdControl.Resume();
                }
                else
                {
                    AdControl.Suspend();
                }
            }
        }
        private void DisplayAds()
        {
            //Test Ads
            //AdControl ad = new AdControl("test_client", // ApplicationID
            //                               "Image480_80",    // AdUnitID
            //                               AdModel.Contextual, // AdModel
            //                               true);         // RotationEnabled
            AdControl.TestMode = false;
            AdControl ad = new AdControl();
            ad.AdUnitId = "46155";
            ad.ApplicationId = "d22bc6bf-5dfd-4b13-b935-416a08be13a3";
            ad.AdModel = AdModel.Contextual;

            //Real Ads
            //AdControl.TestMode = false;
            //AdControl ad = new AdControl();
            //ad.AdUnitId = "<Your AdUnitId>";
            //ad.ApplicationId = "<Your ApplicationId>";
            //ad.AdModel = AdModel.Contextual;

            //Ad Layout and Container
            ad.Width = 480;
            ad.Height = 80;
            ad.HorizontalAlignment = HorizontalAlignment.Left;
            ad.VerticalAlignment = VerticalAlignment.Bottom;
            gridSearch.Children.Add(ad);
        }
Beispiel #15
0
        public MainPage()
        {
            InitializeComponent();
            PanoramaItem eventsPage = new PanoramaItem()
            {
                Name = "eventsPage", Header = "Upcoming"
            };
            PanoramaItem artistsPage = new PanoramaItem()
            {
                Name = "artistsPage", Header = "Artists"
            };
            PanoramaItem venuesPage = new PanoramaItem()
            {
                Name = "venuesPage", Header = "Venues"
            };

            mainView.Items.Add(eventsPage);
            mainView.Items.Add(artistsPage);
            mainView.Items.Add(venuesPage);

            AdControl concertsAd = new AdControl()
            {
                ApplicationId = "33c7fa47-c859-47f1-8903-f745bf749ce0", AdUnitId = "10016302", Width = 300, Height = 50, Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.White), Background = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Black)
            };

            LayoutRoot.Children.Add(concertsAd);
            Grid.SetRow(concertsAd, 1);

            ApplicationBar = new ApplicationBar();
            ApplicationBar.IsMenuEnabled = true;
            ApplicationBar.IsVisible     = true;
            ApplicationBar.Opacity       = 1.0;

            events  = new List <Event>();
            artists = new List <Artist>();
            venues  = new List <Venue>();

            eventsStorageHelper  = new StorageHelper <Event>("Events.xml", "Stale.txt");
            artistsStorageHelper = new StorageHelper <Artist>("Artists.xml");
            venuesStorageHelper  = new StorageHelper <Venue>("Venues.xml");

            ApplicationBarIconButton refresh = new ApplicationBarIconButton(new Uri("/Icons/appbar.refresh.rest.png", UriKind.Relative));

            refresh.Text   = "refresh";
            refresh.Click += new EventHandler(refresh_Click);

            ApplicationBarIconButton settings = new ApplicationBarIconButton(new Uri("/Icons/appbar.feature.settings.rest.png", UriKind.Relative));

            settings.Text   = "settings";
            settings.Click += new EventHandler(settings_Click);

            ApplicationBar.Buttons.Add(refresh);
            ApplicationBar.Buttons.Add(settings);

            ApplicationBar.BackgroundColor = System.Windows.Media.Colors.Black;
            ApplicationBar.ForegroundColor = System.Windows.Media.Colors.White;

            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        }
Beispiel #16
0
 private void Ad_Loaded(object sender, RoutedEventArgs e)
 {
     if (Settings.Spot)
     {
         AdControl control = (AdControl)sender;
         control.Visibility = Windows.UI.Xaml.Visibility.Visible;
         UpdateLayout();
     }
 }
Beispiel #17
0
        // Constructor

        private void InitializeAdvertising()
        {
            #region Advertising
            AdControl  adControl  = new AdControl();
            AdSettings adSettings = new AdSettings(ref adControl, ref ad_close);
            adSpace.Children.Clear();
            this.adSpace.Children.Add(adControl);
            #endregion
        }
Beispiel #18
0
 private void InitializeAdvertising()
 {
     #region Advertising
     AdControl  adControl  = new AdControl();
     Image      ad_close   = new Image();
     AdSettings adSettings = new AdSettings(ref adControl, ref ad_close);
     this.adGrid.Children.Add(adControl);
     #endregion
 }
        public void AddAds(Grid grid, string unitId)
        {
#if FREE7
            AdControl adControl = new AdControl("57fa3b83-82f9-49fa-a395-2f13cdda6765", unitId, true);
            adControl.Width  = 480;
            adControl.Height = 80;
            grid.Children.Add(adControl);
#endif
        }
        public void AddAds(Grid grid, string unitId)
        {
#if FREE7
            AdControl adControl = new AdControl("57fa3b83-82f9-49fa-a395-2f13cdda6765", unitId, true);
            adControl.Width = 480;
            adControl.Height = 80;
            grid.Children.Add(adControl);
#endif
        }
        private void LoadAds()
        {
            var bottomAd = new AdControl(Constants.StoreAppId, "MainPageBottomAd", true)
            {
                Height = 50,
                Width  = 350,
            };

            FriendDetailsAdControl.Children.Add(bottomAd);
        }
 public void EditAd(string id, string title, string content, string locationName, AdType type)
 {
     try
     {
         AdControl.GetInstance().UpdateAd(GetServiceUserEmail(), id, title, content, locationName, type);
     }
     catch (InvalidOperationException)
     {
         throw new WebFaultException <string>("Can not edit other people's ads", HttpStatusCode.Unauthorized);
     }
 }
 public static void CreateSingleAdUnit(int id, string resource, Grid grid)
 {
     AdControl ad = new AdControl();
     ad.ApplicationId = App.AppId;
     ad.AdUnitId = id.ToString();
     ad.Style = Application.Current.Resources[resource] as Style;
     ad.IsAutoRefreshEnabled = false;
     ad.Refresh();
     ad.IsAutoRefreshEnabled = true;
     ad.AutoRefreshIntervalInSeconds = 30;
     grid.Children.Add(ad);
 }
Beispiel #24
0
 private async void disposeAsync()
 {
     await WinRTPlugin.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate()
     {
         if (adControl != null)
         {
             adControl.IsEnabled = false;
             WinRTPlugin.AdGrid.Children.Remove(adControl);
             adControl = null;
         }
     });
 }
        public MainPage()
        {
            this.InitializeComponent();

            myAdControl = new AdControl()
            {
                ApplicationId = "{ApplicationID}",
                AdUnitId      = "{AdUnitID}",
                Height        = 90,
                Width         = 728
            };
        }
        public PubCenterControl(string appId, string adUnitId, bool isAutoRefresh)
            : base(appId, adUnitId, 480, 50, isAutoRefresh)
        {
            InitializeComponent();

            _adControl = new AdControl(appId, adUnitId, isAutoRefresh);

            _adControl.AdRefreshed += OnAdReceived;
            _adControl.IsEnabledChanged += (sender, args) => OnAdEngaged(sender, null);
            _adControl.ErrorOccurred += (sender, args) => OnAdFailed(sender, new AdvertisementErrorEventArgs(args.Error.Message));

            LayoutRoot.Children.Add(_adControl);
        }
Beispiel #27
0
        static AdManager()
        {
            timer       = new DispatcherTimer();
            timer.Tick += new EventHandler(timer_Tick);

            CycleSeconds = 30;

            Ad = new AdControl();
            Ad.IsAutoRefreshEnabled  = false;
            Ad.IsAutoCollapseEnabled = true;
            Ad.Width  = 480;
            Ad.Height = 80;
        }
Beispiel #28
0
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);
            BannerAd element = sender as BannerAd;

            if (e.PropertyName == BannerAd.IsVisibleProperty.PropertyName && element.IsVisible == true)
            {
                bannerView = null;
                UpdateNativeControl();
                CreateAdControl(element.AdSize, element.AdUnitID);
                SetNativeControl(bannerView);
            }
        }
        public PubCenterControl(string adName, string appId, string adUnitId, int retryLimit, bool isAutoRefresh)
            : base(adName, (DataTrackingPortal.AdProvider.PubCenter).ToString(), appId, adUnitId, retryLimit, 480, 50, isAutoRefresh)
        {
            InitializeComponent();

            _adControl = new AdControl(appId, adUnitId, isAutoRefresh);

            _adControl.AdRefreshed += (sender, args) => OnAdReceived(this, null);
            _adControl.IsEnabledChanged += (sender, args) => OnAdEngaged(this, null);
            _adControl.ErrorOccurred += (sender, args) => OnAdFailed(this, args.Error.Message);

            LayoutRoot.Children.Add(_adControl);
        }
Beispiel #30
0
        public AdSettings(ref AdControl adControl, ref Image ad_close)
        {
            // Set the PubCenter identifiers
            adControl        = new AdControl(_applicationId, _adUnitId, true);
            adControl.Height = 80;
            adControl.Width  = 480;
            #region Free mode
            if (_mode == Mode.Free)
            {
                //    enable ads
                adControl.IsEnabled             = true;
                adControl.Visibility            = System.Windows.Visibility.Visible;
                adControl.IsAutoCollapseEnabled = true;
                ad_close.Visibility             = Visibility.Visible;
            }
            #endregion

            #region Trial mode
            else if (_mode == Mode.Trial)
            {
                if (App.IsTrial == true)
                {
                    //    enable ads
                    adControl.IsEnabled             = true;
                    adControl.Visibility            = System.Windows.Visibility.Visible;
                    adControl.IsAutoCollapseEnabled = true;
                    ad_close.Visibility             = Visibility.Visible;
                }
                else
                {
                    // disables ads
                    adControl.IsAutoCollapseEnabled = true;
                    adControl.Visibility            = System.Windows.Visibility.Collapsed;
                    adControl.IsEnabled             = false;
                    ad_close.Visibility             = Visibility.Collapsed;
                }
            }
            #endregion

            #region BuyOnly mode
            else if (_mode == Mode.BuyOnly)
            {
                // disables ads
                adControl.IsAutoCollapseEnabled = true;
                adControl.IsEnabled             = false;
                adControl.Visibility            = System.Windows.Visibility.Collapsed;
                ad_close.Visibility             = Visibility.Collapsed;
                //adControl.IsAutoRefreshEnabled = false;
            }
            #endregion
        }
        private void ActivateMicrosoftBanner()
        {
            // Return if you hit the error limit for this refresh interval.
            if (_errorCountCurrentRefresh >= MaxErrorsPerRefresh)
            {
                MyAdGrid.Visibility = Visibility.Collapsed;
                return;
            }

            // Use random number generator and house ads weight to determine whether
            // to use paid ads or house ads. Paid is the default. You could alternatively
            // write a method similar to GetAdDuplexWeight and override by region.
            string myAdUnit    = WadunitidPaid;
            int    houseWeight = HouseAdWeight;
            int    randomInt   = _randomGenerator.Next(0, 100);

            if (randomInt < houseWeight)
            {
                myAdUnit = WadunitidHouse;
            }

            // Hide the AdDuplex control if it is showing.
            if (null != _myAdDuplexBanner)
            {
                _myAdDuplexBanner.Visibility = Visibility.Collapsed;
            }

            // Initialize or display the Microsoft control.
            if (null == _myMicrosoftBanner)
            {
                _myMicrosoftBanner = new AdControl
                {
                    ApplicationId        = Wapplicationid,
                    AdUnitId             = myAdUnit,
                    Width                = AdWidth,
                    Height               = AdHeight,
                    IsAutoRefreshEnabled = false
                };

                _myMicrosoftBanner.AdRefreshed   += myMicrosoftBanner_AdRefreshed;
                _myMicrosoftBanner.ErrorOccurred += myMicrosoftBanner_ErrorOccurred;

                MyAdGrid.Children.Add(_myMicrosoftBanner);
            }
            else
            {
                _myMicrosoftBanner.AdUnitId   = myAdUnit;
                _myMicrosoftBanner.Visibility = Visibility.Visible;
                _myMicrosoftBanner.Refresh();
            }
        }
Beispiel #32
0
        private async void ConfigureAds()
        {
            var adHelper = SimpleIoc.Default.GetInstance <AdHelper>();

            if (!await adHelper.ShowAds())
            {
                return;
            }
            AdControl ad = adHelper.Banner;

            ad.CloseTapped += Ad_CloseTapped;
            LayoutRoot.Children.Add(ad);
            adHelper.BannerParent = LayoutRoot;
        }
Beispiel #33
0
 private void GeneralMainOnPropertyChanged(object sender, PropertyChangedEventArgs args)
 {
     if (args.PropertyName == nameof(ViewModelLocator.GeneralMain.AdsContainerVisibility))
     {
         if (ViewModelLocator.GeneralMain.AdsContainerVisibility)
         {
             AdControl.Resume();
         }
         else
         {
             AdControl.Suspend();
         }
     }
 }
        private void ActivateMicrosoftBanner()
        {
            // Return if you hit the error limit for this refresh interval.
            if (errorCountCurrentRefresh >= MAX_ERRORS_PER_REFRESH)
            {
                myAdGrid.Visibility = Visibility.Collapsed;
                return;
            }

            // Use random number generator and house ads weight to determine whether
            // to use paid ads or house ads. Paid is the default. You could alternatively
            // write a method similar to GetAdDuplexWeight and override by region.
            string myAdUnit    = myMicrosoftPaidUnitId;
            int    houseWeight = HOUSE_AD_WEIGHT;
            int    randomInt   = randomGenerator.Next(0, 100);

            if (randomInt < houseWeight)
            {
                myAdUnit = myMicrosoftHouseUnitId;
            }

            // Hide the AdDuplex control if it is showing.
            if (null != myAdDuplexBanner)
            {
                myAdDuplexBanner.Visibility = Visibility.Collapsed;
            }

            // Initialize or display the Microsoft control.
            if (null == myMicrosoftBanner)
            {
                myMicrosoftBanner = new AdControl();
                myMicrosoftBanner.ApplicationId        = myMicrosoftAppId;
                myMicrosoftBanner.AdUnitId             = myAdUnit;
                myMicrosoftBanner.Width                = AD_WIDTH;
                myMicrosoftBanner.Height               = AD_HEIGHT;
                myMicrosoftBanner.IsAutoRefreshEnabled = false;

                myMicrosoftBanner.AdRefreshed   += myMicrosoftBanner_AdRefreshed;
                myMicrosoftBanner.ErrorOccurred += myMicrosoftBanner_ErrorOccurred;

                myAdGrid.Children.Add(myMicrosoftBanner);
            }
            else
            {
                myMicrosoftBanner.AdUnitId   = myAdUnit;
                myMicrosoftBanner.Visibility = Visibility.Visible;
                myMicrosoftBanner.Refresh();
            }
        }
        public SelectDateRoadTrip()
        {
            InitializeComponent();
            if ((Application.Current as App).IsTrial)
            {

                AdControl control = new AdControl("9ec83715-ac1e-41b5-9b0d-62b3cb52524a", "10063501", true);
                control.Width = 300;
                control.Height = 50;
                control.Margin = new Thickness(0, 50, 0, 0);
                mainPane.Children.Add(control);
            }
            if (settings.Contains("SelectDateRoadTrip_persistence"))
                this.Dp_DateDebut.Value = (DateTime)settings["SelectDateRoadTrip_persistence"];
        }
        public PivotParam()
        {
            InitializeComponent();
            btn_Ok = ApplicationBar.Buttons[0] as ApplicationBarIconButton;
            InitChamps();

            if ((Application.Current as App).IsTrial)
            {

                AdControl control = new AdControl("9ec83715-ac1e-41b5-9b0d-62b3cb52524a", "10063501", true);
                control.Width = 300;
                control.Height = 50;
                pubPane.Children.Insert(0, control);
            }
        }
        public static AdControl CreateNewAd()
        {
            // AD Logic
            // ApplicationID = "Test_client", AdUnitID = "Image480_80",
            // AdModel = Contextual, RotationEnabled = true
            var adControl = new AdControl("db41e494-3528-4b15-9df7-5f006ec1511b", // ApplicationID
                                          "10019326", // AdUnitID
                                          AdModel.Contextual, // AdModel
                                          true); // RotationEnabled
            // Make the AdControl size large enough that it can contain the image.
            adControl.Width = 480;
            adControl.Height = 80;
            adControl.Background = new SolidColorBrush(Colors.Transparent);

            return adControl;
        }
Beispiel #38
0
        private void OnAdEngagedChanged(object sender, RoutedEventArgs e)
        {
            AdControl control = sender as AdControl;

            if (true == control.IsEngaged)
            {
                // Add code here to change behavior while the user engaged with ad.
                // For example, if the app is a game, you might pause the game.
            }
            else
            {
                // Add code here to update app behavior after the user is no longer
                // engaged with the ad. For example, you might unpause a game.
            }

            return;
        }
Beispiel #39
0
        // 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);
            }
        }
 /// <summary>
 /// 加载MSN广告控件
 /// </summary>
 private void LoadMSNAdControl()
 {
     if (_curParentPage != null)
     {
         string adSpaceId = "MNDAyfDYwMnwxOTA0fDE=";
         Thickness adPosition = new Thickness();//定义广告banner的位置。
         adPosition.Left = 0;
         adPosition.Top = 0;
         adPosition.Right = 0;
         adPosition.Bottom = 0;
         AdControl adControl = new AdControl(_curParentPage);
         adControl.InitAd(adPosition, adSpaceId);//初始化广告banner
         Grid.SetRow(adControl, 0);
         LayoutRoot.Children.Add(adControl);//注意:不要忘了将广告banner加到应用程序中。
         adControl.LoadAd();//开始请求广告
     }
 }
Beispiel #41
0
        void CreateAdControl(AdSizes adSize, string adUnitID)
        {
            bannerView = new AdControl();
            switch (adSize)
            {
            case AdSizes.StandardBanner:
                bannerView.Width  = 320;
                bannerView.Height = 50;
                break;

            case AdSizes.LargeBanner:
                bannerView.Width  = 320;
                bannerView.Height = 50;
                break;

            case AdSizes.MediumRectangle:
                bannerView.Width  = 300;
                bannerView.Height = 250;
                break;

            case AdSizes.FullBanner:
                bannerView.Width  = 480;
                bannerView.Height = 80;
                break;

            case AdSizes.Leaderboard:
                bannerView.Width  = 728;
                bannerView.Height = 90;
                break;

            case AdSizes.SmartBanner:
                bannerView.Width  = 320;
                bannerView.Height = 50;
                break;

            default:
                bannerView.Width  = 320;
                bannerView.Height = 50;
                break;
            }

            bannerView.ApplicationId = UsefulStuff.UWP_AdAppID;
            bannerView.AdUnitId      = adUnitID;
            bannerView.AutoRefreshIntervalInSeconds = 6;
        }
Beispiel #42
0
        public override UIElement CreateControl()
        {
            base.CreateControl();

            _control = new AdControl()
            {
                Name = "adduplexSytem",
                Width = this.Width,
                Height = this.Height,
                AppId = this.AppID,
                RefreshInterval = 20
            };

            (_control as AdControl).AdLoaded += AdduplexSystem_AdLoaded;
            (_control as AdControl).AdLoadingError += AdduplexSystem_AdLoadingError;

            return _control;
        }
Beispiel #43
0
        /// <summary>
        /// Erstellt einen neuen Werbeblock
        /// </summary>
        internal static AdControl CreateAdControl(string adUnitId)
        {
            AdControl adControl = new AdControl();
            adControl.Height = 80; adControl.Width = 480;

            if (System.Diagnostics.Debugger.IsAttached)
            {
                adControl.ApplicationId = "test_client";
                adControl.AdUnitId = "Image480_80";
            }
            else
            {
                adControl.ApplicationId = "15808e38-d8c7-42b3-b1d8-790dbe8a640a";
                adControl.AdUnitId = adUnitId;
            }

            return adControl;
        }
        public override UIElement CreateControl()
        {
            base.CreateControl();

            _control = new AdControl()
            {
                Name = "pubcenterSystem",
                Width = this.Width,
                Height = this.Height,
                AdUnitId = this.AdUnitID,
                ApplicationId = this.ApplicationID,
                IsAutoRefreshEnabled = false
            };

            (_control as AdControl).AdRefreshed += PubcenterSystem_AdRefreshed;
            (_control as AdControl).ErrorOccurred += PubcenterSystem_ErrorOcurred;

            return _control;
        }
Beispiel #45
0
        public MainPage()
        {
            InitializeComponent();
            PanoramaItem eventsPage = new PanoramaItem() { Name = "eventsPage", Header = "Upcoming" };
            PanoramaItem artistsPage = new PanoramaItem() { Name = "artistsPage", Header = "Artists" };
            PanoramaItem venuesPage = new PanoramaItem() { Name = "venuesPage", Header = "Venues" };
            mainView.Items.Add(eventsPage);
            mainView.Items.Add(artistsPage);
            mainView.Items.Add(venuesPage);

            AdControl concertsAd = new AdControl() { ApplicationId = "33c7fa47-c859-47f1-8903-f745bf749ce0", AdUnitId = "10016302", Width = 300, Height = 50, Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.White), Background = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Black) };
            LayoutRoot.Children.Add(concertsAd);
            Grid.SetRow(concertsAd, 1);

            ApplicationBar = new ApplicationBar();
            ApplicationBar.IsMenuEnabled = true;
            ApplicationBar.IsVisible = true;
            ApplicationBar.Opacity = 1.0;

            events = new List<Event>();
            artists = new List<Artist>();
            venues = new List<Venue>();

            eventsStorageHelper = new StorageHelper<Event>("Events.xml", "Stale.txt");
            artistsStorageHelper = new StorageHelper<Artist>("Artists.xml");
            venuesStorageHelper = new StorageHelper<Venue>("Venues.xml");

            ApplicationBarIconButton refresh = new ApplicationBarIconButton(new Uri("/Icons/appbar.refresh.rest.png", UriKind.Relative));
            refresh.Text = "refresh";
            refresh.Click += new EventHandler(refresh_Click);

            ApplicationBarIconButton settings = new ApplicationBarIconButton(new Uri("/Icons/appbar.feature.settings.rest.png", UriKind.Relative));
            settings.Text = "settings";
            settings.Click += new EventHandler(settings_Click);

            ApplicationBar.Buttons.Add(refresh);
            ApplicationBar.Buttons.Add(settings);

            ApplicationBar.BackgroundColor = System.Windows.Media.Colors.Black;
            ApplicationBar.ForegroundColor = System.Windows.Media.Colors.White;

            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        }
        // 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);
            }
        }
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            AdControl adcontrol = new AdControl()
                {
                    ApplicationId = "test_client",
                    AdUnitId = "TextAd",
                    Width = 480,
                    Height = 80,
                    IsAutoRefreshEnabled = true,
                    IsAutoCollapseEnabled = true,
                    CountryOrRegion = CultureInfo.CurrentCulture.TwoLetterISOLanguageName
                };
            adcontrol.ErrorOccurred += AdControl_OnErrorOccurred;
            adcontrol.AdRefreshed += AdControl_OnAdRefreshed;
            adcontrol.IsEngagedChanged += adcontrol_IsEngagedChanged;

            this.AdsStackPanel.Children.Add(adcontrol);
        }
 private void ResetAdControl()
 {
     try
     {
         // show ad control?
         var viewModel = this.DataContext as MainViewModel;
         var adUnitId = viewModel.Settings.AdInfo.AdUnitId;
         var applicationId = viewModel.Settings.AdInfo.ApplicationId;
         if (adUnitId != null && applicationId != null && adUnitId.Length > 0 && applicationId.Length > 0)
         {
             AdControl ad = new AdControl()
             {
                 ApplicationId = applicationId,
                 AdUnitId = adUnitId,
                 Height = 80,
                 Width = 480,
                 IsEnabled = true,
                 IsAutoRefreshEnabled = true,
                 IsAutoCollapseEnabled = true,
             };
             LayoutRoot.Children.Add(ad);
             Grid.SetRow(ad, 2);
         }
     }
     catch
     {
         if (System.Diagnostics.Debugger.IsAttached)
         {
             // Something is wrong with the ad control
             // common causes of this problem include:
             //      - did you forget to upgrade the version number on your updated deployment?
             //      - did you set an invalid ApplicationId and/or AdUnitId in your settings.xml file?
             System.Diagnostics.Debugger.Break();
         }
     }
 }
Beispiel #49
0
        /*private Dictionary<String, BitmapImage> barImages = new Dictionary<String, BitmapImage>()
        {
            {"minusFull", new BitmapImage(new Uri("bar/minusFull.png", UriKind.Relative))},
            {"minusThree", new BitmapImage(new Uri("bar/minusThree.png", UriKind.Relative))},
            {"minusTwo", new BitmapImage(new Uri("bar/minusTwo.png", UriKind.Relative))},
            {"minusOne", new BitmapImage(new Uri("bar/minusOne.png", UriKind.Relative))},
            {"stale", new BitmapImage(new Uri("bar/stale.png", UriKind.Relative))},
            {"plusOne", new BitmapImage(new Uri("bar/plusOne.png", UriKind.Relative))},
            {"plusTwo", new BitmapImage(new Uri("bar/plusTwo.png", UriKind.Relative))},
            {"plusThree", new BitmapImage(new Uri("bar/plusThree.png", UriKind.Relative))},
            {"plusFull", new BitmapImage(new Uri("bar/plusFull.png", UriKind.Relative))},
            {"minus", new BitmapImage(new Uri("bar/minus.png", UriKind.Relative))},
            {"plus", new BitmapImage(new Uri("bar/plus.png", UriKind.Relative))},
            {"minusPressed", new BitmapImage(new Uri("bar/minusPressed.png", UriKind.Relative))},
            {"plusPressed", new BitmapImage(new Uri("bar/plusPressed.png", UriKind.Relative))}
        };*/
        public MainPage()
        {
            InitializeComponent();

            AdControl hypeMachineAd = new AdControl() { ApplicationId = "4d3667ee-44c1-494c-929d-5e661b011918", AdUnitId = "10019312"};
            LayoutRoot.Children.Add(hypeMachineAd);
            Grid.SetRow(hypeMachineAd, 1);

            Assets.Instance.Create("PivotBackground", new BitmapImage(new Uri("backgrounds/PivotBackground.png", UriKind.Relative)));
            Assets.Instance.Create("PivotBackgroundDark", new BitmapImage(new Uri("backgrounds/PivotBackgroundDark.png", UriKind.Relative)));

            if (((Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible))
            {
                mainView.Background = new ImageBrush() { ImageSource = Assets.Instance.ReadBitmapImage("PivotBackgroundDark"), Stretch = Stretch.None };
                mainView.Foreground = new SolidColorBrush(Colors.White);
            }
            else
            {
                mainView.Background = new ImageBrush() { ImageSource = Assets.Instance.ReadBitmapImage("PivotBackground"), Stretch = Stretch.None };
                mainView.Foreground = new SolidColorBrush(Colors.Black);
            }

            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        }
        public void updateUi()
        {
            foreach (string name in EnumHelper.GetEnumStrings<MeasurementType>())
            {
                PanoramaItem mainPanoramaPage = new PanoramaItem() { Name = "mainPanoramaPage" + name, Header = name, Foreground = new SolidColorBrush(Colors.Black) };

                ScrollViewer scrollViewer = new ScrollViewer() { Name = "scrollViewer" + name, VerticalScrollBarVisibility = ScrollBarVisibility.Hidden};

                StackPanel innerStackPanel = new StackPanel() { Name = "innerStackPanel" + name };

                TextBlock fromTextBlock = new TextBlock() { Name = "fromTextBlock" + name, Text = "from" };

                TextBox inputTextBox = new TextBox() { Name = "inputTextBox" + name };
                inputTextBox.TextChanged += new TextChangedEventHandler(textChangedHandler);
                InputScopeNameValue numbersOnly = InputScopeNameValue.TelephoneNumber;
                inputTextBox.InputScope = new InputScope()
                {
                    Names = { new InputScopeName() { NameValue = numbersOnly } }
                };

                DataTemplate fromFullModeItemTemplate = (DataTemplate)XamlReader.Load("<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'><TextBlock Text=\"{Binding Name}\" FontSize=\"64\"/></DataTemplate>");
                DataTemplate fromItemTemplate = (DataTemplate)XamlReader.Load("<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'><TextBlock Text=\"{Binding Name}\"/></DataTemplate>");

                ListPicker fromListPicker = new ListPicker { Name = "fromListPicker" + name, FullModeItemTemplate = fromFullModeItemTemplate, ItemTemplate = fromItemTemplate };
                foreach (MeasurementUnit measurementUnit in measurementUnits)
                {
                    if (measurementUnit.Type.ToString().Equals(name, StringComparison.OrdinalIgnoreCase))
                    {
                        fromListPicker.Items.Add(measurementUnit);
                    }
                }
                fromListPicker.SelectionChanged += new SelectionChangedEventHandler(selectionChangedHandler);

                TextBlock toTextBlock = new TextBlock() { Name = "toTextBlock" + name, Text = "to" };

                DataTemplate toFullModeItemTemplate = (DataTemplate)XamlReader.Load("<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'><TextBlock Text=\"{Binding Name}\" FontSize=\"64\"/></DataTemplate>");
                DataTemplate toItemTemplate = (DataTemplate)XamlReader.Load("<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'><TextBlock Text=\"{Binding Name}\"/></DataTemplate>");

                ListPicker toListPicker = new ListPicker { Name = "toListPicker" + name, FullModeItemTemplate = toFullModeItemTemplate, ItemTemplate = toItemTemplate };
                foreach (MeasurementObject measurementObject in measurementObjects)
                {
                    if (measurementObject.Type.ToString().Equals(name, StringComparison.OrdinalIgnoreCase))
                    {
                        toListPicker.Items.Add(measurementObject);
                    }
                }
                toListPicker.SelectionChanged += new SelectionChangedEventHandler(selectionChangedHandler);

                TextBlock isAboutTextBlock = new TextBlock() { Name = "isAboutTextBlock" + name, Text = "is about", Visibility = System.Windows.Visibility.Collapsed };

                TextBlock resultTextBlock = new TextBlock() { Name = "resultTextBlock" + name, FontSize = 64, TextAlignment = System.Windows.TextAlignment.Center, Visibility = System.Windows.Visibility.Collapsed, TextWrapping = TextWrapping.Wrap };

                AdControl ad = new AdControl() { ApplicationId = "bb68fbc1-ad47-45b2-b045-0d5699d83b6b", AdUnitId = "10016008", Width = 300, Height = 50, Margin = new Thickness(20) };

                innerStackPanel.Children.Add(fromTextBlock);
                innerStackPanel.Children.Add(inputTextBox);
                innerStackPanel.Children.Add(fromListPicker);
                innerStackPanel.Children.Add(toTextBlock);
                innerStackPanel.Children.Add(toListPicker);
                innerStackPanel.Children.Add(isAboutTextBlock);
                innerStackPanel.Children.Add(resultTextBlock);
                innerStackPanel.Children.Add(ad);

                scrollViewer.Content = innerStackPanel;

                mainPanoramaPage.Content = scrollViewer;

                mainView.Items.Add(mainPanoramaPage);
            }
        }
Beispiel #51
0
 public AboutUserControl(AdControl ad)
 {
     InitializeComponent();
     _ad = ad;
     ad.Visibility = Visibility.Collapsed;
 }
        async void ItemsShowcaseView_Loaded(object sender, RoutedEventArgs e)
        {

            //Cache loads so fast if called from constructor that property changed is not fired
            if (groupedItemsViewSource.View != null && groupedItemsViewSource.View.CollectionGroups != null)
                ZoomedOutGroupGridView.ItemsSource = groupedItemsViewSource.View.CollectionGroups;

            if (!AppState.Windows8ItemsShowcaseViewInitialized)
            {
                ((ItemsShowcaseViewModel)DataContext).PropertyChanged += vm_PropertyChanged;

                Windows.ApplicationModel.Search.SearchPane.GetForCurrentView().QuerySubmitted += searchPane_QuerySubmitted;
                Windows.ApplicationModel.Search.SearchPane.GetForCurrentView().ShowOnKeyboardInput = true;

                //This is a one-time execuction block, so we can test simulating a purchase here 
                if (AppSettings.EnablePubcenterAdsWin8)
                {
                    if (AppSettings.HideAdsIfPurchasedWin8)
                    {
                        #if DEBUG
                        await simulateAppPurchase();
                        var licenseInfo = Windows.ApplicationModel.Store.CurrentAppSimulator.LicenseInformation;
                        #else
                        var licenseInfo = Windows.ApplicationModel.Store.CurrentApp.LicenseInformation;
                        #endif
                        if (!licenseInfo.IsTrial)
                            return;
                    }
                    var adControl = new AdControl();
                    adControl.ApplicationId = AppSettings.PubcenterApplicationIdWin8;
                    adControl.AdUnitId = AppSettings.PubcenterAdUnitIdWin8;
                    adControl.IsAutoRefreshEnabled = true;
                    adControl.Width = 728;
                    adControl.Height = 90;
                    adControl.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Right;
                    ShowcaseGrid.Children.Add(adControl);
                }

                AppState.Windows8ItemsShowcaseViewInitialized = true;
            }
        }
        public void updateUi()
        {
            IsolatedStorageFileStream file = new IsolatedStorageFileStream("coin.xml", FileMode.Open, IsolatedStorageFile.GetUserStoreForApplication());
            XDocument doc = XDocument.Load(file);
            file.Close();

            XElement root = (from cur in doc.Descendants("{http://www.ecb.int/vocabulary/2002-08-01/eurofxref}Cube") select cur).FirstOrDefault();
            XElement subroot = root.Elements().FirstOrDefault();

            foreach (XElement currency in subroot.DescendantNodes())
            {
                String name = currency.Attribute("currency").Value;
                if (!filter.Contains(name.ToLower()))
                {
                    continue;
                }

                float value;
                if (float.TryParse(currency.Attribute("rate").Value, out value))
                {
                    currencies.Add(name, value);
                }
            }

            for (int i = 0; i < currencies.Count; i++)
            {
                String fromName = currencies.ElementAt(i).Key.ToString();
                String fromValue = currencies.ElementAt(i).Value.ToString();

                PanoramaItem temp = new PanoramaItem() { Header = fromName, Name = "panoramaItem" + fromName};

                Grid innerGrid = new Grid() { Name = "innerGrid" + fromName};
                innerGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(80)});
                innerGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(290)});
                innerGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(100, GridUnitType.Auto)});

                TextBox tempTextBox = new TextBox() { Name = fromName };
                tempTextBox.TextChanged += new TextChangedEventHandler(textChangedHandler);
                InputScopeNameValue numbersOnly = InputScopeNameValue.TelephoneNumber;
                tempTextBox.InputScope = new InputScope()
                {
                    Names = {new InputScopeName() {NameValue = numbersOnly}}
                };

                innerGrid.Children.Add(tempTextBox);
                Grid.SetRow(tempTextBox, 0);

                ScrollViewer tempScroll = new ScrollViewer() { Name = "scroll" + fromName };
                Grid tempGrid = new Grid();
                int rowIndex = 0;
                for (int j = 0; j < currencies.Count; j++)
                {
                    if (i != j)
                    {
                        tempGrid.RowDefinitions.Add(new RowDefinition());
                        StackPanel tempStack = new StackPanel()
                        {
                            Orientation = System.Windows.Controls.Orientation.Horizontal
                        };
                        Image tempImage = new Image()
                        {
                            Source = new BitmapImage(new Uri("../images/" + currencies.ElementAt(j).Key.ToString() + ".png", UriKind.Relative)),
                            Stretch=Stretch.Fill,
                            Width= 70,
                            Height=45,
                            Margin = new Thickness(10)
                        };
                        tempStack.Children.Add(tempImage);

                        TextBlock tempText = new TextBlock() { Name = "textBlockFrom" + fromName + "For" + currencies.ElementAt(j).Key.ToString(), Text = currencies.ElementAt(j).Key.ToString() + " = ...", FontSize = 42 };
                        tempStack.Children.Add(tempText);
                        tempGrid.Children.Add(tempStack);
                        Grid.SetRow(tempStack, rowIndex);

                        rowIndex++;
                    }
                }
                tempScroll.Content = tempGrid;

                innerGrid.Children.Add(tempScroll);
                Grid.SetRow(tempScroll, 1);

                temp.Content = innerGrid;
                RootView.Items.Add(temp);

                AdControl.TestMode = false;
                //ApplicationID = "4fd1b245-b648-44de-add5-1a6408f4618a", AdUnitID = "10016135",
                //AdModel = Contextual, RotationEnabled = true
                AdControl adControl = new AdControl("4fd1b245-b648-44de-add5-1a6408f4618a", // ApplicationID
                                                    "10016135",    // AdUnitID
                                                    AdModel.Contextual, // AdModel
                                                    true);         // RotationEnabled
                // Make the AdControl size large enough that it can contain the image
                adControl.Width = 300;
                adControl.Height = 80;

                innerGrid.Children.Add(adControl);
                Grid.SetRow(adControl, rowIndex++);
            }
        }
Beispiel #54
0
        public Intro()
        {
            InitializeComponent();

            AdControl hypeMachineAd = new AdControl() { ApplicationId = "4d3667ee-44c1-494c-929d-5e661b011918", AdUnitId = "10019312" };
            LayoutRoot.Children.Add(hypeMachineAd);
            Grid.SetRow(hypeMachineAd, 1);

            Assets.Instance.Create("IntroBackground", new BitmapImage(new Uri("backgrounds/IntroBackground.png", UriKind.Relative)));
            Assets.Instance.Create("IntroBackgroundDark", new BitmapImage(new Uri("backgrounds/IntroBackgroundDark.png", UriKind.Relative)));

            if (((Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible))
            {
                mainView.Background = new ImageBrush() { ImageSource = Assets.Instance.ReadBitmapImage("IntroBackgroundDark"), Stretch = Stretch.None };
                mainView.Foreground = new SolidColorBrush(Colors.White);
            }
            else
            {
                mainView.Background = new ImageBrush() { ImageSource = Assets.Instance.ReadBitmapImage("IntroBackground"), Stretch = Stretch.None };
                mainView.Foreground = new SolidColorBrush(Colors.Black);
            }

            Assets.Instance.Create("robot", new BitmapImage(new Uri("intro/robot.png", UriKind.Relative)));

            List<Entry> firstPageEntries = new List<Entry>()
            {
                new Entry("WHAT?", "hype machine is a simple app that lets you see which upcoming video games people are most excited about.", "robot"),
                new Entry("WHY?", "with new titles coming out all the time, it's important that we gamers work together to seperate the great from the 'OH GOD NO!'.", "robot"),
                new Entry("WHO?", "you! well, not only you, infact there are many other users for you to interact with... but you're our favorite!.", "robot")
            };
            Section firstPage = new Section("SUP NOOB!", "thanks for downloading.", firstPageEntries, (Color)Resources["PhoneForegroundColor"], (Color)Resources["PhoneBackgroundColor"], true);

            List<Entry> secondPageEntries = new List<Entry>()
            {
                new Entry("WHAT?", "hype machine is a simple app that lets you see which upcoming video games people are most excited about.", "robot"),
                new Entry("WHY?", "with new titles coming out all the time, it's important that we gamers work together to seperate the great from the 'OH GOD NO!'.", "robot"),
                new Entry("WHO?", "you! well, not only you, infact there are many other users for you to interact with... but you're our favorite!.", "robot")
            };
            Section secondPage = new Section("HYPE", "equivalent to 4 redbulls.", secondPageEntries, (Color)Resources["PhoneBackgroundColor"], (Color)Resources["PhoneForegroundColor"], false);

            List<Entry> thirdPageEntries = new List<Entry>()
            {
                new Entry("WHAT?", "hype machine is a simple app that lets you see which upcoming video games people are most excited about.", "robot"),
                new Entry("WHY?", "with new titles coming out all the time, it's important that we gamers work together to seperate the great from the 'OH GOD NO!'.", "robot"),
                new Entry("WHO?", "you! well, not only you, infact there are many other users for you to interact with... but you're our favorite!.", "robot")
            };
            Section thirdPage = new Section("AFTERMATH", "equivalent to 4 redbulls.", thirdPageEntries, (Color)Resources["PhoneForegroundColor"], (Color)Resources["PhoneBackgroundColor"], true);

            List<Entry> fourthPageEntries = new List<Entry>()
            {
                new Entry("WHAT?", "hype machine is a simple app that lets you see which upcoming video games people are most excited about.", "robot"),
                new Entry("WHY?", "with new titles coming out all the time, it's important that we gamers work together to seperate the great from the 'OH GOD NO!'.", "robot"),
                new Entry("WHO?", "you! well, not only you, infact there are many other users for you to interact with... but you're our favorite!.", "robot")
            };
            Section fourthPage = new Section("COMMENTS", "equivalent to 4 redbulls.", fourthPageEntries, (Color)Resources["PhoneBackgroundColor"], (Color)Resources["PhoneForegroundColor"], false);

            mainView.Items.Add(panoramaItemFromSection(firstPage));
            mainView.Items.Add(panoramaItemFromSection(secondPage));
            mainView.Items.Add(panoramaItemFromSection(thirdPage));
            mainView.Items.Add(panoramaItemFromSection(fourthPage));

            this.Loaded += new RoutedEventHandler(Intro_Loaded) ;
        }
        public MenuPrin()
        {
            InitializeComponent();
            if (App.IsConnected())
            {
                tb_PasDeConnection.Visibility = Visibility.Collapsed;
                _IsConnected = true;
            }
            else
            {
                tb_PasDeConnection.Visibility = Visibility.Visible;
                _IsConnected = false;
            }
            try
            {
                firstStart = (bool)settings["PremierLancement"];

            }
            catch
            {
                settings.Add("PremierLancement", (bool)false);
                settings.Add("Carburant", (int)1);
                settings.Add("ConsoCarburant", (double)6.5);
                settings.Add("AdrMail", (string)"");
                settings.Add("AdrDepart", (string)"");
                settings.Add("VilleDepart", (string)"");
                settings.Add("longiAdrDepart", (double)0);
                settings.Add("latiAdrDepart", (double)0);
                settings.Add("AdrArriver", (string)"");
                settings.Add("VilleArriver", (string)"");
                settings.Add("longiAdrArriver", (double)0);
                settings.Add("latiAdrArriver", (double)0);
                settings.Add("ActiveNotif", (bool)true);
                settings.Add("PrixCarburant", (double)1.45);
                settings.Add("Utilisateur", "Inconnue");
                settings.Add("LieuRef", "");
                settings.Add("Date", (DateTime)DateTime.Today);
                settings.Add("DateFin", (DateTime)DateTime.Today);
                settings.Add("ListRoadeMap", (List<RoadMap>)null);
            }

            if ((Application.Current as App).IsTrial)
            {

                AdControl control = new AdControl("9ec83715-ac1e-41b5-9b0d-62b3cb52524a", "10063501", true);
                control.Width = 300;
                control.Height = 50;
                control.ErrorOccurred += control_ErrorOccurred;
                pubPane.Children.Insert(0, control);

                ApplicationBar.IsVisible = true;
                panorama.Title = "Version Gratuite";
                btn_EditionCsv.IsEnabled = false;
                btn_EditionCsv.BorderThickness = new Thickness(5);
                btn_EditionCsv.Background = new SolidColorBrush(Colors.LightGray);
                //tbTrialStatus.Text = "Trial";
                
            }
            else
            {
                //mainPane.Header = "Version Pro";
                ApplicationBar.IsVisible = false;
                btn_EditionCsv.IsEnabled = true;
                //tbTrialStatus.Text = "Full";
            }
        }
        private void LoadAds()
        {
            //ad on about page
            var aboutAd = new AdControl(Constants.StoreAppId, "MainPageBottomAd", true)
            {
                Height = 50,
                Width = 350
            };
            AboutAdControl.Children.Add(aboutAd);

            //ad on reminder settings page
            var reminderSettingsAd = new AdControl(Constants.StoreAppId, "MainPageBottomAd", true)
            {
                Height = 50,
                Width = 350
            };
            ReminderSettingsAdControl.Children.Add(reminderSettingsAd);

            var wishesAd = new AdControl(Constants.StoreAppId, "MainPageBottomAd", true)
            {
                Height = 50,
                Width = 350
            };
            WishesAdControl.Children.Add(wishesAd);

            var profileAd = new AdControl(Constants.StoreAppId, "MainPageBottomAd", true)
            {
                Height = 50,
                Width = 350
            };
            ProfileAdControl.Children.Add(profileAd);
        }
		private async void disposeAsync()
		#endif
		{
			#if WINDOWS_PHONE
			WinRTPlugin.Dispatcher.BeginInvoke(delegate()
			#else
			await WinRTPlugin.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate()
			#endif
			{
				if (adControl != null)
				{
					adControl.IsEnabled = false;
					WinRTPlugin.AdGrid.Children.Remove(adControl);
					adControl = null;
				}

				if (manualRefreshTimer != null)
				{
					manualRefreshTimer.Stop();
					manualRefreshTimer.Tick -= timer_Tick;
					manualRefreshTimer = null;
				}
			});
		}
		private async void init(AdDesc desc, AdCreatedCallbackMethod createdCallback)
		#endif
		{
			if (WinRTPlugin.AdGrid == null)
			{
				if (createdCallback != null) createdCallback(false);
				return;
			}

			#if WINDOWS_PHONE
			WinRTPlugin.Dispatcher.BeginInvoke(delegate()
			#else
			await WinRTPlugin.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate()
			#endif
			{
				bool pass = true;
				try
				{
					adControl = new AdControl();
					#if WINDOWS_PHONE || UNITY_WP_8_1
					adControl.IsAutoRefreshEnabled = desc.WP8_MicrosoftAdvertising_UseBuiltInRefresh;
					if (!desc.WP8_MicrosoftAdvertising_UseBuiltInRefresh)
					{
						manualRefreshTimer = new DispatcherTimer();
						manualRefreshTimer.Interval = TimeSpan.FromSeconds(desc.WP8_MicrosoftAdvertising_RefreshRate);
						manualRefreshTimer.Tick += timer_Tick;
						manualRefreshTimer.Start();
					}

					adControl.IsEngagedChanged += adControl_IsEngagedChanged;
					adControl.AdRefreshed += adControl_AdRefreshed;
					#else
					adControl.IsAutoRefreshEnabled = desc.WinRT_MicrosoftAdvertising_UseBuiltInRefresh;
					if (!desc.WinRT_MicrosoftAdvertising_UseBuiltInRefresh)
					{
						manualRefreshTimer = new DispatcherTimer();
						manualRefreshTimer.Interval = TimeSpan.FromSeconds(desc.WinRT_MicrosoftAdvertising_RefreshRate);
						manualRefreshTimer.Tick += timer_Tick;
						manualRefreshTimer.Start();
					}

					adControl.IsEngagedChanged += adControl_IsEngagedChanged;
					adControl.AdRefreshed += adControl_AdRefreshed;
					#endif

					adControl.ErrorOccurred += adControl_ErrorOccurred;
					#if WINDOWS_PHONE
					adControl.SetValue(System.Windows.Controls.Canvas.ZIndexProperty, 98);
					#else
					adControl.SetValue(Windows.UI.Xaml.Controls.Canvas.ZIndexProperty, 98);
					#endif
			
					#if WINDOWS_PHONE || UNITY_WP_8_1
					adControl.ApplicationId = desc.Testing ? "test_client" : desc.WP8_MicrosoftAdvertising_ApplicationID;
					adControl.AdUnitId = desc.WP8_MicrosoftAdvertising_UnitID;
					switch (desc.WP8_MicrosoftAdvertising_AdSize)
					{
						case WP8_MicrosoftAdvertising_AdSize.Wide_640x100:
							adControl.Width = 640;
							adControl.Height = 100;
							if (desc.Testing) adControl.AdUnitId = "Image640_100";
							break;

						case WP8_MicrosoftAdvertising_AdSize.Wide_480x80:
							adControl.Width = 480;
							adControl.Height = 80;
							if (desc.Testing) adControl.AdUnitId = "Image480_80";
							break;

						case WP8_MicrosoftAdvertising_AdSize.Wide_320x50:
							adControl.Width = 320;
							adControl.Height = 50;
							if (desc.Testing) adControl.AdUnitId = "Image320_50";
							break;

						case WP8_MicrosoftAdvertising_AdSize.Wide_300x50:
							adControl.Width = 300;
							adControl.Height = 50;
							if (desc.Testing) adControl.AdUnitId = "Image300_50";
							break;

						default:
							Debug.LogError("AdPlugin: Unsuported Ad size");
							break;
					}
					#elif UNITY_METRO
					adControl.ApplicationId = desc.Testing ? "d25517cb-12d4-4699-8bdc-52040c712cab" : desc.WinRT_MicrosoftAdvertising_ApplicationID;
					adControl.AdUnitId = desc.WinRT_MicrosoftAdvertising_UnitID;
					switch (desc.WinRT_MicrosoftAdvertising_AdSize)
					{
						case WinRT_MicrosoftAdvertising_AdSize.Tall_160x600:
							adControl.Width = 160;
							adControl.Height = 600;
							if (desc.Testing) adControl.AdUnitId = "10043134";
							break;

						case WinRT_MicrosoftAdvertising_AdSize.Tall_300x600:
							adControl.Width = 300;
							adControl.Height = 600;
							if (desc.Testing) adControl.AdUnitId = "10043030";
							break;

						case WinRT_MicrosoftAdvertising_AdSize.Wide_300x250:
							adControl.Width = 300;
							adControl.Height = 250;
							if (desc.Testing) adControl.AdUnitId = "10043008";
							break;

						case WinRT_MicrosoftAdvertising_AdSize.Wide_728x90:
							adControl.Width = 728;
							adControl.Height = 90;
							if (desc.Testing) adControl.AdUnitId = "10042998";
							break;

						case WinRT_MicrosoftAdvertising_AdSize.Square_250x250:
							adControl.Width = 250;
							adControl.Height = 250;
							if (desc.Testing) adControl.AdUnitId = "10043105";
							break;

						default:
							Debug.LogError("AdPlugin: Unsuported Ad size");
							break;
					}
					#endif

					#if WINDOWS_PHONE || UNITY_WP_8_1
					setGravity(desc.WP8_MicrosoftAdvertising_AdGravity);
					#else
					setGravity(desc.WinRT_MicrosoftAdvertising_AdGravity);
					#endif
					
					eventCallback = desc.EventCallback;
					WinRTPlugin.AdGrid.Children.Add(adControl);
					setVisible(desc.Visible);
					Debug.Log("Created Ad of ApplicationID: " + adControl.ApplicationId + " AdUnitID" + adControl.AdUnitId);
				}
				catch (Exception e)
				{
					adControl = null;
					Debug.LogError(e.Message);
				}

				ReignServices.InvokeOnUnityThread(delegate
				{
					if (createdCallback != null) createdCallback(pass);
				});
			});
		}
 private void SetNextAdsRefresh(AdControl adControl, int rateInSecond)
 {
     if (Config.IsRefreshOn)
     {
         var adsTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(rateInSecond) };
         adsTimer.Tick += (sender, args) =>
         {
             adControl.Refresh();
             adsTimer.Stop();
         };
         adsTimer.Start();
     }
 }
Beispiel #60
0
        internal void LoadInfo()
        {
            ProcessHelper ph = new ProcessHelper();
            ph.ProcessInfo(wupdater.Info, wupdater.Periodo);

            pivot.Items.Clear();
            foreach (var Dia in ph.Semana)
            {
                PivotItem aba = new PivotItem
                {
                    Header = Dia.NomeDoDia()
                };

                ScrollViewer sv_dia = new ScrollViewer();

                StackPanel stack_refeicoes = new StackPanel();
                sv_dia.Content = stack_refeicoes;

                TextBlock data = new TextBlock
                {
                    Text = string.Format("Dia {0}/{1}", Dia.Data.Day, Dia.Data.Month)
                };
                stack_refeicoes.Children.Add(data);

                if (!String.IsNullOrEmpty(Dia.Desjejum))
                    AdicionaRefeicao(Dia, stack_refeicoes, Refeicao.Desjejum);

                if (!String.IsNullOrEmpty(Dia.Almoco))
                    AdicionaRefeicao(Dia, stack_refeicoes, Refeicao.Almoço);

                if (!String.IsNullOrEmpty(Dia.Jantar))
                    AdicionaRefeicao(Dia, stack_refeicoes, Refeicao.Jantar);

                sv_dia.Style = (Style)App.Current.Resources["AbaDiaDaSemana"];
                aba.Content = sv_dia;

                pivot.Items.Add(aba);

                if (Dia.Data.DayOfWeek == DateTime.Today.DayOfWeek)
                {
                    pivot.SelectedItem = aba;

                    AdControl ad = new AdControl("74e1a034-5680-4210-808c-52463e8bbcf1", "162701", true)
                    {
                        IsAutoCollapseEnabled = true,
                        Margin = new Thickness(12),
                        Width = 300,
                        Height = 50
                    };

            #if DEBUG
                    ad.ErrorOccurred += ad_ErrorOccurred;
            #endif

                    stack_refeicoes.Children.Add(ad);
                }
            }
        }