/* public override void ViewDidUnload () { base.ViewDidUnload (); // Release any retained subviews of the main view. _quiz = null; _questionView = null; _resultView = null; } */ protected override void Dispose (bool disposing) { if (disposing){ _quiz = null; _questionView = null; _resultView = null; } base.Dispose (disposing); }
void OnQuestionChanged (object sender, EventArgs e) { QuizQuestionView qv = sender as QuizQuestionView; if (qv == null) return; _questionNumber ++; qv.TotalQuestionCount = _quiz.GetTotalQuestionsCount (); qv.CurrentQuestionNumber = _questionNumber; qv.CurrentPoints = _quiz.GetRightPoints (); qv.RightAnswerCount = _quiz.GetRightAnswerCount (); var nextQuestion = _quiz.GetNextQuestion (); if (nextQuestion != null) { this.NavigationItem.SetRightBarButtonItem (_btnAbort, true); UIView.BeginAnimations ("CurlUp"); UIView.SetAnimationDuration (1.25); UIView.SetAnimationCurve (UIViewAnimationCurve.EaseInOut); UIView.SetAnimationTransition (UIViewAnimationTransition.CurlUp, this.View, true); qv.ShowQuestion (nextQuestion); UIView.CommitAnimations (); } else { this.NavigationItem.SetRightBarButtonItem (_btnDone, true); _resultView = new QuizResultView (this.View.Bounds, _quiz); if (_quiz.IsRightAnswered ()) { _resultView.Voucher = GetVoucher (); } /* _resultView.GetVoucher += (phoneNumber) => { Console.WriteLine ("Phonenumber:" + phoneNumber); }; */ UIView.BeginAnimations ("Flipper"); UIView.SetAnimationDuration (1.25); UIView.SetAnimationCurve (UIViewAnimationCurve.EaseInOut); UIView.SetAnimationTransition (UIViewAnimationTransition.FlipFromRight, this.View, true); //questionView.ViewWillAppear (true); //resultView.ViewWillDisappear (true); qv.RemoveFromSuperview (); this.View.AddSubview (_resultView); //resultView.ViewDidDisappear (true); //questionView.ViewDidAppear (true); UIView.CommitAnimations (); /* UIView.Animate (2, 6, UIViewAnimationOptions.CurveEaseInOut | UIViewAnimationOptions.TransitionFlipFromRight | UIViewAnimationOptions.AllowAnimatedContent | UIViewAnimationOptions.LayoutSubviews, () => { qv.RemoveFromSuperview (); this.View.AddSubview (_resultView);}, null); */ } }