Exemplo n.º 1
0
 /// <summary>
 /// Invoked when this page is about to be displayed in a Frame.
 /// </summary>
 /// <param name="e">Event data that describes how this page was reached.  The Parameter
 /// property is typically used to configure the page.</param>
 protected override async void OnNavigatedTo(NavigationEventArgs e)
 {
     try
     {
         /*_localFolder = KnownFolders.DocumentsLibrary;
          *
          * MatchReplay replay;
          *
          * using (Stream s = await _localFolder.OpenStreamForReadAsync("replay.out"))
          * {
          *  var serializer = new DataContractSerializer(typeof(MatchReplay));
          *  replay = serializer.ReadObject(s) as MatchReplay;
          * }*/
         var               locator = new ServiceLocator();
         MatchReplay       replay  = locator.Rep.Data;
         ReplayDescription rD      = locator.RepDesc;
         ReplayName.Text += rD.Name;
         _worldParams     = replay.Events.OfType <SystemEventWorldCreated>().First();
         _worldWidth      = _worldParams.Width;
         _worldHeight     = _worldParams.Height;
         _turns           = MakeTurns(replay.Events);
     }
     catch (Exception ex)
     {
     }
 }
Exemplo n.º 2
0
        public static List <ReplayDescription> GetListOfReplays(Guid accountID)
        {
            try
            {
                List <ReplayDescription> userreplays = new List <ReplayDescription>();

                List <Game> usergames = (from g in db.Game
                                         where g.Creator_ID == accountID
                                         select g).ToList <Game>();

                foreach (Game g in usergames)
                {
                    List <TeamDescription> teamsingame = new List <TeamDescription>();

                    foreach (Team t in (from t in db.Teams
                                        where t.GameGame_ID == g.Game_ID
                                        select t))
                    {
                        TeamDescription tdesc = new TeamDescription();
                        tdesc.ID         = t.Team_ID;
                        tdesc.Intellects = new List <Guid>();

                        foreach (Intellect i in t.Intellects)
                        {
                            tdesc.Intellects.Add(i.Intellect_ID);
                        }
                    }

                    ReplayDescription replay = new ReplayDescription();

                    replay.ID    = g.Game_ID;
                    replay.Name  = g.Game_Name;
                    replay.Teams = teamsingame;

                    userreplays.Add(replay);
                }

                return(userreplays);
            }
            catch (Exception e)
            {
                return(null);
            }
        }