/// <summary> /// Configures the toolbar buttons and the controls for the view. /// </summary> public override void ViewDidLoad() { base.ViewDidLoad(); Title = _category.Name; // Add the toolbar ToolbarItems = GetToolBar(); NavigationController.ToolbarHidden = false; // Flashcard bg image _bgImage = UIImage.FromFile("Assets/Images/flashcardbg.jpg"); _bgImageView = new UIImageView(_bgImage); _bgImageView.Frame = new RectangleF(0,0,320,480); View.AddSubview(_bgImageView); // Questions label _labelQuestionsToday = new UILabel(); _labelQuestionsToday.Frame = new RectangleF(17, 15, 280, 50); _labelQuestionsToday.Font = UIFont.SystemFontOfSize(24f); _labelQuestionsToday.TextColor = UIColor.Black; _labelQuestionsToday.BackgroundColor = UIColor.Clear; _labelQuestionsToday.Text = ""; _labelQuestionsToday.Lines = 3; _labelQuestionsToday.TextAlignment = UITextAlignment.Center; View.AddSubview(_labelQuestionsToday); // Next due label _labelNextDue = new UILabel(); _labelNextDue.Frame = new RectangleF(17, 45, 280, 100); _labelNextDue.Font = UIFont.SystemFontOfSize(16f); _labelNextDue.TextColor = UIColor.Gray; _labelNextDue.BackgroundColor = UIColor.Clear; _labelNextDue.Text = ""; _labelNextDue.Lines = 3; _labelNextDue.TextAlignment = UITextAlignment.Center; View.AddSubview(_labelNextDue); // Start button UIImage startImage = UIImage.FromFile("Assets/Images/startbutton.png"); _buttonStart = new UIButton(new RectangleF(15, 225, 280, 48)); _buttonStart.Font = UIFont.BoldSystemFontOfSize(20); _buttonStart.SetTitleColor(UIColor.White, UIControlState.Normal); _buttonStart.SetBackgroundImage(startImage,UIControlState.Normal); _buttonStart.BackgroundColor = UIColor.Clear; _buttonStart.TouchDown += delegate { // Start sets the category as active if (!_category.Active) { _category.Active = true; Category.Save(_category); } AnswerQuestionsController controller = new AnswerQuestionsController(_category); NavigationController.PushViewController(controller, true); }; View.AddSubview(_buttonStart); // Reset button UIImage resetImage = UIImage.FromFile("Assets/Images/resetbutton.png"); _buttonReset = new UIButton(new RectangleF(15, 275, 280, 48)); _buttonReset.Font = UIFont.BoldSystemFontOfSize(20); _buttonReset.SetTitleColor(UIColor.White, UIControlState.Normal); _buttonReset.SetBackgroundImage(resetImage,UIControlState.Normal); _buttonReset.BackgroundColor = UIColor.Clear; _buttonReset.TouchDown += delegate { foreach (Question question in Question.ForCategory(_category)) { question.Reset(); Question.Save(question); } UIAlertView alert = new UIAlertView(); alert.Title = "Reset"; alert.Message = "All questions for the category have been reset"; alert.AddButton("Close"); alert.Show(); alert.Dismissed += delegate { SetLabelTitles(); }; }; View.AddSubview(_buttonReset); SetNonVisible(); }
/// <summary> /// Configures the toolbar buttons and the controls for the view. /// </summary> public override void ViewDidLoad() { base.ViewDidLoad(); Title = _category.Name; // Add the toolbar ToolbarItems = GetToolBar(); NavigationController.ToolbarHidden = false; // Flashcard bg image _bgImage = UIImage.FromFile("Assets/Images/flashcardbg.jpg"); _bgImageView = new UIImageView(_bgImage); _bgImageView.Frame = new RectangleF(0, 0, 320, 480); View.AddSubview(_bgImageView); // Questions label _labelQuestionsToday = new UILabel(); _labelQuestionsToday.Frame = new RectangleF(17, 15, 280, 50); _labelQuestionsToday.Font = UIFont.SystemFontOfSize(24f); _labelQuestionsToday.TextColor = UIColor.Black; _labelQuestionsToday.BackgroundColor = UIColor.Clear; _labelQuestionsToday.Text = ""; _labelQuestionsToday.Lines = 3; _labelQuestionsToday.TextAlignment = UITextAlignment.Center; View.AddSubview(_labelQuestionsToday); // Next due label _labelNextDue = new UILabel(); _labelNextDue.Frame = new RectangleF(17, 45, 280, 100); _labelNextDue.Font = UIFont.SystemFontOfSize(16f); _labelNextDue.TextColor = UIColor.Gray; _labelNextDue.BackgroundColor = UIColor.Clear; _labelNextDue.Text = ""; _labelNextDue.Lines = 3; _labelNextDue.TextAlignment = UITextAlignment.Center; View.AddSubview(_labelNextDue); // Start button UIImage startImage = UIImage.FromFile("Assets/Images/startbutton.png"); _buttonStart = new UIButton(new RectangleF(15, 225, 280, 48)); _buttonStart.Font = UIFont.BoldSystemFontOfSize(20); _buttonStart.SetTitleColor(UIColor.White, UIControlState.Normal); _buttonStart.SetBackgroundImage(startImage, UIControlState.Normal); _buttonStart.BackgroundColor = UIColor.Clear; _buttonStart.TouchDown += delegate { // Start sets the category as active if (!_category.Active) { _category.Active = true; Category.Save(_category); } AnswerQuestionsController controller = new AnswerQuestionsController(_category); NavigationController.PushViewController(controller, true); }; View.AddSubview(_buttonStart); // Reset button UIImage resetImage = UIImage.FromFile("Assets/Images/resetbutton.png"); _buttonReset = new UIButton(new RectangleF(15, 275, 280, 48)); _buttonReset.Font = UIFont.BoldSystemFontOfSize(20); _buttonReset.SetTitleColor(UIColor.White, UIControlState.Normal); _buttonReset.SetBackgroundImage(resetImage, UIControlState.Normal); _buttonReset.BackgroundColor = UIColor.Clear; _buttonReset.TouchDown += delegate { foreach (Question question in Question.ForCategory(_category)) { question.Reset(); Question.Save(question); } UIAlertView alert = new UIAlertView(); alert.Title = "Reset"; alert.Message = "All questions for the category have been reset"; alert.AddButton("Close"); alert.Show(); alert.Dismissed += delegate { SetLabelTitles(); }; }; View.AddSubview(_buttonReset); SetNonVisible(); }