Exemplo n.º 1
0
        private static void OnHostFileChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            LevelHostControl hostControl = (LevelHostControl)sender;
            string           newValue    = (string)e.NewValue;

            if (!string.IsNullOrEmpty(newValue))
            {
                Uri uri = new Uri("/BeeHive;component/" + newValue, UriKind.Relative);
                StreamResourceInfo streamResourceInfo = Application.GetResourceStream(uri);
                StreamReader       sr = new StreamReader(streamResourceInfo.Stream);

                object loadedLevel = XamlReader.Load(sr.ReadToEnd());
                hostControl.PART_CONTENT.Content = loadedLevel;
            }
        }
Exemplo n.º 2
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/BeeHive;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot       = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.GameStatus       = ((System.Windows.VisualStateGroup)(this.FindName("GameStatus")));
     this.WaitStart        = ((System.Windows.VisualState)(this.FindName("WaitStart")));
     this.StartGame        = ((System.Windows.VisualState)(this.FindName("StartGame")));
     this.ShowGameOver     = ((System.Windows.VisualState)(this.FindName("ShowGameOver")));
     this.Levels           = ((System.Windows.VisualStateGroup)(this.FindName("Levels")));
     this.Level1           = ((System.Windows.VisualState)(this.FindName("Level1")));
     this.Level2           = ((System.Windows.VisualState)(this.FindName("Level2")));
     this.Level3           = ((System.Windows.VisualState)(this.FindName("Level3")));
     this.GameOverLevel    = ((System.Windows.VisualState)(this.FindName("GameOverLevel")));
     this.BeeHive          = ((System.Windows.Controls.Canvas)(this.FindName("BeeHive")));
     this.gameEnvironment  = ((BeeHive.GameEnvironment)(this.FindName("gameEnvironment")));
     this.background       = ((System.Windows.Shapes.Path)(this.FindName("background")));
     this.grid             = ((System.Windows.Controls.Image)(this.FindName("grid")));
     this.levelHostControl = ((BeeHive.LevelHostControl)(this.FindName("levelHostControl")));
     this.score            = ((System.Windows.Controls.Image)(this.FindName("score")));
     this.lives            = ((System.Windows.Controls.Image)(this.FindName("lives")));
     this.LEFT_WALL        = ((System.Windows.Controls.Image)(this.FindName("LEFT_WALL")));
     this.TOP_WALL         = ((System.Windows.Controls.Image)(this.FindName("TOP_WALL")));
     this.RIGHT_WALL       = ((System.Windows.Controls.Image)(this.FindName("RIGHT_WALL")));
     this.BOTTOM_WALL      = ((System.Windows.Controls.Image)(this.FindName("BOTTOM_WALL")));
     this.BALL             = ((System.Windows.Controls.Image)(this.FindName("BALL")));
     this.PADDLE           = ((System.Windows.Controls.Image)(this.FindName("PADDLE")));
     this.ScoreText        = ((System.Windows.Controls.TextBlock)(this.FindName("ScoreText")));
     this.LivesText        = ((System.Windows.Controls.TextBlock)(this.FindName("LivesText")));
     this.ClicktoStart     = ((System.Windows.Controls.Image)(this.FindName("ClicktoStart")));
     this.GameOver         = ((System.Windows.Controls.Image)(this.FindName("GameOver")));
     this.LastScoreText    = ((System.Windows.Controls.TextBlock)(this.FindName("LastScoreText")));
     this.HiScoreText      = ((System.Windows.Controls.TextBlock)(this.FindName("HiScoreText")));
     this.frame            = ((System.Windows.Controls.Grid)(this.FindName("frame")));
     this.masterHead       = ((System.Windows.Controls.Grid)(this.FindName("masterHead")));
     this.masterHead_bg    = ((System.Windows.Shapes.Rectangle)(this.FindName("masterHead_bg")));
     this.footer           = ((System.Windows.Shapes.Rectangle)(this.FindName("footer")));
 }