Exemplo n.º 1
0
        private void DisplayGrade()
        {
            DisplayData data = new DisplayData();

            data.Round      = this.Round;
            data.GoldNumber = this.CurrentGoldNumber;
            foreach (KeyValuePair <string, int> pr in engine.Grade)
            {
                data.SortedGrade.Add(new Tuple <string, int>(pr.Key, pr.Value));
            }
            foreach (KeyValuePair <string, int> pr in engine.RoundGrade)
            {
                data.SortedRoundGrade.Add(new Tuple <string, int>(pr.Key, pr.Value));
            }
            foreach (Tuple <string, double> tp in engine.result)
            {
                data.result.Add(new Tuple <string, double>(tp.Item1, tp.Item2));
            }
            data.SortedRoundGrade.Sort(new cmp2());
            data.SortedGrade.Sort(new cmp2());
            string JsonData          = Microsoft.JScript.Convert.ToString(data, true);
            JavaScriptSerializer jss = new JavaScriptSerializer();

            JsonData = jss.Serialize(data);
            Monitor.LogGrade(JsonData);
            if (DisplayServer == null)
            {
                return;
            }
            DisplayServer.SendResult(JsonData);
        }
Exemplo n.º 2
0
        private void DisplayGrade()
        {
            if (DisplayServer == null)
            {
                return;
            }
            DisplayData data = new DisplayData();

            data.Round      = this.Round;
            data.GoldNumber = this.CurrentGoldNumber;
            foreach (KeyValuePair <string, int> pr in engine.Grade)
            {
                data.SortedGrade.Add(new Tuple <string, int>(pr.Key, pr.Value));
            }
            foreach (KeyValuePair <string, int> pr in engine.RoundGrade)
            {
                data.SortedRoundGrade.Add(new Tuple <string, int>(pr.Key, pr.Value));
            }
            foreach (Tuple <string, double> tp in engine.result)
            {
                data.result.Add(new Tuple <string, double>(tp.Item1, tp.Item2));
            }
            data.SortedRoundGrade.Sort(new cmp2());
            data.SortedGrade.Sort(new cmp2());
            DisplayServer.SendResult(data);
        }