private void SetUp_Click(object sender, RoutedEventArgs e) { if (gameOption == null) { //옵션 창 생성 gameOption = new GameOption(); //이벤트 연결 gameOption.LevelInputEvent += new GameOption.LevelInputHandler(GameOption_LevelInputEvent); gameOption.ShowDialog(); } }
void GameOption_LevelInputEvent(int parameter) { level = parameter; SetCondition(level); GameStart(); if (gameOption != null)//옵션 창이 살아있을 경우 { gameOption.Close(); //이벤트 연결 해제 gameOption.LevelInputEvent -= new GameOption.LevelInputHandler(GameOption_LevelInputEvent); gameOption = null; } }