Example #1
0
		public SyllableCard (string kana,TestPage root,int index)
		{
			progressLabel = new Label{Text=" ",TextColor=Color.Gray,XAlign=TextAlignment.Center};

			Title = Character.getCategory(kana)+" Reading";
			mCharacter = kana;
			mRoot = root;
			Grid grid = new Grid {
				HorizontalOptions=LayoutOptions.Fill,
				VerticalOptions = LayoutOptions.FillAndExpand,
				RowDefinitions = {
					new RowDefinition {Height = GridLength.Auto},
					new RowDefinition {Height = new GridLength(1, GridUnitType.Star)},
					new RowDefinition {Height = GridLength.Auto},
				}
			};
			progressBar = new ProgressBar {
				Progress=0
			};
			//Setting the progress\
			//double progress =  (double)(mRoot.drillList.LastIndexOf/(double)mRoot.drillList.Count);
			double progress=0;
		 	if(root.GetType()==typeof(TestPage))
			{
				progress = (double)(index/(double)StudyCard.initDrillCount);
				progressLabel.Text=index.ToString()+"/"+StudyCard.initDrillCount;
				progressBar.ProgressTo (progress, 10, Easing.Linear);
			}

			StackLayout layout = new StackLayout () {
				Orientation=StackOrientation.Vertical,
				Children = {
					progressLabel,
					progressBar
				}
			};

			//Adding children to grid
			grid.Children.Add (layout,0,2);
			Button backButton = new Button{ Text = "→", HorizontalOptions= LayoutOptions.End, FontSize = 50 };
			grid.Children.Add(backButton,0,0);
			grid.Children.Add (new Label { Text = kana.Replace('/','\n'),
				VerticalOptions = LayoutOptions.Center,
				XAlign=TextAlignment.Center,
				YAlign=TextAlignment.Center,
				FontSize = 100-15*kana.Split('/')[0].Length	
			}, 0,1,0, 2);
			grid.Padding = new Thickness (10, Device.OnPlatform (10, 0, 0), 10, 10);
			Content = grid;

			backButton.Clicked+= BackButton_Clicked;
		}
Example #2
0
		async public override void addDrill()
		{
			List<ContentPage> tempList = new List<ContentPage> ();
			drillList = new List<ContentPage> ();
			string[] rndNullRow = randomArray (RowData.rowData[rowCount]);
			if (drillCount < (rowCount + 1) * 4) {
				
				switch (drillCount % 4) {
				case 0:
					for (int j = 0; j < RowData.rowData[rowCount].Length; j++) {
						drillList.Add (new KanaCard (rndNullRow [j].Split ('\n') [0].Replace('/','\n'), this){ });
					}
					break;
				case 1:
					for (int j = 0; j < RowData.rowData [rowCount].Length; j++) {
						drillList.Add (new Cardfront (rndNullRow [j].Split ('\n') [0].Replace('/','\n'), this){ });
					}
					break;
				case 2:
					ExampleCard.root = this;
					ExampleCard.kanaMode = "";
					for (int j = 0; j < RowData.rowData[rowCount].Length; j++) {
						Dictionary<string,string> dic = Character.get_examples (rndNullRow [j].Split ('\n') [0].Replace('/','\n'));
						string[] randomKeys = new string[dic.Count];
						dic.Keys.CopyTo (randomKeys, 0);
						randomKeys = TranKata.randomArray (randomKeys);

						foreach (string e in randomKeys) {
							string value;
							dic.TryGetValue (e, out value);
							tempList.Add (new ExampleCard (e, value, 0){ });
						}
					}
					int[] randArray = new int[tempList.Count];

					for (int j = 0; j < tempList.Count; j++) {
						randArray [j] = j;
					}
					randArray = UnvoicedHira.randomIntArray (randArray);
					for (int j = 0; j < tempList.Count; j++) {
						drillList.Add(tempList[randArray[j]]);
					}
					break;
				case 3:
					ExCardfront.root = this;
					ExCardfront.kanaMode = "";
					for (int j = 0; j < RowData.rowData[rowCount].Length; j++) {
						Dictionary<string,string> dic = Character.get_examples (rndNullRow [j].Split ('\n') [0].Replace('/','\n'));
						string[] tempKeys = new string[dic.Count];
						dic.Keys.CopyTo (tempKeys, 0);
						string[] randomKeys = TranKata.randomArray (tempKeys);
						foreach (string e in randomKeys) {
							string value;
							dic.TryGetValue (e, out value);
							tempList.Add (new ExCardfront (e, value, 0){ });
						}
					}
					randArray = new int[tempList.Count];

					for (int j = 0; j < tempList.Count; j++) {
						randArray [j] = j;
					}
					randArray = UnvoicedHira.randomIntArray (randArray);
					for (int j = 0; j < tempList.Count; j++) {
						drillList.Add(tempList[randArray[j]]);
					}
					break;
				}
			//	await Navigation.PushAsync (drillList [0]);
				drillCount++;
			} else {
				await Navigation.PopAsync ();
				rowCount++;
				if (rowCount <= 63) {
					var choice = await DisplayAlert ("Congratulations!", "You have completed the drills for this row", "STUDY NEXT ROW", "GO BACK TO TABLE");
					if (choice) {
						StudyCarousel newCarousel = new StudyCarousel ("Transcription Katakana");

						addDrill();
						addRow (newCarousel);
						newCarousel.Children.Add (drillList [0]);
						drillList.RemoveAt (0);
					
						await Navigation.PushAsync (newCarousel);
					} else {
					//	await Navigation.PopAsync ();
					}
				} else {
					var choice = await DisplayAlert ("Congratulations!", "You have completed the Transcription Katakana lesson", "GO TO TESTS", "GO BACK TO TABLE");
					if (choice) {
						TestPage testMenu = new TestPage("Transcription Katakana",false);
						Navigation.InsertPageBefore(testMenu,this);
						await Navigation.PopAsync ();
					} else {
					//	await Navigation.PopAsync ();
					}
				}
			}
		}
Example #3
0
		public SyllableRCard (string kana,TestPage root,int index)
		{
			progressLabel = new Label{Text=" ",TextColor=Color.Gray,XAlign=TextAlignment.Center};
			Title = Character.getCategory(kana)+" Writing";
			string romaji = Character.kana_to_romaji (kana);

			mRoot = root;
			mKana = kana;
			ImageWithTouch DrawingImage;
			DrawingImage = new ImageWithTouch {
				VerticalOptions = LayoutOptions.FillAndExpand,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				BackgroundColor = Color.White,
				CurrentLineColor = Color.Gray
			};
			Button butErase = new Button {
				Text = " Erase ",
				HorizontalOptions = LayoutOptions.End,
				VerticalOptions = LayoutOptions.Center,
				BorderWidth=1,

			};
			butErase.Clicked += ButErase_Clicked;
			DrawingImage.SetBinding (ImageWithTouch.CurrentLineColorProperty, "CurrentLineColor");
			var palleteFrame = new Frame {
				BackgroundColor = Color.White,
				HasShadow = false,
				OutlineColor = Color.Black,
				Content = DrawingImage
				,Padding=0
			};
			progressBar = new ProgressBar {
				Progress=0
			};
			double progress=0;
			if(root.GetType()==typeof(TestPage))
			{
				progress = (double)(index/(double)StudyCard.initDrillCount);
				progressLabel.Text=index.ToString()+"/"+StudyCard.initDrillCount;
			}
			progressBar.ProgressTo (progress, 10, Easing.Linear);
			StackLayout layout = new StackLayout () {
				Orientation=StackOrientation.Vertical,
				Children = {
					progressLabel,
					progressBar
				}
			};

			gridView = new ContentView {
				Content = palleteFrame,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.FillAndExpand
			};
			grid = new Grid {
				HorizontalOptions=LayoutOptions.Fill,
				VerticalOptions = LayoutOptions.FillAndExpand,
				RowDefinitions = {
					new RowDefinition {Height = GridLength.Auto},
					new RowDefinition {Height = GridLength.Auto},
					new RowDefinition {Height = new GridLength(2, GridUnitType.Star)},
					new RowDefinition {Height = new GridLength(1, GridUnitType.Star)},
					new RowDefinition {Height = GridLength.Auto},
				}
			};

			grid.Children.Add(new Label {
					Text="Tap outside writing field when done\nUse landscape view for maximum width (tablet only)",
					XAlign=TextAlignment.Center,
				TextColor=Color.Gray}
				,0,0);

			grid.Children.Add (new Label { Text = romaji.Replace('/','\n'),
				VerticalOptions = LayoutOptions.Center,
				XAlign=TextAlignment.Center,
				YAlign=TextAlignment.Center,
				FontSize = 50	
			}, 0, 3);
			grid.Children.Add (gridView, 0, 2);
			grid.Children.Add (butErase, 0, 1);
			grid.Children.Add (layout,0,4);
			Content = grid;
			Padding = new Thickness (10, Device.OnPlatform (20, 0, 0), 10, 10);
			var tapGestureRecognizer = new TapGestureRecognizer ();
			tapGestureRecognizer.Tapped+= TapGestureRecognizer_Tapped;
			this.Content.GestureRecognizers.Add (tapGestureRecognizer);
		}