Ejemplo n.º 1
0
        private void ProcessGamertag(GamervineDataContext DataContext, Gamertag Gamertag)
        {
            XDocument xdLatestData = null;

            IDataConnector dataConnector = DataConnectorFactory.GetDataConnectorForType(Gamertag.Type);
            int            count         = 0;

            do
            {
                count++;
                xdLatestData = dataConnector.GetLatestTagData(Gamertag);
            }while (xdLatestData == null && count < 5);

            if (xdLatestData == null)
            {
                Debug.WriteLine("Unable to retrieve data from gamertag \"" + Gamertag.Tag + "\".");
                return;
            }

            IHandler dataHandler = HandlerFactory.GetHandlerForType(Gamertag.Type);

            dataHandler.ProcessData(DataContext, Gamertag, xdLatestData);

            try
            {
                DataContext.SubmitChanges();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Exception occurred in DataService.DoWork:" + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }