/// <summary> /// Constructs a menu screen listing the available network sessions. /// </summary> public JoinSessionScreen(AvailableNetworkSessionCollection availableSessions)//Audio audioHelper,Cue mystery) : base(Resources.JoinSession, false) { this.availableSessions = availableSessions; //this.audioHelper = audioHelper; //this.mystery = mystery; foreach (AvailableNetworkSession availableSession in availableSessions) { // Create menu entries for each available session. MenuEntry menuEntry = new AvailableSessionMenuEntry(availableSession); menuEntry.Selected += AvailableSessionMenuEntrySelected; MenuEntries.Add(menuEntry); // Matchmaking can return up to 25 available sessions at a time, but // we don't have room to fit that many on the screen. In a perfect // world we should make the menu scroll if there are too many, but it // is easier to just not bother displaying more than we have room for. if (MenuEntries.Count >= MaxSearchResults) { break; } } // Add the Back menu entry. MenuEntry backMenuEntry = new MenuEntry(Resources.Back); backMenuEntry.Selected += BackMenuEntrySelected; MenuEntries.Add(backMenuEntry); }
/// <summary> /// Event handler for when an available session menu entry is selected. /// </summary> void AvailableSessionMenuEntrySelected(object sender, EventArgs e) { // Which menu entry was selected? AvailableSessionMenuEntry menuEntry = (AvailableSessionMenuEntry)sender; AvailableNetworkSession availableSession = menuEntry.AvailableSession; try { // Begin an asynchronous join network session operation. IAsyncResult asyncResult = NetworkSession.BeginJoin(availableSession, null, null); // Activate the network busy screen, which will display // an animation until this operation has completed. NetworkBusyScreen busyScreen = new NetworkBusyScreen(asyncResult); busyScreen.OperationCompleted += JoinSessionOperationCompleted; ScreenManager.AddScreen(busyScreen); } catch (NetworkException exception) { ScreenManager.AddScreen(new NetworkErrorScreen(exception)); } catch (GamerPrivilegeException exception) { ScreenManager.AddScreen(new NetworkErrorScreen(exception)); } }
//Audio audioHelper,Cue mystery) /// <summary> /// Constructs a menu screen listing the available network sessions. /// </summary> public JoinSessionScreen(AvailableNetworkSessionCollection availableSessions) : base(Resources.JoinSession, false) { this.availableSessions = availableSessions; //this.audioHelper = audioHelper; //this.mystery = mystery; foreach (AvailableNetworkSession availableSession in availableSessions) { // Create menu entries for each available session. MenuEntry menuEntry = new AvailableSessionMenuEntry(availableSession); menuEntry.Selected += AvailableSessionMenuEntrySelected; MenuEntries.Add(menuEntry); // Matchmaking can return up to 25 available sessions at a time, but // we don't have room to fit that many on the screen. In a perfect // world we should make the menu scroll if there are too many, but it // is easier to just not bother displaying more than we have room for. if (MenuEntries.Count >= MaxSearchResults) break; } // Add the Back menu entry. MenuEntry backMenuEntry = new MenuEntry(Resources.Back); backMenuEntry.Selected += BackMenuEntrySelected; MenuEntries.Add(backMenuEntry); }