private void init()
        {
            decks = new List <CardSet>();
            decks.Add(new CardSet());
            CardSet set2 = createSet2();

            decks.Add(set2);
            cardList             = new List <FlashCard>();
            buttonList           = new List <Button>();
            errorLabel           = this.FindByName <Label>("error");
            errorLabel.IsVisible = false;

            //dynamically create buttons depending on number of study sets
            StackLayout entireLayout = this.FindByName <StackLayout>("entire");
            //put scroll view around entireLayout
            StackLayout copyLayout = this.FindByName <StackLayout>("select");
            Label       copyLabel  = this.FindByName <Label>("selectText");

            foreach (CardSet cardSet in decks)
            {//create buttons dynamically
                StackLayout layout = new StackLayout();
                layout.Orientation = copyLayout.Orientation;
                Button button = new Button();
                button.WidthRequest  = 40;
                button.HeightRequest = 40;
                Label label = new Label();
                label.Text      = cardSet.getSet();
                button.Clicked += delegate(object sender, EventArgs e)
                {
                    add_Click(sender, e);
                    if (audioOn == true)
                    {
                        var text = label.Text;
                        if (button.Text == ".")
                        {
                            text = text + " select";
                        }
                        else
                        {
                            text = text + " deselect";
                        }
                        CrossTextToSpeech.Dispose();
                        CrossTextToSpeech.Current.Speak(text);
                    }
                };
                label.FontSize        = copyLabel.FontSize;
                label.FontAttributes  = copyLabel.FontAttributes;
                label.VerticalOptions = copyLabel.VerticalOptions;

                layout.Children.Add(button);
                layout.Children.Add(label);
                entireLayout.Children.Add(layout);
                buttonList.Add(button);
            }
        }
        public FinalScore()
        {
            InitializeComponent();
            audioOn = false;
            int score = 0;

            set = new CardSet();
            Label finalScore = this.FindByName <Label>("finalScore");

            finalScore.Text = score.ToString();
        }
        public Memory(List <Student> users, CardSet list, bool audio)
        {
            InitializeComponent();
            studentList = users;
            set         = list;
            audioOn     = audio;
            String           name    = set.getSet();
            List <FlashCard> myCards = new List <FlashCard>();

            foreach (FlashCard card in list.getCards())
            {
                myCards.Add(card);
            }
            copy = new CardSet(name, myCards);
            start();
        }
        public FinalScore(List <Student> users, double grade, CardSet deck, bool audio)
        {
            InitializeComponent();
            studentList = users;
            score       = grade;
            set         = deck;
            audioOn     = audio;
            Label finalScore = this.FindByName <Label>("finalScore");

            finalScore.Text = score.ToString();
            Label listScores = this.FindByName <Label>("highScore");

            //add user's grade to history
            studentList.First().addScore(new Score(set.getSet(), grade));
            //show user's high score
            Student user   = studentList.First();
            String  numStr = "";
            int     k      = 0;

            foreach (Score scr in user.getGrades())
            {
                if (scr.getName() == set.getSet())//compare scores of same game
                {
                    numStr += scr.getNum().ToString() + "\n";
                    k++;
                    if (k >= 5) //list 5 max scores
                    {
                        break;
                    }
                }
            }
            listScores.Text = numStr;
            if (audioOn == true)
            {
                var text = "final score " + score.ToString();
                CrossTextToSpeech.Current.Speak(text);
            }
        }
예제 #5
0
        public Games(List <Student> users, CardSet list, bool audio)
        {
            InitializeComponent();
            studentList = users;
            set         = list;
            audioOn     = audio;
            if (audioOn == true)
            {
                CrossTextToSpeech.Current.Speak("Games");
            }

            findScores();

            Shuffle <FlashCard> st = new Shuffle <FlashCard>(set.getCards());

            set.setCards(st.getList());
            int num = set.getCards().Count;

            foreach (FlashCard card in set.getCards())
            { //shuffle each card point
                Shuffle <String> cd = new Shuffle <String>(card.getPoints());
                card.setPoints(cd.getList());
            }
        }
예제 #6
0
 public CardSet(CardSet Object)
 {
     set   = Object.set;
     cards = Object.cards;
 }
예제 #7
0
 public bool equals(CardSet Object)
 {
     return((Object.set.Equals(set) && (Object.cards.Equals(cards))));
 }
예제 #8
0
 public Games()
 {
     InitializeComponent();
     set     = new CardSet();
     audioOn = false;
 }