public HighScoresDialog(MapLearnerRegion region)
        {
            this.InitializeComponent();
            XmlServiceClient client = XmlServiceClient.Instance;

            HighScoresList.ItemsSource = client.SavedData.HighScoresData.Where(x => x.Region == region).OrderBy(x => x.CompletedTime);
        }
Ejemplo n.º 2
0
        private string getFileLocation(MapLearnerRegion type)
        {
            if (flieLocationsDictionary == null)
            {
                throw new ArgumentNullException("The flieLocationsDictionary is currently null");
            }

            return(flieLocationsDictionary[type]);
        }
Ejemplo n.º 3
0
        public MapLearner(MapLearnerRegion region, int numberOfStates = 10)
        {
            xmlServiceClient = XmlServiceClient.Instance;

            index  = 0;
            Region = region;

            List <State> stateList = shuffleList(xmlServiceClient.getListOfStates(Region));

            States = randomlySelectItemsFromList(stateList, numberOfStates);
        }
Ejemplo n.º 4
0
        public List <State> getListOfStates(MapLearnerRegion type)
        {
            string fileLocation = getFileLocation(type);

            XmlSerializer xmlSerializer = new XmlSerializer(typeof(List <State>));

            using (XmlReader reader = getXDocument(fileLocation).Root.CreateReader())
            {
                return((List <State>)xmlSerializer.Deserialize(reader));
            }
        }
        public static List <State> getTestData(MapLearnerRegion region)
        {
            switch (region)
            {
            case MapLearnerRegion.UnitedStates:
                return(getUnitedStatesTestData());

            case MapLearnerRegion.NorthAmerica:
                return(getNorthAmericaTestData());

            default:
                throw new ArgumentException("Something has gone horribly wrong. A MapLearner for this region could not be created");
            }
        }
Ejemplo n.º 6
0
        public static string convertRegionToString(MapLearnerRegion region, bool addSpaces = false)
        {
            switch (region)
            {
            case MapLearnerRegion.NorthAmerica:
                return(addSpaces ? "North America" : "NorthAmerica");

            case MapLearnerRegion.UnitedStates:
                return(addSpaces ? "United States" : "UnitedStates");

            default:
                throw new ArgumentException("Something has gone horribly wrong. This MapLearnerRegion could not be converted into string format.");
            }
        }
Ejemplo n.º 7
0
        private Dictionary <MapLearnerRegion, string> getFileLocationsDictionary()
        {
            Dictionary <MapLearnerRegion, string> flieLocationsDictionary = new Dictionary <MapLearnerRegion, string>();

            XPathDocument     fileLocaitonsDocument = getXPathDocument(fileLocationsPath);
            XPathNavigator    navigator             = fileLocaitonsDocument.CreateNavigator();
            XPathNodeIterator iterator = navigator.Select("/fileLocations/fileLocation");

            foreach (XPathNavigator value in iterator)
            {
                string           strCurrentType = value.SelectSingleNode(navigator.Compile("type")).Value;
                MapLearnerRegion type           = MapLearnerRegionHelper.convertStringToRegion(strCurrentType);

                string fileLocation = value.SelectSingleNode(navigator.Compile("filePath")).Value;

                flieLocationsDictionary.Add(type, fileLocation);
            }

            return(flieLocationsDictionary);
        }
Ejemplo n.º 8
0
 private void newGame(MapLearnerRegion region)
 {
     mapLearner = new MapLearner(region);
     initializeBoard();
 }