예제 #1
0
        private void InitializeOutChart()
        {
            OutCalculator outCalculator            = new OutCalculator(InOutRule.Double);
            List <String> allOutsList              = new List <String>();
            Dictionary <int, List <Dart> > allOuts = outCalculator.GetAllOuts();

            // iterate through the dictionary to get all the outs
            foreach (KeyValuePair <int, List <Dart> > entry in allOuts)
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append(entry.Key.ToString());
                stringBuilder.Append(": ");

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

                string outItemText = stringBuilder.ToString();
                allOutsList.Add(outItemText);
            }

            MyList.ItemsSource = allOutsList;
        }
예제 #2
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);
        }
예제 #3
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;
        }