]> Dogcows Code - chaz/carfire/blobdiff - Project06/CS 3505 Project 06/CS 3505 Project 06/LobbyGUI.cs
New delegate method for getting and handling errors during the async calls. Need...
[chaz/carfire] / Project06 / CS 3505 Project 06 / CS 3505 Project 06 / LobbyGUI.cs
index 3a7d8753afa18bb05eecb31d917148ca1d59d1bd..78ee37b7a9912c9dad0ebf700bf7b83be60d9dd7 100644 (file)
@@ -165,6 +165,14 @@ namespace CS_3505_Project_06
             }\r
         }\r
 \r
+        // TODO: New method.\r
+        void AsyncCallbackFailed(Exception exception, NetworkGame networkGame)\r
+        {\r
+            currentState = lobbyState.Welcome;\r
+            Console.WriteLine("Exception as thrown during async call: " + exception.Message);\r
+        }\r
+\r
+\r
         public long Update(GameTime gameTime, NetworkGame networkGame)\r
         {\r
             \r
@@ -210,6 +218,7 @@ namespace CS_3505_Project_06
                     if (currentKeyboardState.IsKeyDown(Keys.Y) && previousKeyboardState.IsKeyUp(Keys.Y))\r
                     {\r
                         currentState = lobbyState.JoiningGame;\r
+                        networkGame.ErrorDelegate = AsyncCallbackFailed;\r
                         networkGame.CreateSession(JoinedSession);\r
                     }   \r
                     break;\r
@@ -220,6 +229,7 @@ namespace CS_3505_Project_06
                         currentState = lobbyState.Welcome;\r
                         ready = false;\r
                     }\r
+                    networkGame.ErrorDelegate = AsyncCallbackFailed;\r
                     networkGame.FindSessions(FoundSessions);\r
                     currentState = lobbyState.FindingGames;\r
                     break;\r
This page took 0.021739 seconds and 4 git commands to generate.