Ejemplo n.º 1
0
		public void CheckThatPicturesHaveWords ()
		{
			XmlReader reader = XmlReader.Create("Shared_Content/Pairs2.xml");

			imageParser parser = new imageParser ();

			Dictionary <String, List<Pair>> pairLists = new Dictionary<String, List<Pair>> ();

			List<String> pairTypes = new List<String> () {
				"initial_consonant",
				"final_consonant",
				"cluster_reduction",
				"stopping",
				"fronting",
				"postvocalic",
				"prevocalic",
				"gliding",
				"stridency_deletion",
				"nasalization",
				"multi",
			};

			pairLists = parser.parsePairs (reader);

			String leftImagePath;
			String rightImagePath;
			List<Pair> pairList;

			int missingCount = 0;
			string missingWords = "";

			foreach (String pairType in pairTypes) {
				pairList = pairLists [pairType];

				missingWords += pairType + " has " + pairList.Count.ToString () + " words \n";

				foreach (Pair pair in pairList) {
					leftImagePath = "ipad_images_pointer/" + pair.leftImageName + ".jpg";
					rightImagePath = "ipad_images_pointer/" + pair.rightImageName + ".jpg";

					if(!File.Exists(leftImagePath)){

						missingWords = missingWords + pair.leftImageName +"\n";
						Console.WriteLine (pair.leftImageName + "is missing");
						missingCount++;

					}
					if (!File.Exists (rightImagePath)) {

						missingWords = missingWords + pair.rightImageName+"\n";
						Console.WriteLine (pair.rightImageName + "is missing");
						missingCount++;

					}

				}
			}

			int zero = 0;
			Assert.AreEqual (zero, missingCount, missingWords);

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

			//initialize buttons, buttons will be disabled until prices load or the purchase is checked
			btnFronting.Enabled = false; btnCluster.Enabled = false; btnFinalConsonant.Enabled = false;
			btnStopping.Enabled = false; btnGliding.Enabled = false; btnCluster.Enabled = false; btnStridency.Enabled = false; btnPreVoicing.Enabled = false;
			btnPostVoicing.Enabled = false; 



			handlerFronting = (s, e) => PurchaseProduct (frontingProduct);
			handlerCR = (s, e) => PurchaseProduct (crProduct); 
			handlerFCD=(s,e)=>PurchaseProduct(fcdProduct);  handlerStopping=(s,e)=>PurchaseProduct(stoppingProduct); 
			handlerGliding=(s,e)=>PurchaseProduct(glidingProduct);  handlerMulti=(s,e)=>PurchaseProduct(multiProduct);  
			handlerPre=(s,e)=>PurchaseProduct(preProduct);  handlerPost=(s,e)=>PurchaseProduct(postProduct); handlerStridency=(s,e)=>PurchaseProduct(stridencyProduct);

			this.btnFronting.TouchUpInside+=handlerFronting;
			this.btnCluster.TouchUpInside+=handlerCR;
			this.btnStopping.TouchUpInside+=handlerStopping;
			this.btnPostVoicing.TouchUpInside +=handlerPost;
			this.btnGliding.TouchUpInside+=handlerGliding;
			this.btnPreVoicing.TouchUpInside +=handlerPre;
			this.btnStridency.TouchUpInside +=handlerStridency;
			this.btnMulti.TouchUpInside+=handlerMulti;
			this.btnFinalConsonant.TouchUpInside+=handlerFCD;


			buttonCheck ();

			//style the buttons
			styleButton (this.btnPreVoicing); styleButton (btnMulti); styleButton (btnFinalConsonant);
			styleButton (this.btnFronting); styleButton (btnInitialConsonant); styleButton (btnPostVoicing);
			styleButton (this.btnPreVoicing); styleButton (btnStopping); styleButton (btnStridency);
			styleButton (btnGliding); styleButton (btnCluster);

			//create an xmlreader to pass so it can be parsed
			XmlReader reader = XmlReader.Create("Shared_Content/Pairs2.xml");

			imageParser parser = new imageParser ();

			pairLists = parser.parsePairs (reader);

			noInterNetObserver = NSNotificationCenter.DefaultCenter.AddObserver (InAppPurchaseManager.NoInternetNotification, (notification) => {
				UIAlertView noNetAlert = new UIAlertView("Connection Lost", "There seems to be an issue with your internet connection. Feel free to use already purchased items!",null,"OK",null);
				noNetAlert.Show();
			});



			// Perform any additional setup after loading the view, typically from a nib.
		}