示例#1
0
        private async void WatchAnAd()
        {
            if (!InternetConnectivityHelper.IsInternetConnected)
            {
                await NotifyAndDeselect("Seems you don't have an internet connection. Thanks for the support, though!");

                return;
            }
            StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();

            InterstitialAd ad         = new InterstitialAd();
            string         myAppId    = "9nblggh42srx";
            string         myAdUnitId = "11701839";

            ad.Keywords = "music,software,apps";
            ad.AdReady += async(r, a) =>
            {
                if (InterstitialAdState.Ready == ad.State)
                {
                    logger.Log("WatchAnAdStarted");
                    ad.Show();
                    await SharedLogic.Instance.NotificationManager.ShowMessageBoxAsync("Please click at least one link to help me more! Thanks!", "Thank you so much!");
                }
            };
            ad.Completed += async(r, a) =>
            {
                logger.Log("WatchAnAdCompleted");
                await NotifyAndDeselect("Thanks!");
            };
            ad.Cancelled += async(r, a) =>
            {
                await NotifyAndDeselect("No worries!");
            };
            int retryCount = 0;

            ad.ErrorOccurred += async(r, a) =>
            {
                if (retryCount < 2)
                {
                    retryCount++;
                    await NotifyAndDeselect("Aw! An error occured. Trying something else. Please wait.");

                    myAdUnitId = "1100000276";
                    ad.RequestAd(AdType.Display, myAppId, myAdUnitId);
                }
                else
                {
                    await NotifyAndDeselect("Aw! An error occured. Thanks anyway.");
                }
            };
            ad.RequestAd(AdType.Video, myAppId, myAdUnitId);
            await NotifyAndDeselect("Please continue. The ad will be shown shortly.");

            async Task NotifyAndDeselect(string message)
            {
                await SharedLogic.Instance.NotificationManager.ShowMessageAsync(message);

                SplitViewMenu.SelectPrevious();
            }
        }
示例#2
0
        public HomePage()
        {
            // Kiran Adunit data
            var MyAppID    = "9nblggh5lnwp";
            var MyAdUnitId = "11670868";

            //test Adunit data
            // var MyAppID = "d25517cb-12d4-4699-8bdc-52040c712cab";
            // var MyAdUnitId = "11389925";


            // instantiate an InterstitialAd
            MyVideoAd = new InterstitialAd();

            // wire up all 4 events, see below for function templates
            MyVideoAd.AdReady       += MyVideoAd_AdReady;
            MyVideoAd.ErrorOccurred += MyVideoAd_ErrorOccurred;
            MyVideoAd.Completed     += MyVideoAd_Completed;
            MyVideoAd.Cancelled     += MyVideoAd_Cancelled;


            // pre-fetch an ad 30-60 seconds before you need it
            MyVideoAd.RequestAd(AdType.Video, MyAppID, MyAdUnitId);

            ViewModel = new MainViewModel(12);
            InitializeComponent();
            NavigationCacheMode     = NavigationCacheMode.Required;
            commandBar.DataContext  = ViewModel;
            searchBox.SearchCommand = SearchCommand;
            this.SizeChanged       += OnSizeChanged;
        }
示例#3
0
        private async void MyInterstitialAd_Completed(object sender, object e)
        {
            if (SettingData.Instance.IsAdFree)
            {
                return;
            }

            CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;

            coreTitleBar.ExtendViewIntoTitleBar = true;

            await Task.Delay(TimeSpan.FromMinutes(10)); //No more Ad in 5 mins

            AdErrorEventArgs arg = e as AdErrorEventArgs;

            if (arg != null)
            {
                if (arg.ErrorCode == Microsoft.Advertising.ErrorCode.NoAdAvailable)
                {
                    adType = adType == AdType.Video ? AdType.Display : AdType.Video;
                }
            }

            myInterstitialAd.RequestAd(adType, myAppId, adType == AdType.Video ? myAdUnitId : myAdUnitIdImg);
        }
示例#4
0
 public void Preload(bool show = false)
 {
     if (show)
     {
         this.AfterReady += () => Show();
     }
     _ad.RequestAd(AdType.Video, _applicationId, _adUnitId);
 }
示例#5
0
        private void showAd_Click(object sender, RoutedEventArgs e)
        {
            var MyAppId    = "d25517cb-12d4-4699-8bdc-52040c712cab";
            var MyAdUnitId = "11388823";

            videoAd.AdReady += videoAd_AdReady;
            videoAd.RequestAd(AdType.Video, MyAppId, MyAdUnitId);
        }
 private void refresh_button_Click(object sender, RoutedEventArgs e)
 {
     myInterstitialAd.RequestAd(AdType.Video, myAppId, myAdUnitId);
     if (InterstitialAdState.Ready == myInterstitialAd.State)
     {
         myInterstitialAd.Show();
     }
 }
 private void RunInterstitialAd(object sender, RoutedEventArgs e)
 {
     // Request an ad. When the ad is ready to show, the AdReady event will fire.
     // The application id and ad unit id are passed in here.
     // 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
     interstitialAd.RequestAd(AdType.Video, "d25517cb-12d4-4699-8bdc-52040c712cab", "11389925");
     rootPage.NotifyUser("Ad requested", NotifyType.StatusMessage);
 }
示例#8
0
        private void AddInterstitialAd()
        {
            interstitialAd = new InterstitialAd();
            interstitialAd.ErrorOccurred += OnAdError;
            interstitialAd.AdReady       += OnAdReady;
            interstitialAd.Cancelled     += OnAdCancelled;
            interstitialAd.Completed     += OnAdCompleted;

            interstitialAd.RequestAd(AdType.Video, "d25517cb-12d4-4699-8bdc-52040c712cab", "test");
        }
示例#9
0
        private void AddInterstitialAdControl()
        {
            string adUnitId      = "11389925";
            string applicationId = "d25517cb-12d4-4699-8bdc-52040c712cab";

            intersitialAdControl                = new InterstitialAd();
            intersitialAdControl.AdReady       += IntersitialAdControl_AdReady;
            intersitialAdControl.Cancelled     += IntersitialAdControl_Cancelled;
            intersitialAdControl.Completed     += IntersitialAdControl_Completed;
            intersitialAdControl.ErrorOccurred += IntersitialAdControl_ErrorOccurred;

            intersitialAdControl.RequestAd(AdType.Video, applicationId, adUnitId);
        }
        public FormulaBalancerPage()
        {
            this.InitializeComponent();

            SetUpPageAnimation();

            myInterstitialAd                = new InterstitialAd();
            myInterstitialAd.AdReady       += MyInterstitialAd_AdReady;
            myInterstitialAd.ErrorOccurred += MyInterstitialAd_ErrorOccurred;
            myInterstitialAd.Completed     += MyInterstitialAd_Completed;
            myInterstitialAd.Cancelled     += MyInterstitialAd_Cancelled;
            myInterstitialAd.RequestAd(AdType.Display, myAppId, myAdUnitId);
        }
示例#11
0
        public ADUtils()
        {
            myInterstitialAd = new InterstitialAd();

            if (!SettingData.Instance.IsAdFree)
            {
                myInterstitialAd.Completed     += MyInterstitialAd_Completed;
                myInterstitialAd.Cancelled     += MyInterstitialAd_Completed;
                myInterstitialAd.ErrorOccurred += MyInterstitialAd_Completed;

                myInterstitialAd.RequestAd(adType, myAppId, adType == AdType.Video ? myAdUnitId : myAdUnitIdImg);
            }
        }
示例#12
0
        public SplashPage()
        {
            this.InitializeComponent();
            InterstitialAd = new InterstitialAd();
            InterstitialAd.RequestAd(AdType.Display, myAppId, myAdUnitId);

            if (settings.Values.ContainsKey("First"))
            { //应用首次启动,必定不会含"First"这个键,让应用导航到GuidePage这个页面,GuidePage这个页面就是对应用的介绍啦
                InterstitialAd.AdReady       += MyInterstitialAd_AdReady;
                InterstitialAd.ErrorOccurred += MyInterstitialAd_ErrorOccurred;
                InterstitialAd.Completed     += MyInterstitialAd_Completed;
                InterstitialAd.Cancelled     += MyInterstitialAd_Cancelled;
            }
        }
        public InterstitialAdPage()
        {
            this.InitializeComponent();

            myInterstitialAd                = new InterstitialAd();
            myInterstitialAd.AdReady       += MyInterstitialAd_AdReady;
            myInterstitialAd.ErrorOccurred += MyInterstitialAd_ErrorOccurred;
            myInterstitialAd.Completed     += MyInterstitialAd_Completed;
            myInterstitialAd.Cancelled     += MyInterstitialAd_Cancelled;

            if (MainPage.isVideoAd)
            {
                myInterstitialAd.RequestAd(AdType.Video, myAppId, myAdUnitId);
            }
            else
            {
                myInterstitialAd.RequestAd(AdType.Display, myAppId, myAdUnitId);
            }

            if (InterstitialAdState.Ready == myInterstitialAd.State)
            {
                myInterstitialAd.Show();
            }
        }
        private async void WatchAnAd()
        {
            if (!InternetConnectivityHelper.IsInternetConnected)
            {
                await NotifyAndDeselect("Seems you don't have an internet connection. Thanks for the support, though!");

                return;
            }
            StoreServicesCustomEventLogger logger = StoreServicesCustomEventLogger.GetDefault();

            InterstitialAd ad         = new InterstitialAd();
            string         myAppId    = "9nblggh42srx";
            string         myAdUnitId = "11701839";

            ad.AdReady += (r, a) =>
            {
                if (InterstitialAdState.Ready == ad.State)
                {
                    logger.Log("WatchAnAdStarted");
                    ad.Show();
                }
            };
            ad.Completed += async(r, a) =>
            {
                logger.Log("WatchAnAdCompleted");
                await NotifyAndDeselect("Thanks!");
            };
            ad.Cancelled += async(r, a) =>
            {
                await NotifyAndDeselect("No worries!");
            };
            ad.ErrorOccurred += async(r, a) =>
            {
                await NotifyAndDeselect("Aw! An error occured. We will try later. Thanks.");
            };
            ad.RequestAd(AdType.Video, myAppId, myAdUnitId);
            await NotifyAndDeselect("Please continue. The ad will be shown shortly.");

            async Task NotifyAndDeselect(string message)
            {
                await SharedLogic.Instance.NotificationManager.ShowMessageAsync(message);

                SplitViewMenu.SplitViewMenu.SelectPrevious();
            }
        }
        public void ShowAds()
        {
            // Instantiate the interstitial video ad

            interstitialAd = new InterstitialAd();

            // Attach event handlers

            interstitialAd.ErrorOccurred += OnAdError;

            interstitialAd.AdReady += OnAdReady;

            interstitialAd.Cancelled += OnAdCancelled;

            interstitialAd.Completed += OnAdCompleted;

            interstitialAd.RequestAd(AdType.Display, "XXXXXXXXXXX", "XXXXX"); //Replace your Ads ID
        }
        public void Show(string adUnit)
        {
            _adInterstitial = new InterstitialAd();
            string adapplicatioId = "9NQ4P04F8HH1";

            adUnit = "1100018074";

            _adInterstitial.RequestAd(AdType.Display, adUnit, adapplicatioId);
            _adInterstitial.AdReady += (sender, args) =>
            {
                if (InterstitialAdState.Ready == _adInterstitial.State)
                {
                    _adInterstitial.Show();
                }
            };
            _adInterstitial.ErrorOccurred += (sender, args) =>
            {
                //var dialog = new MessageDialog("Error occurred: " + args.ErrorMessage);
                //dialog.Commands.Add(new UICommand("OK"));
                //Task.Run(async() => {await dialog.ShowAsync(); });
            };
        }
示例#17
0
        public DrinkViewControl()
        {
            myInterstitialAd                = new InterstitialAd();
            myInterstitialAd.AdReady       += MyInterstitialAd_AdReady;
            myInterstitialAd.ErrorOccurred += MyInterstitialAd_ErrorOccurred;
            myInterstitialAd.Completed     += MyInterstitialAd_Completed;
            myInterstitialAd.Cancelled     += MyInterstitialAd_Cancelled;
            myInterstitialAd.RequestAd(AdType.Display, myAppId, myAdUnitId);

            this.InitializeComponent();
            DataContext = this;

            if (PrintManager.IsSupported())
            {
                PrintButton.Visibility = Visibility.Visible;
            }
            else
            {
                PrintButton.Visibility = Visibility.Collapsed;
            }

            dataTransferManager = DataTransferManager.GetForCurrentView();
            dataTransferManager.DataRequested += new TypedEventHandler <DataTransferManager, DataRequestedEventArgs>(OnDataRequested);
        }
 void MyInterstitialAd_ErrorOccurred(object sender, AdErrorEventArgs e)
 {
     // Your code goes here.
     myInterstitialAd.RequestAd(AdType.Display, myAppId, myAdUnitId);
 }
示例#19
0
 void RefreshAd()
 {
     interstitialAd.RequestAd(AdType.Display, applicationID, adUnitID);
 }
        private void AddInterstitialAdControl()
        {
            string adUnitId = "11389925";
            string applicationId = "d25517cb-12d4-4699-8bdc-52040c712cab";

            intersitialAdControl = new InterstitialAd();
            intersitialAdControl.AdReady += IntersitialAdControl_AdReady;
            intersitialAdControl.Cancelled += IntersitialAdControl_Cancelled;
            intersitialAdControl.Completed += IntersitialAdControl_Completed;
            intersitialAdControl.ErrorOccurred += IntersitialAdControl_ErrorOccurred;

            intersitialAdControl.RequestAd(AdType.Video, applicationId, adUnitId);
        }
 private void RequestAd()
 {
     _interstitialAd.RequestAd(AdType.Video, DemoAds.VideoAdUnit.AppId, DemoAds.VideoAdUnit.AdUnitId);
 }
示例#22
0
 private void VideoIntersticialCommandExecute()
 {
     _interstitialAd.RequestAd(AdType.Video,
                               ApplicationId,
                               VideoIntersticialId);
 }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (interstitialAd == null)
            {
                // Instantiate the interstitial video ad
                interstitialAd = new InterstitialAd();

                // Attach event handlers
                interstitialAd.ErrorOccurred += OnAdError;
                interstitialAd.AdReady       += OnAdReady;
                interstitialAd.Cancelled     += OnAdCancelled;
                interstitialAd.Completed     += OnAdCompleted;
                GalaSoft.MvvmLight.Messaging.Messenger.Default.Register <Message>(this, "CheckInterstitialAd", (msg) =>
                {
                    var resource = ResourceLoader.GetForCurrentView();
                    Helpers.VersionHelper.CheckPaidFeature(resource.GetString("Message/Info/InterstitialQuestion"), new GalaSoft.MvvmLight.Command.RelayCommand <ContentDialog>((dlg) =>
                    {
                        //interstitialAd.RequestAd(AdType.Video, "d25517cb-12d4-4699-8bdc-52040c712cab", "11389925");
                        interstitialAd.RequestAd(AdType.Video, AppId, InterstitialUniId);
                        dlg.Hide();
                        App.ContentDlgOp = null;
                    }));
                });
            }

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

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

                // 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 = "3f83fe91-d6be-434d-a0ae-7351c5a997f1";
                //adControl.AdUnitId = "10865270";
                adControl.ApplicationId = AppId;
                adControl.AdUnitId      = BannerUnitId;

                if (App.IsMobile)
                {
                    // Set the dimensions
                    adControl.Width  = 320;
                    adControl.Height = 50;

                    // Add the ad control to the page.
                    BottomAdPanel.Children.Add(adControl);
                }
                else
                {
                    //adControl.ApplicationId = "d25517cb-12d4-4699-8bdc-52040c712cab";
                    //adControl.AdUnitId = "10043134";

                    //adControl.Width = 160;
                    //adControl.Height = 600;

                    // Set the dimensions
                    adControl.Width  = 728;
                    adControl.Height = 90;

                    // Add the ad control to the page.
                    BottomAdPanel.Children.Add(adControl);
                }
            }
        }
示例#24
0
 // This example requests an interstitial ad when the "Request ad" button is clicked. In a real app,
 // you should request the interstitial ad close to when you think it will be shown, but with
 // enough advance time to make the request and prepare the ad (say 30 seconds to a few minutes).
 private void requestAdButton_Click(object sender, RoutedEventArgs e)
 {
     //<Snippet4>
     myInterstitialAd.RequestAd(AdType.Video, myAppId, myAdUnitId);
     //</Snippet4>
 }
示例#25
0
 void LoadAd()
 {
     interstitialAd.RequestAd(AdType.Video, applicationID, adUnitID);
     //interstitialAd.RequestAd(AdType.Display, applicationID, adUnitID);
 }
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            grdLoader.Visibility  = Visibility.Collapsed;
            grdPayment.Visibility = Visibility.Collapsed;
            LoadLocales();

            CloureManager.SetLoaderUI(grdLoader);
            CloureManager.SetFrame(contentFrame);
            CloureManager.SetTitleControl(tbModuleTitle);

            txtCloureAccountType.Text = "Cloure " + accountType;

            txtUser.Text      = CloureManager.cloureClient.Name + " " + CloureManager.cloureClient.LastName;
            txtUserGroup.Text = CloureManager.cloureClient.Group;
            txtUserMail.Text  = CloureManager.cloureClient.Email;

            if (CloureManager.account_data_saved)
            {
                txtAccountAddOn.Content = "Olvidar sesión";
            }
            else
            {
                txtAccountAddOn.Visibility = Visibility.Collapsed;
            }

            await CloureManager.LoadAccountInfo();

            if (accountType != "free" && accountType != "test_free")
            {
                //Difference between days to expire subscription and advice days
                if (CloureManager.getVencimientoDias() <= CloureManager.getPaymentAdviceDays())
                {
                    //LoadCloureProducts(accountType);
                }
                btnSubscribePremium.Visibility = Visibility.Collapsed;
            }
            else
            {
                btnSubscribePremium.Visibility = Visibility.Visible;
            }

            if (CloureManager.getCompanyType() == "generic" || CloureManager.getCompanyType() == "printing_houses")
            {
                LoadModuleInfo("invoicing");
            }

            //Load Menu
            foreach (JsonValue jsonValue in CloureManager.cloureClient.modulesGroupsArr)
            {
                JsonObject groupItem   = jsonValue.GetObject();
                string     group_id    = groupItem.GetNamedString("Id");
                string     group_title = groupItem.GetNamedString("Title");
                string     group_icon  = groupItem.GetNamedString("Icon");

                JsonArray menuItems = groupItem.GetNamedArray("Items");

                CloureMenuGroup group_model = new CloureMenuGroup(group_id, group_title, group_icon);

                if (menuItems.Count > 1)
                {
                    for (uint j = 0; j < menuItems.Count; j++)
                    {
                        JsonObject menuItem = menuItems.GetObjectAt(j);

                        string menu_id       = menuItem.GetNamedString("Id");
                        string menu_title    = menuItem.GetNamedString("Title");
                        string menu_group_id = menuItem.GetNamedString("GroupId");

                        if (menu_group_id == group_id)
                        {
                            CloureMenuItem mnu = new CloureMenuItem(menu_id, menu_title, menu_group_id);
                            mnu.Click += Mnu_Click;
                            group_model.cloureMenuItems.Add(mnu);
                        }
                    }
                }
                else
                {
                    JsonObject menuItem   = menuItems.GetObjectAt(0);
                    string     menu_id    = menuItem.GetNamedString("Id");
                    string     menu_title = menuItem.GetNamedString("Title");
                    group_model.Name  = menu_id;
                    group_model.Title = menu_title;
                }
                group_model.Style      = (Style)Application.Current.Resources["CloureMenuGroup"];
                group_model.isExpanded = false;
                group_model.Click     += Group_model_Click;
                spMenuItems.Children.Add(group_model);
            }

            //Ad settings
            if (accountType == "test_free")
            {
                BannerAd.ApplicationId        = "3f83fe91-d6be-434d-a0ae-7351c5a997f1";
                BannerAd.AdUnitId             = "test";
                BannerAd.IsAutoRefreshEnabled = true;

                string myAppId    = "d25517cb-12d4-4699-8bdc-52040c712cab";
                string myAdUnitId = "test";

                myInterstitialAd = new InterstitialAd();
                myInterstitialAd.RequestAd(AdType.Video, myAppId, myAdUnitId);
                myInterstitialAd.AdReady       += MyInterstitialAd_AdReady;
                myInterstitialAd.ErrorOccurred += MyInterstitialAd_ErrorOccurred;
                myInterstitialAd.Completed     += MyInterstitialAd_Completed;
                myInterstitialAd.Cancelled     += MyInterstitialAd_Cancelled;

                setUIAds(false);
            }
            else if (accountType == "free")
            {
                string AppId        = "9phmgghfsgxp";
                string BannerUnitId = "1100035377";
                string VideoUnitId  = "1100035195";

                BannerAd.ApplicationId        = AppId;
                BannerAd.AdUnitId             = BannerUnitId;
                BannerAd.IsAutoRefreshEnabled = true;

                myInterstitialAd = new InterstitialAd();
                myInterstitialAd.RequestAd(AdType.Video, AppId, VideoUnitId);
                myInterstitialAd.AdReady       += MyInterstitialAd_AdReady;
                myInterstitialAd.ErrorOccurred += MyInterstitialAd_ErrorOccurred;
                myInterstitialAd.Completed     += MyInterstitialAd_Completed;
                myInterstitialAd.Cancelled     += MyInterstitialAd_Cancelled;

                setUIAds(false);
            }
            else
            {
                setUIAds(true);
            }

            //CloureManager.sendToast("Titulo", "Contenido");
            txtAccountAddOn.Click += TxtAccountAddOn_Click;
        }
示例#27
0
 public void Preload()
 {
     _ad.RequestAd(AdType.Video, _appId, _unitId);
 }