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; }
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); }