Beispiel #1
0
        public string RecommendedOut(int TotalOut)

        //This gets the out from the classes and vocalizes the words
        {
            string strOut    = "";
            int    dartCount = 0;

            OutCalculator clsOutCalc = new OutCalculator(InOutRule.Double);
            List <Dart>   recOut     = clsOutCalc.GetDartsForOut(TotalOut);

            StringBuilder sb = new StringBuilder();

            foreach (Dart mDart in recOut)
            {
                sb.Append(recOut[dartCount].ToString());
                dartCount++;
            }

            string strOutText = sb.ToString();

            //If it's not time to stop
            if (App.numberOfTimes != 0)
            {
                TextToSpeech.SpeakAsync(strOutText);
                App.numberOfTimes--;
            }
            else
            {
                Debug.Print("Heya");
            }

            return(strOut);
        }
Beispiel #2
0
        private void OnGetOutClicked(object sender, EventArgs args)
        {
            string        scoreStr      = YourScore.Text;
            int           score         = int.Parse(scoreStr);
            OutCalculator outCalculator = new OutCalculator(InOutRule.Double);
            List <Dart>   outs          = outCalculator.GetDartsForOut(score);

            StringBuilder stringBuilder = new StringBuilder();

            for (int i = 0; i < outs.Count; i++)
            {
                stringBuilder.Append(outs[i].Abbreviation);
                if (i != outs.Count - 1)
                {
                    stringBuilder.Append(", ");
                }
            }

            string text = stringBuilder.ToString();

            OutLabel.Text = text;
        }