Ejemplo n.º 1
0
        void ReleaseDesignerOutlets()
        {
            if (FinishedButton != null)
            {
                FinishedButton.Dispose();
                FinishedButton = null;
            }

            if (ImageCountLabel != null)
            {
                ImageCountLabel.Dispose();
                ImageCountLabel = null;
            }

            if (ImageLabel != null)
            {
                ImageLabel.Dispose();
                ImageLabel = null;
            }

            if (imageStackLabel != null)
            {
                imageStackLabel.Dispose();
                imageStackLabel = null;
            }

            if (ImageViewSession != null)
            {
                ImageViewSession.Dispose();
                ImageViewSession = null;
            }

            if (IndependentButton != null)
            {
                IndependentButton.Dispose();
                IndependentButton = null;
            }

            if (LeftArrow != null)
            {
                LeftArrow.Dispose();
                LeftArrow = null;
            }

            if (MissedButton != null)
            {
                MissedButton.Dispose();
                MissedButton = null;
            }

            if (PromptedButton != null)
            {
                PromptedButton.Dispose();
                PromptedButton = null;
            }

            if (RightArrow != null)
            {
                RightArrow.Dispose();
                RightArrow = null;
            }

            if (StatsLabel != null)
            {
                StatsLabel.Dispose();
                StatsLabel = null;
            }
        }
Ejemplo n.º 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = AppColors.LIGHT_TEAL;
            // Perform any additional setup after loading the view, typically from a nib.

            /*
             * Initialize the gesture recongizers
             */
            UISwipeGestureRecognizer SwipeRight = new UISwipeGestureRecognizer(Prev);

            SwipeRight.Direction = UISwipeGestureRecognizerDirection.Right;


            UISwipeGestureRecognizer SwipeLeft = new UISwipeGestureRecognizer(Next);

            SwipeLeft.Direction = UISwipeGestureRecognizerDirection.Left;

            UITapGestureRecognizer doubleTap = new UITapGestureRecognizer(HandleDoubleTap);

            doubleTap.NumberOfTapsRequired = 2;

            UITapGestureRecognizer singleTapRight = new UITapGestureRecognizer(HandleRightArrowClick);

            singleTapRight.NumberOfTapsRequired = 1;

            UITapGestureRecognizer singleTapLeft = new UITapGestureRecognizer(HandleLeftArrowClick);

            singleTapLeft.NumberOfTapsRequired = 1;


            /*Show image in ImageViewSessionView from ImageDatabase
             * get all image stacks from the category
             */

            List <ImageStackCategory> ImageStacks = new DatabaseContext <ImageStackCategory>().GetQuery("SELECT * From ImageStackCategory WHERE ParentCategoryID = ?", CurrentCategory.ID.ToString());

            //Get all images from that image stack
            foreach (ImageStackCategory imageStack in ImageStacks)
            {
                ImageStackNames.Add(imageStack.ImageStackName.ToString());
                List <ImageStackImages> ImageStackList = new DatabaseContext <ImageStackImages>().GetQuery("SELECT * From ImageStackImages WHERE ParentImageStackID =? Order By ImageStackIndex ASC", imageStack.ID.ToString());

                //randomize images if enabled
                if (imageStack.RandomizeImageStack)
                {
                    ImageStackList = RandomizeImageStackIfEnabled(ImageStackList);
                }
                ImageStack2D.Add(ImageStackList);
            }
            MissedButton.TouchUpInside += (sender, e) => Missed();
            UIImage missedImageBtn = UIImage.FromFile("Incorrect-Icon.png");

            MissedButton.SetImage(missedImageBtn, UIControlState.Normal);

            PromptedButton.TouchUpInside += (sender, e) => Prompted();
            UIImage promptedBtn = UIImage.FromFile("Help-Icon.png");

            PromptedButton.SetImage(promptedBtn, UIControlState.Normal);

            IndependentButton.TouchUpInside += (sender, e) => Independent();
            UIImage independentBtn = UIImage.FromFile("Individual-Icon.png");

            IndependentButton.SetImage(independentBtn, UIControlState.Normal);

            FinishedButton.TouchUpInside += (sender, e) =>
            {
                /*
                 * Finished Button Handler
                 * Return to the homescreen.
                 */
                finishedScreen.setSession(_Session);
                finishedScreen.setAttempted(_Attempted);
                finishedScreen.setCorrect(_Correct);
                Parent.DismissViewController(true, null);
                Parent.PresentViewController(finishedScreen, true, null);
            };
            LeftArrow.AddGestureRecognizer(singleTapLeft);
            LeftArrow.UserInteractionEnabled = true;
            RightArrow.AddGestureRecognizer(singleTapRight);
            RightArrow.UserInteractionEnabled = true;

            /*
             * Add the Gesture Recognizers to the ImageViewSession Only.
             */
            View.UserInteractionEnabled = true;
            View.AddGestureRecognizer(doubleTap);
            View.AddGestureRecognizer(SwipeRight);
            View.AddGestureRecognizer(SwipeLeft);

            if (!CurrentProfile.showLabelSettings)
            {
                //hide the label
                ImageLabel.Hidden      = true;
                imageStackLabel.Hidden = true;
            }
            if (!CurrentProfile.showImageSettings)
            {
                //hide the image
                ImageViewSession.Alpha = 0.0f;
            }
            StartSession();
        }