public AddRoom(CreateRoomDelegate delegat, string token) { InitializeComponent(); context = new CreateRoomVM(token); DataContext = context; this.delegat = delegat; }
private void CreateRoomButton_Click(object sender, RoutedEventArgs e) { CreateRoomDelegate delegat = CreateRoom; AddRoom ar = new AddRoom(delegat, token); ar.Show(); }
public void GoToRoom(CreateRoomDelegate factory) { PreviousRoom = CurrentRoom; if (PreviousRoom != null) CleanupPreviousRoom(); CurrentRoom = factory(this); ReturnRoom = null; }
delegate void CreateRoomDelegate(int tableIndex); //The GobangRoom(tables) components in panel will be altered(disabled). So a delegate shall be created private void CreateRoom(int tableIndex) { if (this.InvokeRequired == true) { CreateRoomDelegate d = new CreateRoomDelegate(CreateRoom); this.Invoke(d, tableIndex); } else { playingTable = new PlayingTable(tableIndex, side, sw); playingTable.Show(); //Show the PlayingTable Form !!!Now the window has transfer to the PlayingTable for (int i = 0; i < tables.Length; i++) //Invalidate all the table(GobangRoom) component { tables[i].Enabled = false; } this.WindowState = FormWindowState.Minimized; } }
public void GoToRoomThenReturn(CreateRoomDelegate factory, RoomBase returnRoom) { PreviousRoom = CurrentRoom; CurrentRoom = factory(this); ReturnRoom = returnRoom; }