using Foundation;
using UIKit;
//using PokktExtension;
using PokktExtension.iOS;
using System;
//using System.CodeDom.Compiler;
using PokktExtension.Enums;

namespace SampleApp.iOS
{
	partial class DemoSelector : UIViewController
	{
		//private PokktConfig pokktConfig;

		public DemoSelector (string nibName, NSBundle bundle) : base (nibName, bundle)
		{
		}

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//DisableButton ();

			//Setting extension and adding event
			PokktExtension.PokktAds.SetNativeExtentions(new IosExtension());
			PokktExtension.PokktAds.SetThirdPartyUserId("123456");
			PokktExtension.PokktAds.Debugging.ShouldDebug(true);
			PokktExtension.PokktAds.SetPokktConfig("a2717a45b835b5e9f50284a38d62a74e", "iJ02lJss0M");// VideoDemo

			PokktExtension.PokktAds.Banner.BannerLoadedEvent += BannerLoaded;
			PokktExtension.PokktAds.Banner.BannerLoadFailedEvent += BannerLoadFailed;

			// to close keyboard agter changes in screen name
			txtFldScreen.ShouldReturn = (textField) =>
			{
				textField.ResignFirstResponder();
				return true;
			};

		}

		public override void DidReceiveMemoryWarning ()
		{
			base.DidReceiveMemoryWarning();
			// Dispose of any resources that can be recreated.
		}

		partial void DemoScreen1Btn_TouchUpInside (UIButton sender)
		{
			DemoScreen demoScreen = new DemoScreen(txtFldScreen.Text);
			this.NavigationController.PushViewController(demoScreen, true);
		}

		partial void DemoScreen2Btn_TouchUpInside (UIButton sender)
		{
			InterstitialScreenVC interstitialScreen = new InterstitialScreenVC(txtFldScreen.Text);
			this.NavigationController.PushViewController(interstitialScreen, true);
		}

		partial void TestBannerBtn_TouchUpInside(UIButton sender)
		{
			PokktExtension.PokktAds.Banner.LoadBanner(txtFldScreen.Text, (int)BannerPosition.TopCenter);
            PokktExtension.PokktAds.Banner.ShouldAutoRefresh(true);
		}


		partial void ExportLogBtn_TouchUpInside (UIButton sender)
		{
		//	PokktManager.ExportLog();
		}

		private void ShowDemoScreen(string adType)
		{ 
			DemoScreen demoScreen = new DemoScreen (txtFldScreen.Text);
			this.NavigationController.PushViewController(demoScreen, true);
		}

		void BannerLoaded (string screenName)
		{
			Console.WriteLine("BannerLoaded called:" + screenName);
		}

		void BannerLoadFailed(string screenName, string message)
		{
			Console.WriteLine("BannerLoadFailed called");

		}

	}
}
