コード例 #1
0
 /// <summary>
 /// Load all usercontrols and put their visibility to hidden
 /// </summary>
 private void allocate_All_UC()
 {
     startRoom = new StartingRoom();
     room = new Room();
     
     // Add usercontrol as sons of MainWindow
     mainGrid.Children.Add(startRoom);
     mainGrid.Children.Add(room);
     startRoom.Visibility = Visibility.Hidden;
     room.Visibility = Visibility.Hidden;
 }
コード例 #2
0
        /// <summary>
        /// Called by the delegate <see cref="UnloadGameHandler"/> to handle the event <see cref="GameController.UnloadGame"/> 
        /// that occure when the <see cref="Model.Game"/> must be saved and unloaded
        /// </summary>
        /// <param name="Parameters">Instance of an object repressenting the class <see cref="GameController.UnloadGame.Arguments"/> 
        /// which contains information passed by the event <see cref="GameController.UnloadGame"/></param>
        private void UnloadGame(GameController.UnloadGame.Arguments Parameters)
        {
            txtDisplay.IsEnabled = true;
          //  txtDisplay.Visibility = Visibility.Visible;
            txtDisplay.Text = Thread.CurrentThread.Name + " --- Unload";

            disable_Buttons_Labels();

            title_game.Visibility = Visibility.Visible;

            ib = null;
            backgroundPath = Application.Current.Resources[E_GenericImages.Application_Start_Image.ToString()].ToString();
            ib = new ImageBrush();
            ib.ImageSource = new BitmapImage(new Uri(@backgroundPath, UriKind.Absolute));
            this.Background = ib;

            mainGrid.Children.Remove(startRoom);
            mainGrid.Children.Remove(room);
 
            startRoom = null;
            room = null;

            GC.Collect();
            GC.WaitForPendingFinalizers();

            this.Background.Opacity = 1;
            
            Delete_Sketches_Files_On_Unload();

            /*System.Windows.Forms.Application.Restart();
            Thread.Sleep(2000);
            Application.Current.Shutdown();*/
        }