public void showStudyPage(string title) { StudyCarousel studyPage = new StudyCarousel (title); Study.collapseMode = false; addDrill(); addRow (studyPage); studyPage.Children.Add (drillList [0]); drillList.RemoveAt(0); Navigation.PushAsync (studyPage); }
public void addRow(StudyCarousel studyPage) { DependencyService.Get<IPicture> ().DeletePictureFromDisk ("Writing"); studyPage.Children.Add (new Study("row",this,rowCount)); for (int j = 0; j < RowData.rowData[rowCount].Length; j++) { if (RowData.rowData[rowCount] [j].Length > 0 && RowData.rowData[rowCount] [j] != "b") { studyPage.Children.Add (new Kana ( RowData.rowData[rowCount][j].Split ('\n') [0].Replace('/','\n')){ }); Study iPage=new Study (Character.cData [Character.kana_lookup (( RowData.rowData[rowCount][j].Split ('\n') [0].Split('/')[0]))], this); iPage.changeVisible(); studyPage.Children.Add (iPage); } } }
public TranKata (string romajiMode) { rowArray=new List<string[]>(); drillCount = 212; rowCount = 54; NavigationPage.SetBackButtonTitle (this, "Table"); //kana variables this.romajiM=romajiMode; int i=0; foreach(string[] e in rowData) { if (romajiMode == "Show Romaji") { rowData [i] = vRowData [i]; } rowArray.Add (rowData [i]); i++; } //Study Button ToolbarItem itemStudy = new ToolbarItem { Text = "Study", Order = ToolbarItemOrder.Primary, Command = new Command (() => showStudyPage("Transcr. Katakana")) }; ToolbarItems.Add(itemStudy); ToolbarItem itemCollapse; if (romajiMode == "Hide Romaji") { itemCollapse = new ToolbarItem { Icon = "uncollapse.png", Order = ToolbarItemOrder.Primary, Command = new Command (() => switchMode(romajiMode)) }; ToolbarItems.Add(itemCollapse); } else{ itemCollapse = new ToolbarItem { Icon = "collapse.png", Order = ToolbarItemOrder.Primary, Command = new Command (() => switchMode(romajiMode)) }; ToolbarItems.Add(itemCollapse); } grid = new Grid { VerticalOptions = LayoutOptions.Fill, HorizontalOptions=LayoutOptions.Fill, RowDefinitions = { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, 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 (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, } }; // Tap recognizers for letters var letterTapRecognizer = new TapGestureRecognizer(); //Display study page for each kana letterTapRecognizer.Tapped += (s, e) => { string kana=((Label)s).FormattedText.ToString(); Navigation.PushAsync (new Study (Character.cData[Character.kana_lookup(kana.Split('\n')[0])],this,0,1){ }); }; var monoColTapRecognizer = new TapGestureRecognizer(); monoColTapRecognizer.Tapped += (s, e) => { StudyCarousel studyPage = new StudyCarousel (((Label)s).Text+" Row"); rowCount=rowList[((Label)s).Text]; drillCount=rowCount*4; addDrill(); addRow (studyPage); studyPage.Children.Add(drillList[0]); drillList.RemoveAt(0); Navigation.PushAsync (studyPage); }; grid.ColumnSpacing = 1; grid.RowSpacing = 1; Label headerLabel = new Label () { Text = "\u2022Tap \"Study\" to begin\n\u2022Tap consonants to select specific rows to study\n\u2022Tap kana to study specific characters\n\u2022Use bracketed romaji for keyboard input\n\u2022Alternative kana spellings in parentheses\n", TextColor = Color.Gray, XAlign = TextAlignment.Start, FontSize=12, }; grid.Children.Add (headerLabel, 0, 9, 0, 1); int j = 0; string[] vowelRow = {"","A", "I", "U", "E", "O","","YU","YE"} ; foreach (string e in vowelRow) { if (e.Length > 0) { grid.Children.Add (new LetterLabel { BackgroundColor = Color.FromHex ("639630"), Text = e, TextColor = Color.White, }, j, 1); } j++; } string[] consotantMonoCol = {"Kw", "S", "Z", "T","Ts","D","F","Y","W","V"} ; j = 1; foreach (string e in consotantMonoCol) { j++; Label monoLabel = new Label { BackgroundColor = Color.FromHex ("639630"), Text = e, TextColor = Color.White, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center }; monoLabel.GestureRecognizers.Add (monoColTapRecognizer); grid.Children.Add (monoLabel, 0, j); rowList.Add (e, j +52); } int r = 2; int[] fontSize = new int[]{15,10,13,9}; if (Device.Idiom == TargetIdiom.Tablet) { fontSize = new int[]{30,20,25,18}; } foreach(string[]rows in rowArray) { j = 0; foreach(string e in rows) { j++; char[] splitters = new char[]{ '/', '\n'}; // string replacement =e.Replace('/','\n'); string [] strArray=e.Split (splitters); FormattedString fs=new FormattedString(); for (int k = 0; k < strArray.Length; k++) { fs.Spans.Add (new Span { Text = strArray [k]+"\n", FontSize = fontSize[k] }); } Label letter= new LetterLabel { FormattedText=fs, }; if (e != "") { letter.GestureRecognizers.Add (letterTapRecognizer); grid.Children.Add (letter, j, r); } } r++; } //Accomodate iPhone status bar. this.Padding = new Thickness(5, Device.OnPlatform(0, 0, 0), 5, 0); this.Content = new ScrollView{Content=grid}; this.Title = "Transcr. Katakana"; }
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 (); } } } }
public VoicedHira (string romajiMode) { drillCount = 68; rowCount = 18; NavigationPage.SetBackButtonTitle (this, "Table"); //kana variables this.romajiM=romajiMode; double fontSize=new LetterLabel().FontSize; if (romajiMode == "Hide Romaji") { gRow = vRowData[0]; zRow = vRowData[1]; dRow = vRowData[2]; bRow = vRowData[3]; pRow = vRowData[4]; } else { if (Device.Idiom == TargetIdiom.Tablet) fontSize = fontSize * 2; } //Study Button ToolbarItem itemStudy = new ToolbarItem { Text = "Study", Order = ToolbarItemOrder.Primary, Command = new Command (() => showStudyPage("Dakuten Hiragana")) }; ToolbarItems.Add(itemStudy); ToolbarItem itemCollapse; if (romajiMode == "Hide Romaji") { itemCollapse = new ToolbarItem { Icon = "collapse.png", Order = ToolbarItemOrder.Primary, Command = new Command (() => switchMode(romajiMode)) }; ToolbarItems.Add(itemCollapse); } else if (romajiMode == "Show Romaji") { itemCollapse = new ToolbarItem { Icon = "uncollapse.png", Order = ToolbarItemOrder.Primary, Command = new Command (() => switchMode(romajiMode)) }; ToolbarItems.Add(itemCollapse); } grid = new Grid { VerticalOptions = LayoutOptions.Fill, RowDefinitions = { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, 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 (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, } }; // Tap recognizers for letters var letterTapRecognizer = new TapGestureRecognizer(); //Display study page for each kana letterTapRecognizer.Tapped += (s, e) => { string kana; if(string.IsNullOrEmpty (((Label)s).Text)) kana=((Label)s).FormattedText.ToString(); else kana=((Label)s).Text; Navigation.PushAsync (new Study (Character.cData[Character.kana_lookup(kana.Split('\n')[0])],this,0,1){ }); }; var monoColTapRecognizer = new TapGestureRecognizer(); monoColTapRecognizer.Tapped += (s, e) => { StudyCarousel studyPage = new StudyCarousel (((Label)s).Text+" Row"); rowCount=rowList[((Label)s).Text]+17; drillCount=rowCount*4; addDrill(); addRow (studyPage); studyPage.Children.Add(drillList[0]); drillList.RemoveAt(0); Navigation.PushAsync (studyPage); }; var diaColTapRecognizer = new TapGestureRecognizer(); diaColTapRecognizer.Tapped += (s, e) => { StudyCarousel studyPage = new StudyCarousel (((Label)s).Text+" Row"); rowCount=rowList[((Label)s).Text+"2"]+17; drillCount=rowCount*4; addDrill(); addRow (studyPage); studyPage.Children.Add(drillList[0]); drillList.RemoveAt(0); Navigation.PushAsync (studyPage); }; grid.ColumnSpacing = 1; grid.RowSpacing = 1; var fs = new FormattedString (); fs.Spans.Add (new Span { Text="Monographs", ForegroundColor = Color.White }); grid.Children.Add (new Label () { Text = "\u2022Tap \"Study\" to begin\n\u2022Tap consonants to select specific rows to study\n\u2022Tap kana to study specific characters\n\u2022Use bracketed romaji for keyboard input\n\u2022Gray font indicates obsolete or seldom used kana\n", TextColor = Color.Gray, XAlign=TextAlignment.Start, FontSize=12, }, 0, 10, 0, 1); grid.Children.Add(new Label { BackgroundColor = Color.FromHex("2B3359"), FormattedText = fs, TextColor=Color.White, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center }, 1,6,1,2); var fs2 = new FormattedString (); fs2.Spans.Add (new Span { Text="Digraphs", ForegroundColor = Color.White }); grid.Children.Add(new Label { BackgroundColor = Color.FromHex("2B3359"), FormattedText = fs2, TextColor=Color.White, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center }, 7,10,1,2); int i = 0; string[] vowelRow = {"","A", "I", "U", "E", "O","","YA","YU","YO"} ; foreach (string e in vowelRow) { if (e != "") { grid.Children.Add (new LetterLabel { BackgroundColor = Color.FromHex ("639630"), Text = e, TextColor = Color.White, }, i, 2); } i++; } string[] consotantMonoCol = {"G", "Z", "D", "B","P"} ; i = 2; foreach (string e in consotantMonoCol) { i++; Label monoLabel = new Label { BackgroundColor = Color.FromHex ("639630"), Text = e, TextColor = Color.White, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center }; monoLabel.GestureRecognizers.Add (monoColTapRecognizer); grid.Children.Add (monoLabel, 0, i); rowList.Add (e, i - 2); } string[] consotantDiaCol = {"G", "Z", "D", "B","P"} ; i = 2; int j = 0; foreach (string e in consotantDiaCol) { i++; LetterLabel diaLabel; diaLabel = new LetterLabel { BackgroundColor = Color.FromHex ("639630"), Text = e, TextColor = Color.White, }; grid.Children.Add (diaLabel, 6, i); if(i!=5) { diaLabel.GestureRecognizers.Add (diaColTapRecognizer); rowList.Add (e+"2", j+6); j++; } } i = 0; foreach(string e in gRow) { i++; LetterLabel letter= new LetterLabel { Text = e, FontSize=fontSize }; if (e != "") { letter.GestureRecognizers.Add (letterTapRecognizer); grid.Children.Add (letter, i, 3); } } //K row i = 0; foreach(string e in zRow) { i++; if (e != "") { LetterLabel letter= new LetterLabel { Text = e, FontSize=fontSize }; letter.GestureRecognizers.Add (letterTapRecognizer); grid.Children.Add (letter, i, 4); } } //S row i = 0; foreach(string e in dRow) { i++; if (e != "") { string[]strArray=e.Split('/'); FormattedString fs3=new FormattedString(); fs3.Spans.Add(new Span(){Text=strArray[0],FontSize=fontSize}); if(strArray.Length>1) fs3.Spans.Add(new Span(){Text="\n"+strArray[1],FontSize=fontSize-5}); LetterLabel letter = new LetterLabel { FormattedText=fs3 }; if (i < 7) { letter.GestureRecognizers.Add (letterTapRecognizer); } else { letter.IsEnabled = false; letter.TextColor = Color.Gray; } grid.Children.Add (letter, i, 5); } } //T row i = 0; foreach(string e in bRow) { i++; if (e != "") { LetterLabel letter= new LetterLabel { Text = e, FontSize=fontSize }; letter.GestureRecognizers.Add (letterTapRecognizer); grid.Children.Add (letter, i, 6); } } //N row i = 0; foreach(string e in pRow) { i++; if (e != "") { LetterLabel letter= new LetterLabel { Text = e, FontSize=fontSize }; letter.GestureRecognizers.Add (letterTapRecognizer); grid.Children.Add (letter, i, 7); } } //H row //Accomodate iPhone status bar. //this.Padding = new Thickness(5, Device.OnPlatform(0, 0, 0), 5, 0); //Build the page. //grid.BackgroundColor=Device.OnPlatform(Color.Black,Color.White,Color.White); this.Content = new ScrollView{Content=grid}; this.Title = "Dakuten Hiragana"; }
public UnvoicedHira (string romajiMode) { drillCount = 0; rowCount = 0; NavigationPage.SetBackButtonTitle (this, "Table"); //kana variables this.romajiM=romajiMode; double fontSize=new LetterLabel().FontSize; if (romajiMode == "Hide Romaji") { nullMonoRow = uvRowData [0]; kRow = uvRowData [1]; sRow = uvRowData [2]; tRow = uvRowData [3]; nRow = uvRowData [4]; hRow = uvRowData [5]; mRow = uvRowData [6]; yRow = uvRowData [7]; rRow = uvRowData [8]; wRow = uvRowData [9]; } else { if (Device.Idiom == TargetIdiom.Tablet) fontSize = fontSize * 2; } //Study Button ToolbarItem itemStudy = new ToolbarItem { Text = "Study", Order = ToolbarItemOrder.Primary, Command = new Command (() => showStudyPage("Basic Hiragana")) }; ToolbarItems.Add(itemStudy); ToolbarItem itemCollapse; if (romajiMode == "Hide Romaji") { itemCollapse = new ToolbarItem { Icon = "collapse.png", Order = ToolbarItemOrder.Primary, Command = new Command (() => switchMode(romajiMode)) }; ToolbarItems.Add(itemCollapse); } else if (romajiMode == "Show Romaji") { itemCollapse = new ToolbarItem { Icon = "uncollapse.png", Order = ToolbarItemOrder.Primary, Command = new Command (() => switchMode(romajiMode)), }; ToolbarItems.Add(itemCollapse); } if (romajiMode == "Show Romaji") { grid = new Grid { VerticalOptions = LayoutOptions.Fill, RowDefinitions = { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, 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 (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, } }; } else { if (Device.Idiom == TargetIdiom.Tablet) { grid = new Grid { VerticalOptions = LayoutOptions.Fill, RowDefinitions = { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }, 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 (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, } }; } else { grid = new Grid { VerticalOptions = LayoutOptions.Fill, RowDefinitions = { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (4, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (4, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (4, GridUnitType.Star) }, } }; } } // Tap recognizers for letters var letterTapRecognizer = new TapGestureRecognizer(); //Display study page for each kana letterTapRecognizer.Tapped += (s, e) => { string kana=((Label)s).Text; if(kana==null) kana=((Label)s).FormattedText.ToString(); Navigation.PushAsync (new Study (Character.cData[Character.kana_lookup(kana.Split('\n')[0])],this,0,1){ }); }; var monoColTapRecognizer = new TapGestureRecognizer(); monoColTapRecognizer.Tapped += (s, e) => { StudyCarousel studyPage = new StudyCarousel (((Label)s).Text+" Row"); rowCount=rowList[((Label)s).Text]; drillCount=rowCount*4; addDrill(); addRow (studyPage); studyPage.Children.Add(drillList[0]); drillList.RemoveAt(0); Navigation.PushAsync (studyPage); }; var diaColTapRecognizer = new TapGestureRecognizer(); diaColTapRecognizer.Tapped += (s, e) => { StudyCarousel studyPage = new StudyCarousel (((Label)s).Text+" Row"); rowCount=rowList[((Label)s).Text+"2"]; drillCount=rowCount*4; addDrill(); addRow (studyPage); studyPage.Children.Add(drillList[0]); drillList.RemoveAt(0); Navigation.PushAsync (studyPage); }; grid.ColumnSpacing = 1; grid.RowSpacing = 1; var fs = new FormattedString (); fs.Spans.Add (new Span { Text="Monographs\n", ForegroundColor = Color.White }); fs.Spans.Add (new Span { Text="(Gojūon)", ForegroundColor = Color.White, FontAttributes = FontAttributes.Italic }); Label headerLabel = new Label () { Text = "\u2022Tap \"Study\" to begin\n\u2022Tap consonants to select specific rows to study\n\u2022Tap kana to study specific characters\n\u2022Gray font indicates obsolete or seldom used kana\n", TextColor = Color.Gray, XAlign = TextAlignment.Start, FontSize=12, }; grid.Children.Add (headerLabel, 0, 10, 0, 1); grid.Children.Add(new Label { BackgroundColor = Color.FromHex("2B3359"), FormattedText = fs, TextColor=Color.White, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center }, 1,6,1,2); var fs2 = new FormattedString (); fs2.Spans.Add (new Span { Text="Digraphs\n", ForegroundColor = Color.White }); fs2.Spans.Add (new Span { Text="(Yōon)", ForegroundColor = Color.White, FontAttributes = FontAttributes.Italic }); grid.Children.Add(new Label { BackgroundColor = Color.FromHex("2B3359"), FormattedText = fs2, TextColor=Color.White, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center }, 7,10,1,2); int i = 0; string[] vowelRow = {"","A", "I", "U", "E", "O","","YA","YU","YO"} ; foreach (string e in vowelRow) { if (e != "") { grid.Children.Add (new LetterLabel { BackgroundColor = Color.FromHex ("639630"), Text = e, TextColor = Color.White, }, i, 2); } i++; } string[] consotantMonoCol = {"∅", "K", "S", "T", "N","H","M","Y","R","W"} ; i = 2; foreach (string e in consotantMonoCol) { i++; Label monoLabel = new Label { BackgroundColor = Color.FromHex ("639630"), Text = e, TextColor = Color.White, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center }; monoLabel.GestureRecognizers.Add (monoColTapRecognizer); grid.Children.Add (monoLabel, 0, i); rowList.Add (e, i - 3); } string[] consotantDiaCol = {"", "K", "S", "T", "N","H","M","","R",""} ; i = 2; int j = 0; foreach (string e in consotantDiaCol) { i++; LetterLabel diaLabel; if (e != "") { diaLabel = new LetterLabel { BackgroundColor = Color.FromHex ("639630"), Text = e, TextColor = Color.White, }; diaLabel.GestureRecognizers.Add (diaColTapRecognizer); grid.Children.Add (diaLabel, 6, i); rowList.Add (e+"2", j+11); j++; } } i = 0; foreach(string e in nullMonoRow) { i++; LetterLabel letter= new LetterLabel { Text = e, FontSize=fontSize }; if (e != "") { letter.GestureRecognizers.Add (letterTapRecognizer); grid.Children.Add (letter, i, 3); } } for(i=7;i<10;i++) { grid.Children.Add(new BoxView { Color=Color.FromHex("BFBFBF") }, i,3); } //K row i = 0; foreach(string e in kRow) { i++; if (e != "") { LetterLabel letter= new LetterLabel { Text = e, FontSize=fontSize }; letter.GestureRecognizers.Add (letterTapRecognizer); grid.Children.Add (letter, i, 4); } } //S row i = 0; foreach(string e in sRow) { i++; if (e != "") { LetterLabel letter= new LetterLabel { Text = e, FontSize=fontSize }; letter.GestureRecognizers.Add (letterTapRecognizer); grid.Children.Add (letter, i, 5); } } //T row i = 0; foreach(string e in tRow) { i++; if (e != "") { LetterLabel letter= new LetterLabel { Text = e, FontSize=fontSize }; letter.GestureRecognizers.Add (letterTapRecognizer); grid.Children.Add (letter, i, 6); } } //N row i = 0; foreach(string e in nRow) { i++; if (e != "") { LetterLabel letter= new LetterLabel { Text = e, FontSize=fontSize }; letter.GestureRecognizers.Add (letterTapRecognizer); grid.Children.Add (letter, i, 7); } } //H row i = 0; foreach(string e in hRow) { i++; if (e != "") { LetterLabel letter= new LetterLabel { Text = e, FontSize=fontSize }; letter.GestureRecognizers.Add (letterTapRecognizer); grid.Children.Add (letter, i, 8); } } //M row i = 0; foreach(string e in mRow) { i++; if (e != "") { LetterLabel letter= new LetterLabel { Text = e, FontSize=fontSize }; letter.GestureRecognizers.Add (letterTapRecognizer); if (i == 8) { letter.TextColor = Color.Gray; letter.IsEnabled = false; letter.GestureRecognizers.Remove (letterTapRecognizer); } grid.Children.Add (letter, i, 9); } } //Y row i = 0; foreach(string e in yRow) { i++; if (e != "" && e!="b") { LetterLabel letter= new LetterLabel { Text = e, FontSize=fontSize }; letter.GestureRecognizers.Add (letterTapRecognizer); grid.Children.Add (letter, i, 10); } if (e == "b") { grid.Children.Add (new BoxView { Color = Color.FromHex("BFBFBF") }, i, 10); } } //R row i = 0; foreach(string e in rRow) { i++; if (e != "") { LetterLabel letter= new LetterLabel { Text = e, FontSize=fontSize }; letter.GestureRecognizers.Add (letterTapRecognizer); grid.Children.Add (letter, i, 11); } } //W row i = 0; foreach(string e in wRow) { i++; if (e != "" && e!="b") { LetterLabel letter= new LetterLabel { }; if(i==5) { char[] splitters = new char[]{ '/', '\n'}; string [] strArray=e.Split (splitters); FormattedString fs3=new FormattedString(); fs3.Spans.Add (new Span { Text = strArray [0],FontSize=fontSize}); if(strArray.Length>1) fs3.Spans.Add (new Span { Text ="\n"+strArray [1], FontSize = fontSize-4 }); letter.FormattedText=fs3; } else { letter.Text=e; letter.FontSize = fontSize; } letter.GestureRecognizers.Add (letterTapRecognizer); if (i == 2 || i == 4) { letter.TextColor = Color.Gray; letter.IsEnabled = false; letter.GestureRecognizers.Remove (letterTapRecognizer); } grid.Children.Add (letter, i, 12); } if (e == "b") { grid.Children.Add (new BoxView { Color = Color.FromHex("BFBFBF") }, i, 12); } } string nText="ん\nn"; if (romajiMode == "Show Romaji") nText = "ん"; LetterLabel nletter=new LetterLabel (){Text=nText,HorizontalOptions=LayoutOptions.FillAndExpand,FontSize=fontSize}; nletter.GestureRecognizers.Add (letterTapRecognizer); grid.Children.Add (nletter, 0, 1, 13, 14); //Accomodate iPhone status bar. //this.Padding = new Thickness(5, Device.OnPlatform(0, 0, 0), 5, 0); //Build the page. //grid.BackgroundColor=Device.OnPlatform(Color.Black,Color.White,Color.White); this.Content = new ScrollView{Content=grid}; this.Title = "Basic Hiragana"; }