Beispiel #1
0
        /// <summary>
        /// It updates the scores in the file and in the list view.
        /// </summary>
        /// <param name="score">The score.</param>
        /// <param name="listView">The ListView</param>
        public void UpdateScores(ScoreArgs score, ListView listView)
        {
            scores.Add(score);
            scores.Sort();
            XMLSerializerUtility.XMLSerialize(scores);
            int index = 0;

            listView.Items.Clear();
            foreach (ScoreArgs item in scores)
            {
                listView.Items.Insert(index++, item);
            }
        }
Beispiel #2
0
        /// <summary>
        /// It populates the scores by reading from the scores file.
        /// </summary>
        /// <param name="listView">The ListView</param>
        public void PopulateScores(ListView listView)
        {
            int index = 0;

            scores = XMLSerializerUtility.XMLDeSerialize <ScoreArgs>();
            if (scores != null)
            {
                scores.Sort();
                foreach (ScoreArgs item in scores)
                {
                    listView.Items.Insert(index++, item);
                }
            }
            else
            {
                scores = new List <ScoreArgs>();
            }
        }
Beispiel #3
0
 /// <summary>
 /// Calls DeserializeXMLFile to serialize data from an xml file
 /// </summary>
 /// <param name="filePath">path of file to save data to</param>
 /// <returns></returns>
 public void XMLDeserialize(string filePath)
 {
     List <T> deserializedList = AddDeserializedObjectsToListManager(XMLSerializerUtility.DeserializeXMLFile <List <T> >(filePath));
 }
Beispiel #4
0
 /// <summary>
 /// Calls SerializeXMLFile to serialize data to an xml file
 /// </summary>
 /// <param name="filePath">path of file to save data to</param>
 public void XMLSerialize(string filePath)
 {
     XMLSerializerUtility.SerializeXMLFile(filePath, objects);
 }