public GameWindow(GameOptions options)
        {
            InitializeComponent();
            CreateChildrenList();
            quotes = new Quotes();
            SoundManager.backgroundMusicPlayer.Open(new Uri("GUI/Sounds/Gameplay.mp3", UriKind.Relative));
            SoundManager.backgroundMusicPlayer.Play();
            gameOptions = options;
            switch (gameOptions._TypeOfGame)
            {
                case GameOptions.TypeOfGame.QuickMatch:
                    player1 = options._Player1;
                    player2 = options._Player2;
                    gameBrain = new GameBrain(player1);
                    Player1NameText.Text = player1.Name;
                    Player2NameText.Text = player2.Name;
                    isNetwork = false;
                    break;
                case GameOptions.TypeOfGame.Network:
                    player1 = options._Player1;
                    player2 = options._Player2;
                    gameBrain = new GameBrain(player1);
                    Player1NameText.Text = player1.Name;
                    Player2NameText.Text = player2.Name;
                    networkUtil = options._NetworkUtil;
                    networkUtil.MoveReceived += new moveReceivedHandler(NetworkMoveReceived);
                    isNetwork = true;
                    break;
                case GameOptions.TypeOfGame.AI:
                    player1 = options._Player1;
                    computerPlayer = options._ComputerPlayer;
                    gameBrain = new GameBrain(player1, computerPlayer);
                    Player1NameText.Text = player1.Name;
                    Player2NameText.Text = computerPlayer.Name;
                    if (!player1.ActivePlayer)
                        GetComputerMoveAsynchronously();
                    isNetwork = false;
                    break;
                default:
                    break;
            }
            ShowActivePlayer();
            if(File.Exists(@"GUI\Images\CustomVikings\" + player1.Name + ".png"))
            {
                System.Drawing.Image img = System.Drawing.Image.FromFile(@"GUI\Images\CustomVikings\" + player1.Name + ".png");
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(img);
                BitmapSource bmpSrc = Imaging.CreateBitmapSourceFromHBitmap(bmp.GetHbitmap(),
                    IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                bmp.Dispose();
                VikingButton.Background = new ImageBrush(bmpSrc);
            }
            vikingArmPivot = new Point(167 + 40, this.Height - 420 + 121);
            zero = new Point(0, 0);
            topRight = new Point(Width, 0);
            iceGiantArmPivot = new Point(Width - 261, Height - 600);

            unMuteMusicVol = SoundManager.musicVolume / 16;
            unMuteSoundVol = SoundManager.sfxVolume / 16;
            currentMusicVol = SoundManager.musicVolume / 16;
            currentSoundVol = SoundManager.sfxVolume / 16;
            restoreMusicVol(currentMusicVol);
            restoreSoundVol(currentSoundVol);

            Stream cur = File.OpenRead("GUI/images/MouseArrow.cur");
            this.Cursor = new Cursor(cur);

            InitializeDragonOrigins();
            MakeDragonsVisble();
        }
        public GamePage(GameOptions options)
        {
            InitializeComponent();
            CreateChildrenList();
            quotes = new Quotes();
            gameOptions = options;
            switch (gameOptions._TypeOfGame)
            {
                case GameOptions.TypeOfGame.QuickMatch:
                    SoundManager.backgroundMusicPlayer.Open(new Uri("GUI/Sounds/Gameplay.mp3", UriKind.Relative));
                    SoundManager.backgroundMusicPlayer.Play();
                    player1 = options._Player1;
                    player2 = options._Player2;
                    gameBrain = new GameBrain(player1);
                    Player1NameText.Text = player1.Name;
                    Player2NameText.Text = player2.Name;
                    isNetwork = false;
                    break;
                case GameOptions.TypeOfGame.Network:
                    SoundManager.backgroundMusicPlayer.Open(new Uri("GUI/Sounds/Gameplay.mp3", UriKind.Relative));
                    SoundManager.backgroundMusicPlayer.Play();
                    player1 = options._Player1;
                    player2 = options._Player2;
                    gameBrain = new GameBrain(player1);
                    Player1NameText.Text = player1.Name;
                    Player2NameText.Text = player2.Name;
                    networkUtil = options._NetworkUtil;
                    networkUtil.MoveReceived += new moveReceivedHandler(NetworkMoveReceived);
                    networkUtil.Disconnected += new peerDisconnectedHancler(PeerDisconnected);
                    isNetwork = true;
                    break;
                case GameOptions.TypeOfGame.AI:
                    SoundManager.backgroundMusicPlayer.Open(new Uri("GUI/Sounds/Gameplay.mp3", UriKind.Relative));
                    SoundManager.backgroundMusicPlayer.Play();
                    player1 = options._Player1;
                    computerPlayer = options._ComputerPlayer;
                    gameBrain = new GameBrain(player1, computerPlayer);
                    Player1NameText.Text = player1.Name;
                    Player2NameText.Text = computerPlayer.Name;
                    if (!player1.ActivePlayer)
                        GetComputerMoveAsynchronously();
                    isNetwork = false;
                    break;
                case GameOptions.TypeOfGame.Campaign:
                    profileManager = ProfileManager.InstanceCreator();
                    levelPlay = options._LevelPlay;
                    SetUpCampaign(options._LevelPlay);
                    player1 = options._Player1;
                    computerPlayer = options._ComputerPlayer;
                    gameBrain = new GameBrain(player1, computerPlayer);
                    Player1NameText.Text = player1.Name;
                    Player2NameText.Text = computerPlayer.Name;
                    if (!player1.ActivePlayer)
                        GetComputerMoveAsynchronously();
                    isNetwork = false;
                    break;

                default:
                    break;
            }
            ShowActivePlayer();
            if (File.Exists("C:\\Users\\Public\\Documents\\Dragon Horde\\" + player1.Name + ".png"))
            {
                System.Drawing.Image img = System.Drawing.Image.FromFile("C:\\Users\\Public\\Documents\\Dragon Horde\\" + player1.Name + ".png");
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(img);
                BitmapSource bmpSrc = Imaging.CreateBitmapSourceFromHBitmap(bmp.GetHbitmap(),
                    IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                bmp.Dispose();
                VikingButton.Background = new ImageBrush(bmpSrc);
            }

            vikingArmPivot = new Point(167 + 40, System.Windows.SystemParameters.PrimaryScreenHeight - 420 + 121);
            zero = new Point(0, 0);
            topRight = new Point(System.Windows.SystemParameters.PrimaryScreenWidth, 0);
            iceGiantArmPivot = new Point(System.Windows.SystemParameters.PrimaryScreenWidth - 261, System.Windows.SystemParameters.PrimaryScreenHeight - 600);

            unMuteMusicVol = SoundManager.musicVolume / 16;
            unMuteSoundVol = SoundManager.sfxVolume / 16;
            currentMusicVol = SoundManager.musicVolume / 16;
            currentSoundVol = SoundManager.sfxVolume / 16;
            restoreMusicVol(currentMusicVol);
            restoreSoundVol(currentSoundVol);

            Stream cur = File.OpenRead("GUI/images/MouseArrow.cur");
            this.Cursor = new Cursor(cur);

            InitializeDragonOrigins();
        }
 private void FindOpponent_Click(object sender, RoutedEventArgs e)
 {
     SoundManager.playSFX(SoundManager.SoundType.Click);
     OpponentsTag.Visibility = Visibility.Visible;
     if (networkUtil == null)
     {
         networkUtil = new PentagoNetwork(NameBox.Text);
     }
     else
     {
         networkUtil.Discovered -= new peerDiscoveredHandler(PeerListChanged);
         networkUtil.ConnectionRequest -= new peerConnectionRequestHandler(ConnectionRequest);
         networkUtil.Connected -= new peerConnectedHandler(PeerConnected);
         //networkUtil.Disconnected -= new peerDisconnectedHancler(PeerDisconnected);
         networkUtil.PlayerRemoved -= new playerRemovedHandler(PeerListChanged);
         networkUtil.stop();
         networkUtil = new PentagoNetwork(NameBox.Text);
     }
     networkUtil.Discovered += new peerDiscoveredHandler(PeerListChanged);
     networkUtil.ConnectionRequest += new peerConnectionRequestHandler(ConnectionRequest);
     networkUtil.Connected += new peerConnectedHandler(PeerConnected);
     //networkUtil.Disconnected += new peerDisconnectedHancler(PeerDisconnected);
     networkUtil.PlayerRemoved += new playerRemovedHandler(PeerListChanged);
     Searching_for_Opponents.Visibility = Visibility.Visible;
 }