Exemple #1
0
        static void Main(string[] args)
        {
            Initialize();

            bool             playing          = true;
            Game             game             = new Game();
            CollectionScreen collectionScreen = new CollectionScreen();
            SettingsScreen   settingsScreen   = new SettingsScreen();

            Title title = new Title();

            while (playing)
            {
                title.Setup();
                title.Play();
                title.Hide();

                TitleOption option = title.SelectedOption;

                //Ends the loop if the user selects Exit
                if (option == TitleOption.Exit)
                {
                    playing = false;
                }

                //Gets the screen that the player selected
                Screen screen = null;
                switch (option)
                {
                case TitleOption.Play:
                    screen = game;
                    break;

                case TitleOption.Collection:
                    screen = collectionScreen;
                    break;

                case TitleOption.Settings:
                    screen = settingsScreen;
                    break;
                }

                if (screen != null)
                {
                    screen.Setup();
                    screen.Play();
                    screen.Hide();
                }
            }

            //Saves the settings and collection files
            Collection.WriteToFile(COLLECTION_FILE);
            Settings.WriteToFile(SETTINGS_FILE);

            //Sets the console text color to white so that the output can be read.
            Console.ForegroundColor = ConsoleColor.White;
        }
        public MainWindow()
        {
            InitializeComponent();
            vm = new MyViewModel(new Model.MyModel());
            Controls.ToolBar tb = new Controls.ToolBar(vm);
            contentPanel.Children.Add(tb);
            CollectionScreen cs = new CollectionScreen(vm);

            collectionPanel.Children.Add(cs);
        }