public LiveTileNounPicture(Noun noun) : this() { TextBlock_Line1.Text = Noun.GenderToString(noun.gender); TextBlock_Line3.Inlines.Clear(); if (noun.genitivForm.Equals("") == false) { Run run = new Run(); run.Text = noun.genitivForm + ", "; TextBlock_Line3.Inlines.Add(run); } if (noun.pluralForm.Equals("") == false) { if (noun.pluralForm.StartsWith("-..")) { Underline underline = new Underline(); Run run = new Run(); run.Text = ".."; underline.Inlines.Add(run); Run run2 = new Run(); run2.Text = noun.pluralForm.Substring(3); TextBlock_Line3.Inlines.Add(underline); TextBlock_Line3.Inlines.Add(run2); } else { Run run = new Run(); run.Text = noun.pluralForm; TextBlock_Line3.Inlines.Add(run); } } TextBlock_Line2.Text = noun.word; TextBlock_Line4.Text = noun.translation; UIHelper.ReduceFontSizeByWidth(TextBlock_Line2, 300); UIHelper.ReduceFontSizeByWidth(TextBlock_Line4, 300); UIHelper.SetTextBlockVerticalCenterOfCanvas(TextBlock_Line2); UIHelper.SetTextBlockVerticalCenterOfCanvas(TextBlock_Line4); }
public OneSideNounCard(Noun noun) : this() { TextBlock_Line1.Text = Noun.GenderToString(noun.gender); TextBlock_Line3.Inlines.Clear(); if (noun.genitivForm.Equals("") == false) { Run run = new Run(); run.Text = noun.genitivForm + ", "; TextBlock_Line3.Inlines.Add(run); } if (noun.pluralForm.Equals("") == false) { if (noun.pluralForm.StartsWith("-..")) { Underline underline = new Underline(); Run run = new Run(); run.Text = ".."; underline.Inlines.Add(run); Run run2 = new Run(); run2.Text = noun.pluralForm.Substring(3); TextBlock_Line3.Inlines.Add(underline); TextBlock_Line3.Inlines.Add(run2); } else { Run run = new Run(); run.Text = noun.pluralForm; TextBlock_Line3.Inlines.Add(run); } } TextBlock_Line2.Text = noun.word; nowword = noun.word; TextBlock_Line4.Text = noun.translation; UIHelper.ReduceFontSizeByWidth(TextBlock_Line2, 420); UIHelper.ReduceFontSizeByWidth(TextBlock_Line4, 420); }
private void Pivot_Main_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (Pivot_Main.SelectedIndex == 0) { StackPanel_ExampleCard.Children.Clear(); Noun noun = new Noun("Lektion", "课,单元", WordGender.Feminine, "-en", ""); System.Windows.Controls.UserControl uc; switch (ListPicker_CardType.SelectedIndex) { case 0: uc = new OneSideNounCard(noun); TextBlock_ReversiblePrompt.Opacity = 0; break; case 1: uc = new TwoSideNounCard(noun, true); TextBlock_ReversiblePrompt.Opacity = 100; break; case 2: uc = new TwoSideNounCard(noun, false); TextBlock_ReversiblePrompt.Opacity = 100; break; default: uc = null; break; } StackPanel_ExampleCard.Children.Add(uc); } }
public TwoSideNounCard(Noun noun, bool isWordInFront) : this() { if (isWordInFront) { TextBlock_FrontLine1.Text = noun.word; TextBlock_BackLine2.Text = noun.translation; } else { TextBlock_FrontLine1.Text = noun.translation; TextBlock_BackLine2.Text = noun.word; } nowword = noun.word; switch (noun.gender) { case WordGender.Masculine: TextBlock_BackLine1.Text = "der"; break; case WordGender.Feminine: TextBlock_BackLine1.Text = "die"; break; case WordGender.Neuter: TextBlock_BackLine1.Text = "das"; break; case WordGender.MasculineOrNeuter: TextBlock_BackLine1.Text = "der/das"; break; case WordGender.None: TextBlock_BackLine1.Text = ""; break; } TextBlock_BackLine3.Inlines.Clear(); if (noun.genitivForm.Equals("") == false) { Run run = new Run(); run.Text = noun.genitivForm + ", "; TextBlock_BackLine3.Inlines.Add(run); } if (noun.pluralForm.Equals("") == false) { if (noun.pluralForm.StartsWith("-..")) { Underline underline = new Underline(); Run run = new Run(); run.Text = ".."; underline.Inlines.Add(run); Run run2 = new Run(); run2.Text = noun.pluralForm.Substring(3); TextBlock_BackLine3.Inlines.Add(underline); TextBlock_BackLine3.Inlines.Add(run2); } else { Run run = new Run(); run.Text = noun.pluralForm; TextBlock_BackLine3.Inlines.Add(run); } } UIHelper.ReduceFontSizeByWidth(TextBlock_FrontLine1, 420); UIHelper.ReduceFontSizeByWidth(TextBlock_BackLine2, 420); }