private void LoadControl() { StartPanel ToControl1 = new StartPanel(); ToControl1.Name = "sp"; Grid.SetRow(ToControl1, 0); Canvas.SetZIndex(ToControl1, 9999); ToControl1.Visibility = Visibility.Collapsed; GamePanel ToControl2 = new GamePanel(); ToControl2.Name = "gp"; Grid.SetRow(ToControl2, 0); Canvas.SetZIndex(ToControl2, 9999); ToControl2.Visibility = Visibility.Collapsed; MusicListPanel ToControl3 = new MusicListPanel(false); ToControl3.Name = "mlp"; Grid.SetRow(ToControl3, 0); Canvas.SetZIndex(ToControl3, 9999); ToControl3.Visibility = Visibility.Collapsed; MusicRecordSignPanel ToControl4 = new MusicRecordSignPanel(); ToControl4.Name = "mrsp"; Grid.SetRow(ToControl4, 0); Canvas.SetZIndex(ToControl4, 9999); ToControl4.Visibility = Visibility.Collapsed; GameEndPanel ToControl5 = new GameEndPanel(); ToControl5.Name = "ge"; Grid.SetRow(ToControl5, 0); Canvas.SetZIndex(ToControl5, 9999); ToControl5.Visibility = Visibility.Collapsed; ResourceMgr.CachePanel.Add(PanelType.StartPanel, ToControl1); ResourceMgr.CachePanel.Add(PanelType.GamePanel, ToControl2); ResourceMgr.CachePanel.Add(PanelType.MusicListPanel, ToControl3); ResourceMgr.CachePanel.Add(PanelType.MusicRecordSignPanel, ToControl4); ResourceMgr.CachePanel.Add(PanelType.GameEndPanel, ToControl5); LayoutRoot.Children.Add(ToControl1); LayoutRoot.Children.Add(ToControl2); LayoutRoot.Children.Add(ToControl3); LayoutRoot.Children.Add(ToControl4); LayoutRoot.Children.Add(ToControl5); }