Exemple #1
0
		void MonoCell_Tapped (object sender, EventArgs e)
		{
			ExampleCard.kanaMode = "";
			ExCardfront.kanaMode = "";
			drillList = new List<ContentPage> ();
			wdrillList = new List<ContentPage> ();
			Debug.WriteLine (((CustomCell)sender).Text);
			string indextext=((CustomCell)sender).Text.Split (' ') [1];
			rrightCount = 0;
			wrightCount = 0;
			currentIndex = int.Parse(indextext)-1;
			int sectionCount;
			sectionCount = 960 / testCount;
			int[] templateData = new int[sectionCount];
			List<ContentPage> tempList=new List<ContentPage>();
			ExampleCard.root = this;
			ExCardfront.root = this; //Setting the root pages for comp tests
			StudyCard.initDrillCount = sectionCount;
			for (int j = 0; j < sectionCount; j++) {

				string rndRow = CompData.compData [currentIndex*sectionCount+j];
				Dictionary<string,string> dic = new Dictionary<string,string> ();
				dic.Add (rndRow.Split ('\t') [3] + ' ' + rndRow.Split ('\t') [4], rndRow.Split ('\t') [5]);
				var str = rndRow.Split ('\t') [3];
				if (rndRow.Split ('\t') [3].Length == 0)
					str = (testCount * currentIndex + j).ToString ();
				if (testMode == 0) 
					tempList.Add (new ExampleCard (str + ' ' + rndRow.Split ('\t') [4], rndRow.Split ('\t') [5], 0){ });
				else
					tempList.Add (new ExCardfront (rndRow.Split ('\t') [3] + ' ' + rndRow.Split ('\t') [4], rndRow.Split ('\t') [5], 0){ });
			}
			for (int k = 0; k < sectionCount; k++) {
				templateData [k] = k;
			}
			templateData = StudyCard.randomIntArray (templateData);
			if (testMode == 0) {
				if (drillList.Count == 0) {
					
					for (int k = 0; k < sectionCount; k++) {
						drillList.Add (tempList [templateData [k]]);
					}
					ExampleCard orgCard = (ExampleCard)drillList [0];
					ExampleCard firstCard = new ExampleCard (orgCard.mKey, orgCard.mValue,0);
					Navigation.PushAsync (firstCard);
				} 
			} else {
				if (wdrillList.Count == 0) {
					
					for (int k = 0; k < sectionCount; k++) {
						wdrillList.Add (tempList [templateData [k]]);
					}
					ExCardfront orgCard = (ExCardfront)wdrillList [0];
					ExCardfront firstCard = new ExCardfront (orgCard.mKey, orgCard.mValue, 0);
					Navigation.PushAsync (firstCard);
				}
			}
		}
Exemple #2
0
		async void E_Clicked (object sender, EventArgs e)
		{
			const string text1 ="Example words 1: あ – の";
			const string text2 ="Example words 2: は – ん";
			const string text3 = "Example words 1: が – ぞ";
			const string text4 = "Example words 2: だ – ぽ";
			const string text5 = "Example words 1: ア - ノ";
			const string text6 = "Example words 2: ハ - ン";
			const string text7 = "Example words 1: ガ – ゾ";
			const string text8 = "Example words 2: ダ – ポ";
			const string text9 = "Example words: ティ – ヴュ";

			const string testTitle = "Select a test";
			string buttonText1=text1, buttonText2=text2;
			testProgress = 0;
			switch (mode) {
			case "Dakuten Hiragana":
				buttonText1 = text3;
				buttonText2 = text4;
				break;
			case "Basic Katakana":
				buttonText1 = text5;
				buttonText2 = text6;
				break;
			case "Dakuten Katakana":
				buttonText1=text7;
				buttonText2 = text8;
				break;
			case "Transcription Katakana":
				buttonText1=text9;

				break;
			}
			if ((Button)sender == testButton [0]) {
				var action="";
				if(monoMode==true)
					action=await DisplayActionSheet (testTitle, "Cancel", null, "Syllables", buttonText1, buttonText2, "Shuffled table");
				else
					action=await DisplayActionSheet (testTitle, "Cancel", null, "Syllables", "Example Words", "Shuffled table");
				
					switch (action) {
					case "Syllables":
						addDrill ();
						StudyCard.drillRightCount = 0;
						StudyCard.initDrillCount = drillList.Count;
						if (drillList [0].GetType () == typeof(ExampleCard)) {
							ExampleCard orgCard = (ExampleCard)drillList [0];
							ExampleCard firstCard = new ExampleCard (orgCard.mKey, orgCard.mValue, 0);
							await Navigation.PushAsync (firstCard);
						} else if (drillList [0].GetType () == typeof(SyllableCard)) {
							SyllableCard orgCard = (SyllableCard)drillList [0];
							SyllableCard firstCard = new SyllableCard (orgCard.mCharacter, orgCard.mRoot, 0);
							await Navigation.PushAsync (firstCard);
						}
						break;
					case text1:
						addExamples (0, false, mode);
						StudyCard.drillRightCount = 0;
						StudyCard.initDrillCount = drillList.Count;
						if (drillList [0].GetType () == typeof(ExampleCard)) {
							ExampleCard orgCard = (ExampleCard)drillList [0];
							ExampleCard firstCard = new ExampleCard (orgCard.mKey, orgCard.mValue, 0);
							await Navigation.PushAsync (firstCard);
						} else if (drillList [0].GetType () == typeof(SyllableCard)) {
							SyllableCard orgCard = (SyllableCard)drillList [0];
							SyllableCard firstCard = new SyllableCard (orgCard.mCharacter, orgCard.mRoot, 0);
							await Navigation.PushAsync (firstCard);
						}
						break;
					case text2:
						addExamples (1, false, mode);
						StudyCard.drillRightCount = 0;
						StudyCard.initDrillCount = drillList.Count;
						if (drillList [0].GetType () == typeof(ExampleCard)) {
							ExampleCard orgCard = (ExampleCard)drillList [0];
							ExampleCard firstCard = new ExampleCard (orgCard.mKey, orgCard.mValue, 0);
							await Navigation.PushAsync (firstCard);
						} else if (drillList [0].GetType () == typeof(SyllableCard)) {
							SyllableCard orgCard = (SyllableCard)drillList [0];
							SyllableCard firstCard = new SyllableCard (orgCard.mCharacter, orgCard.mRoot, 0);
							await Navigation.PushAsync (firstCard);
						}
						break;
					case text3:
						addExamples (0, false, mode);
						StudyCard.drillRightCount = 0;
						StudyCard.initDrillCount = drillList.Count;
						if (drillList [0].GetType () == typeof(ExampleCard)) {
							ExampleCard orgCard = (ExampleCard)drillList [0];
							ExampleCard firstCard = new ExampleCard (orgCard.mKey, orgCard.mValue, 0);
							await Navigation.PushAsync (firstCard);
						} else if (drillList [0].GetType () == typeof(SyllableCard)) {
							SyllableCard orgCard = (SyllableCard)drillList [0];
							SyllableCard firstCard = new SyllableCard (orgCard.mCharacter, orgCard.mRoot, 0);
							await Navigation.PushAsync (firstCard);
						}
						break;
					case text4:
						addExamples (1, false, mode);
						StudyCard.drillRightCount = 0;
						StudyCard.initDrillCount = drillList.Count;
						if (drillList [0].GetType () == typeof(ExampleCard)) {
							ExampleCard orgCard = (ExampleCard)drillList [0];
							ExampleCard firstCard = new ExampleCard (orgCard.mKey, orgCard.mValue, 0);
							await Navigation.PushAsync (firstCard);
						} else if (drillList [0].GetType () == typeof(SyllableCard)) {
							SyllableCard orgCard = (SyllableCard)drillList [0];
							SyllableCard firstCard = new SyllableCard (orgCard.mCharacter, orgCard.mRoot, 0);
							await Navigation.PushAsync (firstCard);
						}
						break;
					case text5:
						addExamples (0, false, mode);
						StudyCard.drillRightCount = 0;
						StudyCard.initDrillCount = drillList.Count;
						if (drillList [0].GetType () == typeof(ExampleCard)) {
							ExampleCard orgCard = (ExampleCard)drillList [0];
							ExampleCard firstCard = new ExampleCard (orgCard.mKey, orgCard.mValue, 0);
							await Navigation.PushAsync (firstCard);
						} else if (drillList [0].GetType () == typeof(SyllableCard)) {
							SyllableCard orgCard = (SyllableCard)drillList [0];
							SyllableCard firstCard = new SyllableCard (orgCard.mCharacter, orgCard.mRoot, 0);
							await Navigation.PushAsync (firstCard);
						}
						break;
					case text6:
						addExamples (1, false, mode);
						StudyCard.drillRightCount = 0;
						StudyCard.initDrillCount = drillList.Count;
						if (drillList [0].GetType () == typeof(ExampleCard)) {
							ExampleCard orgCard = (ExampleCard)drillList [0];
							ExampleCard firstCard = new ExampleCard (orgCard.mKey, orgCard.mValue, 0);
							await Navigation.PushAsync (firstCard);
						} else if (drillList [0].GetType () == typeof(SyllableCard)) {
							SyllableCard orgCard = (SyllableCard)drillList [0];
							SyllableCard firstCard = new SyllableCard (orgCard.mCharacter, orgCard.mRoot, 0);
							await Navigation.PushAsync (firstCard);
						}
						break;
					case text7:
						addExamples (0, false, mode);
						StudyCard.drillRightCount = 0;
						StudyCard.initDrillCount = drillList.Count;
						if (drillList [0].GetType () == typeof(ExampleCard)) {
							ExampleCard orgCard = (ExampleCard)drillList [0];
							ExampleCard firstCard = new ExampleCard (orgCard.mKey, orgCard.mValue, 0);
							await Navigation.PushAsync (firstCard);
						} else if (drillList [0].GetType () == typeof(SyllableCard)) {
							SyllableCard orgCard = (SyllableCard)drillList [0];
							SyllableCard firstCard = new SyllableCard (orgCard.mCharacter, orgCard.mRoot, 0);
							await Navigation.PushAsync (firstCard);
						}
						break;
					case text8:
						addExamples (1, false, mode);
						StudyCard.drillRightCount = 0;
						StudyCard.initDrillCount = drillList.Count;
						if (drillList [0].GetType () == typeof(ExampleCard)) {
							ExampleCard orgCard = (ExampleCard)drillList [0];
							ExampleCard firstCard = new ExampleCard (orgCard.mKey, orgCard.mValue, 0);
							await Navigation.PushAsync (firstCard);
						} else if (drillList [0].GetType () == typeof(SyllableCard)) {
							SyllableCard orgCard = (SyllableCard)drillList [0];
							SyllableCard firstCard = new SyllableCard (orgCard.mCharacter, orgCard.mRoot, 0);
							await Navigation.PushAsync (firstCard);
						}
						break;
					case "Example Words":
						addExamples (0, false, mode);
					StudyCard.drillRightCount = 0;
					StudyCard.initDrillCount = drillList.Count;
					if (drillList [0].GetType () == typeof(ExampleCard)) {
						ExampleCard orgCard = (ExampleCard)drillList [0];
						ExampleCard firstCard = new ExampleCard (orgCard.mKey, orgCard.mValue, 0);
						await Navigation.PushAsync (firstCard);
					} else if (drillList [0].GetType () == typeof(SyllableCard)) {
						SyllableCard orgCard = (SyllableCard)drillList [0];
						SyllableCard firstCard = new SyllableCard (orgCard.mCharacter, orgCard.mRoot, 0);
						await Navigation.PushAsync (firstCard);
					}
						break;
				case "Shuffled table":
					await Navigation.PushAsync (new Shuffled (mode, monoMode));
					break;
					}

			} else if ((Button)sender == testButton [1]) {
				var action = "";
				if(monoMode==true)
					action = await DisplayActionSheet (testTitle, "Cancel", null, "Syllables", buttonText1, buttonText2);
				else
					action = await DisplayActionSheet (testTitle, "Cancel", null, "Syllables", "Example Words");
				switch (action) {
				case "Syllables":
					addRomajiDrill ();
					StudyCard.initDrillCount=drillList.Count;
					StudyCard.drillRightCount = 0;
					if (drillList [0].GetType () == typeof(ExCardfront)) {

						ExCardfront orgCard = (ExCardfront)drillList [0];
						ExCardfront firstCard = new ExCardfront (orgCard.mKey, orgCard.mValue, 0);
						await Navigation.PushAsync (firstCard);
					}
					else if (drillList [0].GetType () == typeof(SyllableRCard)) {

						SyllableRCard orgCard = (SyllableRCard)drillList [0];
						SyllableRCard firstCard = new SyllableRCard (orgCard.mKana, orgCard.mRoot, 0);
						await Navigation.PushAsync (firstCard);
					}
					break;
				case text1:
					addExamples (0, true, mode);
					StudyCard.initDrillCount=drillList.Count;
					StudyCard.drillRightCount = 0;
					if (drillList [0].GetType () == typeof(ExCardfront)) {

						ExCardfront orgCard = (ExCardfront)drillList [0];
						ExCardfront firstCard = new ExCardfront (orgCard.mKey, orgCard.mValue, 0);
						await Navigation.PushAsync (firstCard);
					}
					else if (drillList [0].GetType () == typeof(SyllableRCard)) {

						SyllableRCard orgCard = (SyllableRCard)drillList [0];
						SyllableRCard firstCard = new SyllableRCard (orgCard.mKana, orgCard.mRoot, 0);
						await Navigation.PushAsync (firstCard);
					}
					break;
				case text2:
					addExamples (1,true,mode);
					StudyCard.initDrillCount=drillList.Count;
					StudyCard.drillRightCount = 0;
					if (drillList [0].GetType () == typeof(ExCardfront)) {

						ExCardfront orgCard = (ExCardfront)drillList [0];
						ExCardfront firstCard = new ExCardfront (orgCard.mKey, orgCard.mValue, 0);
						await Navigation.PushAsync (firstCard);
					}
					else if (drillList [0].GetType () == typeof(SyllableRCard)) {

						SyllableRCard orgCard = (SyllableRCard)drillList [0];
						SyllableRCard firstCard = new SyllableRCard (orgCard.mKana, orgCard.mRoot, 0);
						await Navigation.PushAsync (firstCard);
					}
					break;
				case text3:
					addExamples (0,true,mode);
					StudyCard.initDrillCount=drillList.Count;
					StudyCard.drillRightCount = 0;
					if (drillList [0].GetType () == typeof(ExCardfront)) {

						ExCardfront orgCard = (ExCardfront)drillList [0];
						ExCardfront firstCard = new ExCardfront (orgCard.mKey, orgCard.mValue, 0);
						await Navigation.PushAsync (firstCard);
					}
					else if (drillList [0].GetType () == typeof(SyllableRCard)) {

						SyllableRCard orgCard = (SyllableRCard)drillList [0];
						SyllableRCard firstCard = new SyllableRCard (orgCard.mKana, orgCard.mRoot, 0);
						await Navigation.PushAsync (firstCard);
					}
					break;
				case text4:
					addExamples (1,true,mode);
					StudyCard.initDrillCount=drillList.Count;
					StudyCard.drillRightCount = 0;
					if (drillList [0].GetType () == typeof(ExCardfront)) {

						ExCardfront orgCard = (ExCardfront)drillList [0];
						ExCardfront firstCard = new ExCardfront (orgCard.mKey, orgCard.mValue, 0);
						await Navigation.PushAsync (firstCard);
					}
					else if (drillList [0].GetType () == typeof(SyllableRCard)) {

						SyllableRCard orgCard = (SyllableRCard)drillList [0];
						SyllableRCard firstCard = new SyllableRCard (orgCard.mKana, orgCard.mRoot, 0);
						await Navigation.PushAsync (firstCard);
					}
					break;
				case text5:
					addExamples (0,true,mode);
					StudyCard.initDrillCount=drillList.Count;
					StudyCard.drillRightCount = 0;
					if (drillList [0].GetType () == typeof(ExCardfront)) {

						ExCardfront orgCard = (ExCardfront)drillList [0];
						ExCardfront firstCard = new ExCardfront (orgCard.mKey, orgCard.mValue, 0);
						await Navigation.PushAsync (firstCard);
					}
					else if (drillList [0].GetType () == typeof(SyllableRCard)) {

						SyllableRCard orgCard = (SyllableRCard)drillList [0];
						SyllableRCard firstCard = new SyllableRCard (orgCard.mKana, orgCard.mRoot, 0);
						await Navigation.PushAsync (firstCard);
					}
					break;
				case text6:
					addExamples (1,true,mode);
					StudyCard.initDrillCount=drillList.Count;
					StudyCard.drillRightCount = 0;
					if (drillList [0].GetType () == typeof(ExCardfront)) {

						ExCardfront orgCard = (ExCardfront)drillList [0];
						ExCardfront firstCard = new ExCardfront (orgCard.mKey, orgCard.mValue, 0);
						await Navigation.PushAsync (firstCard);
					}
					else if (drillList [0].GetType () == typeof(SyllableRCard)) {

						SyllableRCard orgCard = (SyllableRCard)drillList [0];
						SyllableRCard firstCard = new SyllableRCard (orgCard.mKana, orgCard.mRoot, 0);
						await Navigation.PushAsync (firstCard);
					}
					break;
				case text7:
					addExamples (0,true,mode);
					StudyCard.initDrillCount=drillList.Count;
					StudyCard.drillRightCount = 0;
					if (drillList [0].GetType () == typeof(ExCardfront)) {

						ExCardfront orgCard = (ExCardfront)drillList [0];
						ExCardfront firstCard = new ExCardfront (orgCard.mKey, orgCard.mValue, 0);
						await Navigation.PushAsync (firstCard);
					}
					else if (drillList [0].GetType () == typeof(SyllableRCard)) {

						SyllableRCard orgCard = (SyllableRCard)drillList [0];
						SyllableRCard firstCard = new SyllableRCard (orgCard.mKana, orgCard.mRoot, 0);
						await Navigation.PushAsync (firstCard);
					}
					break;
				case text8:
					addExamples (1,true,mode);
					StudyCard.initDrillCount=drillList.Count;
					StudyCard.drillRightCount = 0;
					if (drillList [0].GetType () == typeof(ExCardfront)) {

						ExCardfront orgCard = (ExCardfront)drillList [0];
						ExCardfront firstCard = new ExCardfront (orgCard.mKey, orgCard.mValue, 0);
						await Navigation.PushAsync (firstCard);
					}
					else if (drillList [0].GetType () == typeof(SyllableRCard)) {

						SyllableRCard orgCard = (SyllableRCard)drillList [0];
						SyllableRCard firstCard = new SyllableRCard (orgCard.mKana, orgCard.mRoot, 0);
						await Navigation.PushAsync (firstCard);
					}
					break;
				case "Example Words":
					addExamples (0,true,mode);
					StudyCard.initDrillCount=drillList.Count;
					StudyCard.drillRightCount = 0;
					if (drillList [0].GetType () == typeof(ExCardfront)) {

						ExCardfront orgCard = (ExCardfront)drillList [0];
						ExCardfront firstCard = new ExCardfront (orgCard.mKey, orgCard.mValue, 0);
						await Navigation.PushAsync (firstCard);
					}
					else if (drillList [0].GetType () == typeof(SyllableRCard)) {

						SyllableRCard orgCard = (SyllableRCard)drillList [0];
						SyllableRCard firstCard = new SyllableRCard (orgCard.mKana, orgCard.mRoot, 0);
						await Navigation.PushAsync (firstCard);
					}
					break;
				}

				
			} else {
				var action = await DisplayActionSheet (testTitle, "Cancel", null, "Fill in the blanks", "Timed recognition");
				switch (action) {
				case "Fill in the blanks":
					if (mode == "Basic Hiragana" && monoMode == true)
						addFillDrill (1);
					else if (mode == "Basic Hiragana" && monoMode == false)
						addFillDrill (2);
					else if (mode == "Dakuten Hiragana" && monoMode == true)
						addFillDrill (3);
					else if (mode == "Dakuten Hiragana" && monoMode == false)
						addFillDrill (4);
					else if (mode == "Basic Katakana" && monoMode == true)
						addFillDrill (5);
					else if (mode == "Basic Katakana" && monoMode == false)
						addFillDrill (6);
					else if (mode == "Dakuten Katakana" && monoMode == true)
						addFillDrill (7);
					else if (mode == "Dakuten Katakana" && monoMode == false)
						addFillDrill (8);
					else if (mode == "Transcription Katakana")
						addFillDrill (9);
					if (fillList.Count > 0) {
						FillBlanks.initCount = fillList.Count;
						FillBlanks.rightCount = 0;
						FillBlanks.progress = 0;
						await Navigation.PushAsync (new FillBlanks(0));
					}
					break;
				case "Timed recognition":
					if (mode == "Basic Hiragana" && monoMode == true)
						addTimeDrill (1);
					else if (mode == "Basic Hiragana" && monoMode == false)
						addTimeDrill (2);
					else if (mode == "Dakuten Hiragana" && monoMode == true)
						addTimeDrill (3);
					else if (mode == "Dakuten Hiragana" && monoMode == false)
						addTimeDrill (4);
					else if (mode == "Basic Katakana" && monoMode == true)
						addTimeDrill (5);
					else if (mode == "Basic Katakana" && monoMode == false)
						addTimeDrill (6);
					else if (mode == "Dakuten Katakana" && monoMode == true)
						addTimeDrill (7);
					else if (mode == "Dakuten Katakana" && monoMode == false)
						addTimeDrill (8);
					else if (mode == "Transcription Katakana")
						addTimeDrill (9);
					if (timeList.Count > 0) {
						Timed.initCount = timeList.Count;
						Timed.rightCount = 0;
						Timed.progress = 0;
						Timed.sw.Restart ();

						await Navigation.PushAsync (new Timed (0));
					}
					break;

				}
			}
		}
Exemple #3
0
		public ExBackCard (string key,string value,StudyCard root,ContentPage drillMode,string kanaMode)
		{
			NavigationPage.SetHasBackButton (this, false);
			this.Title = key.Split(' ')[0];
			if (kanaMode.Length > 0) {  //changes the title on test mode
				if (drillMode.GetType () == typeof(ExCardfront))
					this.Title = kanaMode.Split (' ') [1] + " Writing";
				else if (drillMode.GetType () == typeof(ExampleCard))
					this.Title = kanaMode.Split (' ') [1] + " Reading";
			}
			int fontSize1 = 40,fontSize2=20;
			if (Device.Idiom == TargetIdiom.Tablet) {
				fontSize1 = 80;
				fontSize2 = 30;

			}
			Label left = new Label{Text="x", BackgroundColor = Color.Red,YAlign=TextAlignment.Center,XAlign=TextAlignment.Center,FontSize=20};
			Label right = new Label{Text="✓",BackgroundColor = Color.Green,YAlign=TextAlignment.Center,XAlign=TextAlignment.Center,FontSize=20 };
			Grid grid = new Grid {
				VerticalOptions = LayoutOptions.Fill,
				RowDefinitions = {
					new RowDefinition {Height = new GridLength (1, GridUnitType.Star)},
					new RowDefinition {Height = new GridLength (1, GridUnitType.Star)},
					new RowDefinition {Height = new GridLength (1, GridUnitType.Star)},

				},
				ColumnDefinitions = {
					new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (6, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
				}
			};
			grid.Children.Add (left, 0, 1, 0, 4);
			grid.Children.Add (right, 2, 3, 0, 4);
			if (drillMode.GetType () == typeof(ExCardfront)) {
				Image writingImg = new Image ();
				writingImg.Source=ImageSource.FromFile(DependencyService.Get<IPicture> ().GetPictureFromDisk ("Writing"));

				grid.Children.Add (writingImg, 1, 1);
			}
			string kanaStr = key.Split (' ') [0];

			string romStr = key.Substring (kanaStr.Length+1);
	
			if(Settings.voice)
				DependencyService.Get<IAudio>().PlayMp3File("Audio/Examples/"+kanaStr+".mp3");
			grid.Children.Add(new Label{Text=kanaStr,XAlign=TextAlignment.Center,YAlign=TextAlignment.Center,FontSize=fontSize1-kanaStr.Length*2},1,0);

			grid.Children.Add(new Label{Text=romStr,XAlign=TextAlignment.Center,YAlign=TextAlignment.Center,FontSize=fontSize1-romStr.Length-2,TextColor=Color.Maroon},1,2);						
			string english, english1, english2;
			if (value == "giga- (109)") {
				english = "giga- (10";
				english1 = "9";
				english2 = ")";
			} else if (value == "hecto- (102)") {
				english = "hecto- (10";
				english1 = "2";
				english2 = ")";
			} else if (value == "mega- (106)") {
				english = "mega- (10";
				english1 = "6";
				english2 = ")";
			} else {
				english = value;
				english1 = "";
				english2 = "";
			}
			Label englishLabel = new Label (){Text=english,FontSize=fontSize2,XAlign=TextAlignment.Center,YAlign=TextAlignment.Center};
		
			StackLayout sublayout;
			if (english1.Length > 0) {
				Label englishLabel1 = new Label () {
					Text = english1,
					XAlign = TextAlignment.Center,
					FontSize = (int)fontSize2 * 0.4,
					YAlign=TextAlignment.Start
				};
				Label englishLabel2 = new Label (){ FontSize = fontSize2, Text = english2, XAlign = TextAlignment.Center};
				sublayout = new StackLayout () {
					Children = { englishLabel, englishLabel1, englishLabel2 },
					Orientation = StackOrientation.Horizontal,
					HorizontalOptions = LayoutOptions.Center,
					VerticalOptions = LayoutOptions.Center
				};
				grid.Children.Add (sublayout, 1, 3);		
			} else {
				grid.Children.Add(englishLabel,1,3);	
			}					
			Content = grid;

			var leftTapRecognizer = new TapGestureRecognizer ();
			left.GestureRecognizers.Add (leftTapRecognizer);
			leftTapRecognizer.Tapped += (s, e) => {

				DependencyService.Get<IPicture> ().DeletePictureFromDisk ("Writing");

				if(root.GetType()==typeof(CompMenu))
				{
					((CompMenu)root).wrongCount++;
					if(drillMode.GetType()==typeof(ExCardfront))
					{
						root.wdrillList.Add(drillMode);
						CompMenu.wIndex++;
						ExCardfront orgCard = (ExCardfront)root.wdrillList [CompMenu.wIndex];
						ExCardfront nextCard = new ExCardfront (orgCard.mKey, orgCard.mValue, CompMenu.wIndex);
						Navigation.InsertPageBefore(nextCard,this);
					}
					else
					{
						root.drillList.Add(drillMode);
						CompMenu.rIndex++;
						ExampleCard orgCard = (ExampleCard)root.drillList [CompMenu.rIndex];
						ExampleCard nextCard = new ExampleCard (orgCard.mKey, orgCard.mValue, CompMenu.rIndex);
						Navigation.InsertPageBefore(nextCard,this);
					}
				}
				else
				{
					root.testProgress++;
					if(root.GetType()==typeof(TestPage))
						((TestPage)root).wrongCount++;
					root.drillList.Add(drillMode);
					if(root.drillList[root.testProgress].GetType()==typeof(ExampleCard))
					{
						ExampleCard orgCard=(ExampleCard)root.drillList[root.testProgress];
						ExampleCard nextCard = new ExampleCard(orgCard.mKey,orgCard.mValue, StudyCard.drillRightCount);
						Navigation.InsertPageBefore(nextCard,this);
					}
					else if(root.drillList[root.testProgress].GetType()==typeof(ExCardfront))
					{
						ExCardfront orgCard=(ExCardfront)root.drillList[root.testProgress];
						ExCardfront nextCard = new ExCardfront(orgCard.mKey,orgCard.mValue, StudyCard.drillRightCount);
						Navigation.InsertPageBefore(nextCard,this);
					}
				}	
				Navigation.PopAsync();
			};

			var rightTapRecognizer = new TapGestureRecognizer ();
			right.GestureRecognizers.Add (rightTapRecognizer);
			rightTapRecognizer.Tapped +=  async (s, e) => {
				DependencyService.Get<IPicture> ().DeletePictureFromDisk ("Writing");
				StudyCard.drillRightCount++;
				if(root.GetType()!=typeof(CompMenu))  //Test mode
				{
					if(root.testProgress==root.drillList.Count-1)
					{
						if(root.GetType()!=typeof(TestPage)) // End of test page
						{
							root.addDrill();
							root.testProgress=0;
							if(drillMode.GetType()==typeof(ExampleCard))
							{
								
								Navigation.InsertPageBefore(root.drillList[0],this);
								await Navigation.PopAsync();
							}
						}
						else
						{
							var result = await DisplayAlert ("Congratulations!", "You have completed this test", "OK", "Results");
							if (result == false) {
								await DisplayAlert (((TestPage)root).wrongCount.ToString () +" incorrect responses", "You required " + ((TestPage)root).wrongCount.ToString () + " retries to answer all questions correctly.", "OK");
							}
							await Navigation.PopAsync ();
							
						}
					}
					else
					{
						root.testProgress++;
						if(root.drillList[root.testProgress].GetType()==typeof(ExampleCard))
						{
							ExampleCard orgCard=(ExampleCard)root.drillList[root.testProgress];
							ExampleCard nextCard = new ExampleCard(orgCard.mKey,orgCard.mValue, StudyCard.drillRightCount);
							Navigation.InsertPageBefore(nextCard,this);
						}
						else if(root.drillList[root.testProgress].GetType()==typeof(ExCardfront))
						{
							ExCardfront orgCard=(ExCardfront)root.drillList[root.testProgress];
							ExCardfront nextCard = new ExCardfront(orgCard.mKey,orgCard.mValue, StudyCard.drillRightCount);
							Navigation.InsertPageBefore(nextCard,this);
						}
						await Navigation.PopAsync();
					}
				}
				else  //CompMenu mode
				{
					if(drillMode.GetType()==typeof(ExampleCard))
					{
						
						if(CompMenu.rIndex==root.drillList.Count-1)
						{
							var result = await DisplayAlert ("Congratulations!", "You have completed this test", "OK", "Results");
							if (result == false) {

								await DisplayAlert (((CompMenu)root).wrongCount.ToString () +" incorrect responses", "You required " + ((CompMenu)root).wrongCount.ToString () + " retries to answer all questions correctly.", "OK");
							}
							CompMenu.rIndex=0;
							CompMenu.disableIndex();
							root.testProgress=0;
						}
						else
						{
							CompMenu.rIndex++;
							CompMenu.rrightCount++;
							ExampleCard orgCard = (ExampleCard)root.drillList [CompMenu.rIndex];
							ExampleCard nextCard = new ExampleCard (orgCard.mKey, orgCard.mValue, CompMenu.rIndex);
							Navigation.InsertPageBefore(nextCard,this);
						}
						await Navigation.PopAsync();
					}
					else if(drillMode.GetType()==typeof(ExCardfront))
					{
						
						if(CompMenu.wIndex==root.wdrillList.Count-1)
						{
							var result = await DisplayAlert ("Congratulations!", "You have completed this test", "OK", "Results");
							if (result == false) {
								await DisplayAlert (((CompMenu)root).wrongCount.ToString () +" incorrect responses", "You required " + ((CompMenu)root).wrongCount.ToString () + " retries to answer all questions correctly.", "OK");
							}
							await Navigation.PopAsync ();
							CompMenu.wIndex=0;
							CompMenu.disableIndex();
							root.testProgress=0;
						}
						else
						{
							CompMenu.wIndex++;
							CompMenu.wrightCount++;
							ExCardfront orgCard = (ExCardfront)root.wdrillList [CompMenu.wIndex];
							ExCardfront nextCard = new ExCardfront (orgCard.mKey, orgCard.mValue, CompMenu.wIndex);
							Navigation.InsertPageBefore(nextCard,this);

						}
						await Navigation.PopAsync();
					}
				}
			};
		}