コード例 #1
0
 public Showgames(ServiceClient client, string username)
 {
     InitializeComponent();
     Client   = client;
     Username = username;
     try
     {
         Dictionary <int, GameInfo> Games = Client.GetGames();                                //we call the function GetGames to get all the games in the dataBase,live and not live games
         var l = from g in Games select g.Value.FParticipant + " VS " + g.Value.SParticipant; //show all the games
         if (l.Count() > 0)
         {
             LBox.ItemsSource = l;
         }
         else
         {
             LBox.Items.Add("Games table empty");
         }
     }
     catch (TimeoutException)
     {
         MessageBox.Show(" connection unstable , it took to long to get a response, unable to connect try again later", Username + " connection unstable");
         this.Close();
     }
     catch (CommunicationObjectFaultedException)
     {
         MessageBox.Show(" connection unstable , it took to long to get a response, unable to connect try again later", Username + " connection unstable");
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), Username);
     }
 }