private void button1_Click(object sender, EventArgs e) { ConnectionFactory confac = new CloudConnectionFactory(); Connection conn = confac.createConnection("AmazonWebServices", Connection.TypeOfMsg.Announcement); Random rand = new Random(); if (descriptionBox.TextLength.Equals(0)) MessageBox.Show("Please enter the description for your event"); else if (imgFileLocation.TextLength > 2) MessageBox.Show("Please enter just two characters (eg. 6v)"); else { Advertisement newAd = new Advertisement(rand.Next(10,1000), imgFileLocation.Text, descriptionBox.Text); statusLbl1.Text = "Sending Advertisement..."; statusLbl1.Show(); Thread.Sleep(1000); statusLbl1.Hide(); statusLbl1.Text = "Advertisement Sent"; statusLbl1.Show(); conn.sendMessage(newAd); } }
public void AddAdvertisement() { response = client.ViewAllClients(); Assert.IsNotNull(response.ClientCollection); Assert.IsTrue(response.ClientCollection.ToList().Count > 0); var theClient = response.ClientCollection.FirstOrDefault(); response = client.ViewAllCatagories(); Assert.IsNotNull(response.CatagoryCollection); Assert.IsTrue(response.CatagoryCollection.ToList().Count > 0); var catagory = response.CatagoryCollection.FirstOrDefault(); var advertisement = new Advertisement { Title = "Big Sale on Cosmetics!", Description = "There is a big sale on Cosmetics just around the corner!", ExpiryDate = DateTime.Now.AddDays(30), CategoryId = catagory.Id, ClientId = theClient.Id, CreatedDate = DateTime.Now }; response = client.AddAdvertisement(new JsonRequest {AdvertisementCollection = new List<Advertisement>{advertisement}}); Assert.IsTrue(response.IsSuccessFull); }
public static void Fetch(Advertisement.Position pos = Advertisement.Position.Top) { #if !UNITY_WEBPLAYER if (!canShowAds) return; AdvertisementManager.fetchBanner(pos == Advertisement.Position.Top? AdvertisementManager.Positions.TOP : AdvertisementManager.Positions.BOTTOM); #endif }
public void addAdvertisement(AdsModels ads) { Advertisement an = new Advertisement(); an.posted = DateTime.Now; an.isdisplayed = true; an.title = ads.adtitle; an.txt = ads.adtxt; an.url = ads.adimgurl; db.Advertisements.InsertOnSubmit(an); db.SubmitChanges(); }
public void Approve(int serviceSolicitationId) { var serviceSolicitation = _serviceSolicitationRepository.Get(serviceSolicitationId); if (serviceSolicitation.Advertisement != null) throw new Exception("Essa solicitação de serviço já foi aprovada"); var advertisement = new Advertisement(); serviceSolicitation.Advertisement = advertisement; advertisement.Status = Domain.AdvertisementStatus.PendingContentDispatch; _advertisementRepository.Add(advertisement); _serviceSolicitationRepository.SaveChanges(); }
public override List<Advertisement> checkMessages() { List<Advertisement> AdvertisementList = new List<Advertisement>(); Advertisement newAd = new Advertisement(0,"0","0"); int currentFetchCounter = 0; do { string fullMessage = string.Empty; string receiptHandle; string selectedQueue = QueueURLString; ReceiveMessageResponse queueReceiveMessageResponse = new ReceiveMessageResponse(); queueReceiveMessageResponse = objClient.ReceiveMessage(new ReceiveMessageRequest() { QueueUrl = selectedQueue, MaxNumberOfMessages = 10, VisibilityTimeout = 5 }); ReceiveMessageResult objReceiveMessageResult = new ReceiveMessageResult(); objReceiveMessageResult = queueReceiveMessageResponse.ReceiveMessageResult; List<Amazon.SQS.Model.Message> messagesList = new List<Amazon.SQS.Model.Message>(); if(objReceiveMessageResult.IsSetMessage()) messagesList = objReceiveMessageResult.Message; foreach (Amazon.SQS.Model.Message objMessage in messagesList) { fullMessage += objMessage.Body; receiptHandle = objMessage.ReceiptHandle; newAd = createAdvertisement(fullMessage); if(!AdvertisementList.Contains(newAd)) AdvertisementList.Add(newAd); } currentFetchCounter++; } while (currentFetchCounter<numberOfMsgToFetch); return AdvertisementList; }
void ShowRewardedVideo() { Advertisement.Show(mySurfacingId); }
private void Start() { Advertisement.Initialize(playStoreID, isTestAds); }
// Implement a function for showing a rewarded video ad: static void ShowRewardedVideo() { Advertisement.Show(continueGameId); Debug.Log("video showed"); }
void Start() { #if UNITY_4_6 Advertisement.Initialize(unityAdId); #endif }
public async Task <HttpResponseMessage> AddAdvertisement(HttpRequestMessage request, long id, [FromBody] Advertisement advertisement) { try { await _manufacturerService.AddAdvertisement(id, advertisement); return(request.CreateResponse(HttpStatusCode.OK)); } catch (Exception ex) { return(request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public override void sendMessage(Advertisement adv) { StringBuilder stBuilder = new StringBuilder(); stBuilder.Append(adv.advertisementID); stBuilder.Append("\n"); stBuilder.Append(adv.imageDirectory); stBuilder.Append("\n"); stBuilder.Append(adv.description); string sendingString = stBuilder.ToString(); try { objClient.SendMessage(new SendMessageRequest() { MessageBody = sendingString, QueueUrl = QueueURLString }); } catch (Exception ex) { throw new AmazonSQSException("Sending Message to Queue Fail"); } }
/// <summary> /// Determine whether the interstitial ad is ready /// </summary> /// <returns></returns> public bool IsInterstitialReady() { return(Advertisement.IsReady(rewardedVideoAdPlacementID)); }
public abstract void sendMessage(Advertisement adv);
public void Remove(Advertisement advertisement) { this.ads.Delete(advertisement); this.ads.Save(); }
public void Add(Advertisement ad) { this.ads.Add(ad); this.ads.Save(); }
private Advertisement createAdvertisement(string obtainedMsg) { string [] full = new string [3]; full = obtainedMsg.Split('\n'); string adId = full[0].ToString(); string imageDirectory = full[1]; string description = full[2].ToString(); Advertisement newCreated = new Advertisement(Convert.ToInt32(adId), imageDirectory, description); return newCreated; }
// Use this for initialization void Start() { Advertisement.Initialize(gameId, testMode); Advertisement.AddListener(this); }
private IEnumerator CRShowRewardedVideo(float delay) { yield return(new WaitForSeconds(delay)); Advertisement.Show(rewardedVideoAdPlacementID); }
private static void ProcessImage(AddAdvertisementViewModel advertisement, Advertisement newAd) { using (var memory = new MemoryStream()) { advertisement.UploadedImage.InputStream.CopyTo(memory); var content = memory.GetBuffer(); newAd.Image = new Image { Content = content, FileExtension = advertisement.UploadedImage.FileName.Split('.').Last() }; } }
public AdExtractedEventArgs(Advertisement Advertisement, TimeSpan Elapsed, int PgItemIdx) { this.Advertisement = Advertisement; this.Elapsed = Elapsed; this.PgItemIdx = PgItemIdx; }
public override void sendMessage(Advertisement adv) { throw new NotImplementedException(); }
public static IdentifiableEntity Create(Advertisement advertisement) { return advertisement; }
// When the object that subscribes to ad events is destroyed, remove the listener: public void OnDestroy() { Advertisement.RemoveListener(this); }
// Use this for initialization void Start() { Advertisement.Initialize(gameID); Time.timeScale = 0; ScoreObject.GetComponent <TextMeshProUGUI>().text = "Score: " + Score; }
/* </Interstital Ad>*/ public void ShowVideoAd() { Advertisement.Show("rewardedVideo"); }
// Implement a function for showing a rewarded video ad: void ShowRewardedVideo() { Advertisement.Show(myPlacementId); }
private void HandleAdvertisement(Advertisement message) { _console.Tell(MakeWelcomeScreenMessage(message)); }
IEnumerator Start() { Debug.Log("Start Admob"); if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); yield return(null); rulesIndex = new Dictionary <AdsEvent, Rule>(); showCount = new Dictionary <Rule, int>(); foreach (var rule in rules) { rulesIndex.Add(rule.adsEvent, rule); showCount.Add(rule, 0); } #if UNITY_ANDROID appId = appIdAndroid; bannerId = bannerIdAndroid; interId = interIdAndroid; startId = startIdAndroid; rewardId = rewardIdAndroid; unityId = unityIdAndroid; #elif UNITY_IOS appId = appIdIos; bannerId = bannerIdIos; interId = interIdIos; rewardId = rewardIdIos; unityId = unityIdIos; #endif if (needAppId) { MobileAds.Initialize(initStatus => { }); } if (needRewardId && !string.IsNullOrEmpty(rewardId)) { AdmobReward.Init(rewardId, GetAdRequest); RewardAdsOperator = AdmobReward.ShowReward; } else { RewardAdsOperator = (_) => false; } #if !UNITY_EDITOR if (Debug.isDebugBuild) { yield break; } #endif if (DataManager.Instance.IsAdsDisabled) { isEnabled = false; yield break; } if (isUnityPersonal) { #if UNITY_ADS Debug.Log("ADS: UnityADS manual initialization."); Advertisement.Initialize(unityId, false); #endif } Init(true); } else { Destroy(gameObject); } }
// Use this for initialization void Awake() { Instance = this; RestLifeTimer = PlayerPrefs.GetFloat("RestLifeTimer"); DateOfExit = PlayerPrefs.GetString("DateOfExit", ""); Gems = PlayerPrefs.GetInt("Gems"); lifes = PlayerPrefs.GetInt("Lifes"); if (PlayerPrefs.GetInt("Lauched") == 0) //First lauching { lifes = CapOfLife; PlayerPrefs.SetInt("Lifes", lifes); Gems = FirstGems; PlayerPrefs.SetInt("Gems", Gems); PlayerPrefs.SetInt("Music", 1); PlayerPrefs.SetInt("Sound", 1); PlayerPrefs.SetInt("Lauched", 1); PlayerPrefs.Save(); } rate = Instantiate(Resources.Load("Prefabs/Rate")) as GameObject; rate.SetActive(false); rate.transform.SetParent(GameObject.Find("CanvasGlobal").transform); rate.transform.localPosition = Vector3.zero; rate.GetComponent <RectTransform> ().anchoredPosition = (Resources.Load("Prefabs/Rate") as GameObject).GetComponent <RectTransform> ().anchoredPosition; rate.transform.localScale = Vector3.one; GameObject.Find("Music").GetComponent <AudioSource> ().volume = PlayerPrefs.GetInt("Music"); SoundBase.Instance.GetComponent <AudioSource> ().volume = PlayerPrefs.GetInt("Sound"); if (Advertisement.isSupported) { #if UNITY_ANDROID Advertisement.Initialize(unityAdsIDAndroid); #elif UNITY_IOS Advertisement.Initialize(unityAdsIDIOS); #else Advertisement.Initialize(unityAdsIDAndroid); #endif } #if UNITY_ANDROID interstitial = new InterstitialAd(admobUIDAndroid); #elif UNITY_IOS interstitial = new InterstitialAd(admobUIDIOS); #else interstitial = new InterstitialAd(admobUIDAndroid); #endif // Create an empty ad request. requestAdmob = new AdRequest.Builder().Build(); // Load the interstitial with the request. interstitial.LoadAd(requestAdmob); Transform canvas = GameObject.Find("CanvasGlobal").transform; foreach (Transform item in canvas) { item.gameObject.SetActive(false); } }
public bool CanPlayAd() { return(Advertisement.IsReady() && !Advertisement.isShowing); }
// Start is called before the first frame update void Awake() { _puzzleSet1 = new GameObject("PuzzleSet1"); _puzzleSet2 = new GameObject("PuzzleSet2"); Filler = FillerGameObject.GetComponent <Image>(); audioSource = GetComponent <AudioSource>(); _frame = PuzzleLayout.CreateFrame(FrameName1); _puzzleLayout = new PuzzleLayout(170.0f, 170.0f, PuzzleRowsOrCols); _frame.transform.SetParent(_puzzleSet1.transform); _puzzleLayout.gameObject.transform.SetParent(_puzzleSet1.transform); _frame2 = PuzzleLayout.CreateFrame(FrameName2); _frame2.transform.SetParent(_puzzleSet2.transform); _puzzleLayout2 = new PuzzleLayout(170.0f, 170.0f, PuzzleRowsOrCols); _puzzleLayout2.gameObject.transform.SetParent(_puzzleSet2.transform); _puzzleSet2.transform.position = new Vector3(0.0f, -600.0f, 0.0f); _puzzleSet2.SetActive(false); ID = Random.Range(0, MaxImageCount); LoadPuzzleImage(); Neighbours.Instance.CreateGraphForNPuzzle(PuzzleRowsOrCols); _fsm = new Patterns.FiniteStateMachine(); _fsm.Add(new GameState_FADEIN(_fsm, (int)GameState.StateID.FADEIN, this)); _fsm.Add(new GameState_WAIT(_fsm, (int)GameState.StateID.WAIT, this)); _fsm.Add(new GameState_PLAYING(_fsm, (int)GameState.StateID.PLAYING, this)); _fsm.Add(new GameState_WIN(_fsm, (int)GameState.StateID.WIN, this)); _fsm.Add(new GameState_SHOW_AD(_fsm, (int)GameState.StateID.SHOW_AD, this)); _fsm.Add(new GameState_COMPARE(_fsm, (int)GameState.StateID.COMPARE, this)); _fsm.Add(new GameState_RANDOMIZE(_fsm, (int)GameState.StateID.RANDOMIZE, this)); _fsm.Add(new GameState_NEXT_PUZZLE_IMAGE(_fsm, (int)GameState.StateID.NEXT_PUZZLE_IMAGE, this)); _fsm.Add(new GameState_SHOW_HINT(_fsm, (int)GameState.StateID.SHOW_HINT, this)); _fsm.Add(new GameState_CANCEL(_fsm, (int)GameState.StateID.CANCEL, this)); _fsm.Add(new GameState_SHOW_REWARD_AD(_fsm, (int)GameState.StateID.SHOW_REWARD_AD, this)); _fsm.Add(new GameState_ASTAR_SOLUTION(_fsm, (int)GameState.StateID.ASTAR_SOLUTION, this)); _fsm.SetCurrentState((int)GameState.StateID.FADEIN); audioSource.Play(); //mBottomMenu = GameApp.Instance.mBottomMenu; //mBottomMenu.SetActive(true); //mBottomMenu.btnNext.gameObject.SetActive(false); //mBottomMenu.btnPrev.onClick.AddListener(LoadMenu); mGameMenuHandler.SetActiveBtnHome(true); #if FARAMIRA_USE_ADS // initialize ADs #if UNITY_IPHONE Advertisement.AddListener(this); Advertisement.Initialize(GameID_iOS, testMode); #endif #if UNITY_ANDROID Advertisement.AddListener(this); Advertisement.Initialize(GameID_Android, testMode); #endif #endif }
public static async Task <AdvertisementResource> CreateAdvertisementExampleAsync(Advertisement advertisementToCreate, IAdPostingApiClient client) { AdvertisementResource advertisementResource = null; try { await TransientErrorRetryPolicy.ExecuteAsync(async() => advertisementResource = await client.CreateAdvertisementAsync(advertisementToCreate)); Console.WriteLine($"Created Advertisement:\n{JsonConvert.SerializeObject(advertisementResource, Formatting.Indented)}"); } catch (RequestException ex) { LogException(ex); } return(advertisementResource); }
public void ShowInterstitialAds() { Advertisement.Show(); }
public ActionResult Index(string sortOrderPA, int?pagePA, string sortOrderRA, int?pageRA, string sortOrderRC, int?pageRC, bool?isRewardSelected, int?selectedReward, int?selectedAdvertisementToDelete) { var viewModel = new ManageIndexViewModel(); var userId = User.Identity.GetUserId(); if (isRewardSelected != null && isRewardSelected == true) { var reward = db.RewardCodes.Find(selectedReward); string rewardCode = reward.Code; TempData["code"] = "<script>alert('Kod: " + rewardCode + ".');</script>"; } if (selectedAdvertisementToDelete != null) { Advertisement advertisement = db.Advertisements.Find(selectedAdvertisementToDelete); db.Advertisements.Remove(advertisement); db.SaveChanges(); TempData["alert"] = "<script>alert('Ogłoszenie zostało usunięte.');</script>"; } //Account var user = db.ApplicationUsers.Where(u => u.Id.ToString().Equals(userId)).First(); viewModel.ApplicationUser = user; //Personal Advertisements var perAds = db.Advertisements.Where(a => a.AuthorId.ToString().Equals(userId) && a.IsFinished == false); //Sorting ViewBag.CurrentSortPA = sortOrderPA; ViewBag.TitleSortParmPA = String.IsNullOrEmpty(sortOrderPA) ? "title_desc" : ""; ViewBag.LocationSortParmPA = sortOrderPA == "location_asc" ? "location_desc" : "location_asc"; ViewBag.AddDateSortParmPA = sortOrderPA == "addDate_asc" ? "addDate_desc" : "addDate_asc"; ViewBag.DifficultySortParmPA = sortOrderPA == "difficulty_asc" ? "difficulty_desc" : "difficulty_asc"; switch (sortOrderPA) { case "title_desc": perAds = perAds.OrderByDescending(a => a.Title); break; case "location_asc": perAds = perAds.OrderBy(a => a.Location.Name); break; case "location_desc": perAds = perAds.OrderByDescending(a => a.Location.Name); break; case "addDate_asc": perAds = perAds.OrderBy(a => a.AddDate); break; case "addDate_desc": perAds = perAds.OrderByDescending(a => a.AddDate); break; case "difficulty_asc": perAds = perAds.OrderBy(a => a.Difficulty.Name); break; case "difficulty_desc": perAds = perAds.OrderByDescending(a => a.Difficulty.Name); break; default: perAds = perAds.OrderBy(a => a.Title); break; } int pageSizePA = 3; int pageNumberPA = (pagePA ?? 1); viewModel.PersonalAdvertisements = perAds.ToPagedList(pageNumberPA, pageSizePA); //Rewarded Advertisements var rewAds = db.Advertisements.Where(a => a.Helpers.Select(u => u.Id.ToString()).Contains(userId)); //Sorting ViewBag.CurrentSortRA = sortOrderRA; ViewBag.TitleSortParmRA = String.IsNullOrEmpty(sortOrderRA) ? "title_desc" : ""; ViewBag.LocationSortParmRA = sortOrderRA == "location_asc" ? "location_desc" : "location_asc"; ViewBag.AddDateSortParmRA = sortOrderRA == "addDate_asc" ? "addDate_desc" : "addDate_asc"; ViewBag.DifficultySortParmRA = sortOrderRA == "difficulty_asc" ? "difficulty_desc" : "difficulty_asc"; switch (sortOrderRA) { case "title_desc": rewAds = rewAds.OrderByDescending(a => a.Title); break; case "location_asc": rewAds = rewAds.OrderBy(a => a.Location.Name); break; case "location_desc": rewAds = rewAds.OrderByDescending(a => a.Location.Name); break; case "addDate_asc": rewAds = rewAds.OrderBy(a => a.AddDate); break; case "addDate_desc": rewAds = rewAds.OrderByDescending(a => a.AddDate); break; case "difficulty_asc": rewAds = rewAds.OrderBy(a => a.Difficulty.Name); break; case "difficulty_desc": rewAds = rewAds.OrderByDescending(a => a.Difficulty.Name); break; default: rewAds = rewAds.OrderBy(a => a.Title); break; } int pageSizeRA = 3; int pageNumberRA = (pageRA ?? 1); viewModel.RewardedAdvertisements = rewAds.ToPagedList(pageNumberRA, pageSizeRA); //Rewards var rew = db.RewardCodes.Where(rc => rc.RewardOwnerId.ToString().Equals(userId)); //Sorting ViewBag.CurrentSort = sortOrderRC; ViewBag.RewardNameSortParmRC = String.IsNullOrEmpty(sortOrderRC) ? "rewardName_desc" : ""; ViewBag.ReceivedDateSortParmRC = sortOrderRC == "receivedDate_asc" ? "receivedDate_desc" : "receivedDate_asc"; switch (sortOrderRC) { case "rewardName_desc": rew = rew.OrderByDescending(r => r.Reward.Name); break; case "receivedDate_asc": rew = rew.OrderBy(r => r.ReceivedDate); break; case "receivedDate_desc": rew = rew.OrderByDescending(r => r.ReceivedDate); break; default: rew = rew.OrderBy(r => r.Reward.Name); break; } int pageSizeRC = 3; int pageNumberRC = (pageRC ?? 1); viewModel.RewardCodes = rew.ToPagedList(pageNumberRC, pageSizeRC); return(View(viewModel)); }
public void ShowSolutionAd() { Advertisement.Show(adsPlacementRewarded); }
// Start is called before the first frame update void Start() { SceneManager.sceneLoaded += RollForAd; Advertisement.Initialize(androidId, false); }
void Start() { Advertisement.AddListener(this); Advertisement.Initialize(gameId, testMode); //StartCoroutine(ShowBannerWhenReady()); }
private void Start() { Advertisement.Initialize(unityAdID, enableTestMode); Advertisement.AddListener(this); }
private void Show() { Advertisement.Show(pId); }
public static void InitializeAds() { #if UNITY_ADS Advertisement.Initialize(gameId, testMode); #endif }
// accessed outside this class public void RemoveAddListener() { Advertisement.RemoveListener(this); }
public static int CompareAdId_SortPar(Advertisement a, Advertisement b) { if (a.advertisementID >= b.advertisementID) return 1; else return 0; }
void Start() { Monetization.Initialize(gameId, testMode); Advertisement.Initialize(gameId, testMode); StartCoroutine(ShowBannerWhenReady()); }
public ActionResult Edit(AdvertisementModel model) { try { Advertisement ad = new Advertisement() { ID = model.AdId, AdName = model.AdName, AddDate = model.AddDate, PublishDate = model.PublishDate, Text = model.Text, NewsPaperId = model.NewsPaperId }; context.AdvertisementUpdateRow(model.AdId,model.AdName, model.Text, model.PublishDate, model.AddDate, model.NewsPaperId); return RedirectToAction("Index"); } catch { return View(model); } }
// Update is called once per frame void Update() { TimeElapse = TimeElapse + Time.deltaTime; TimeElapse2 = TimeElapse2 + Time.deltaTime; if (Frog.activeSelf == false) { timeLeft = 0; } if (timeLeft > 0) { timeLeft -= Time.deltaTime; timerBar.fillAmount = timeLeft / maxTime; } else { if (Frog.activeSelf == true) { Frog.SetActive(false); } timesUpText.SetActive(true); Retry.SetActive(true); HighScore.SetActive(true); if (ReclamaButton != null) { ReclamaButton.SetActive(true); } } if (timeLeft < 10 && Input.GetKeyDown(KeyCode.Mouse0) && timeLeft > 0) { if (TimerAdd + timeLeft < maxTime) { timeLeft = timeLeft + TimerAdd; } else { timeLeft = maxTime; } timerBar.fillAmount = timeLeft / maxTime; ok++; } if (ok % 25 == 0 && ok != 0 && Input.GetKeyDown(KeyCode.Mouse0) && TimerAdd > 0.17) { TimerAdd = TimerAdd - 0.025f; TimeElapse = 0; } if (ok % 50 == 0 && Frog.activeSelf == true && Input.GetKeyDown(KeyCode.Mouse0)) { Timp = 8; if (ok != 0) { if (TimerAdd >= 0.2) { TimerAdd = TimerAdd - (float)0.076; } else if (maxTime > 3f) { maxTime = maxTime - 0.51f; } } StageUpText.GetComponent <StageScript>().StageNumber++; timeLeft = maxTime; } if (Timp != 0 && Input.GetKeyDown(KeyCode.Mouse0)) { StageUpText.SetActive(true); Timp--; } if (Timp == 0) { StageUpText.SetActive(false); } if ((int)Time.time % 45 == 0 && Time.time != 0 && ok3 == false) { ok2 = true; ok3 = true; } if (Frog.activeSelf != true) { if (ok2 == true) { if (Advertisement.IsReady("video")) { Advertisement.Show("video"); } else if (Advertisement.IsReady("Interstitial")) { Advertisement.Show("Interstitial"); } ok2 = false; } } }
private void Awake() { manage = this; Advertisement.Initialize("3791501", false); }
public ProcessFinishedEventArgs(Advertisement.Advertisements Advertisements, TimeSpan Elapsed) { this.Advertisements = Advertisements; this.Elapsed = Elapsed; }