public void SwitchEnviromentBack() { //_pagesHistory.Peek().isActivated = false; print(_enviromentsHistory.Peek().GetType()); _enviromentsHistory.Pop(); print(_enviromentsHistory.Peek().GetType()); Enviroment enviromentActvate = null; foreach (var enviroment in _enviroments) { if (enviroment.GetType() == _enviromentsHistory.Peek().GetType()) { enviromentActvate = enviroment; //PageSetActivate(page); } else { enviroment.SetActivate(false); } } enviromentActvate.ReOpen(); }