Esempio n. 1
0
        /// <summary>
        /// Do work with the main menu.
        /// </summary>
        public override void DoWork(IMainMenu mainMenu)
        {
            // Show the open file dialog and try and load the ROM.
            using (var dialog = new OpenFileDialog())
            {
                // Only continue if the user chose a file.
                if (dialog.ShowDialog() != DialogResult.OK) { return; }

                // Try and load the rom.
                if (!mainMenu.Rom.Load(dialog.FileName)) { return; }

                // Enable the menu items.
                mainMenu.GetButtonItem("Save").Enabled = true;
                mainMenu.GetButtonItem("Save All").Enabled = true;
                mainMenu.GetButtonItem("Properties").Enabled = true;
                mainMenu.GetMenuItem(@"&File\&Close").Enabled = true;
                mainMenu.GetMenuItem(@"&File\&Save").Enabled = true;
                mainMenu.GetMenuItem(@"&File\Save &All").Enabled = true;
                mainMenu.GetMenuItem(@"&View\&New Game Values").Enabled = true;
                mainMenu.GetMenuItem(@"&View\&Properties").Enabled = true;
                mainMenu.GetMenuItem(@"&View\&Overworld\&East Hyrule").Enabled = true;
                mainMenu.GetMenuItem(@"&View\&Overworld\&West Hyrule").Enabled = true;
                mainMenu.GetMenuItem(@"&View\&Overworld\&Maze Island").Enabled = true;
                mainMenu.GetMenuItem(@"&View\&Overworld\&Death Mountain").Enabled = true;

                // Show the Properties view.
                base.DoWork(mainMenu);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Do work with the main menu.
        /// </summary>
        public void DoWork(IMainMenu mainMenu)
        {
            // If any view cannot be closed then return.
            foreach (var view in mainMenu.Views.ToArray())
            {
                if (!mainMenu.Close(view)) { return; }
            }

            // Close the rom.
            mainMenu.Rom.Close();

            // Disable any button that is related to the ROM being open.
            mainMenu.GetButtonItem("Save").Enabled = false;
            mainMenu.GetButtonItem("Save All").Enabled = false;
            mainMenu.GetButtonItem("Properties").Enabled = false;
            mainMenu.GetMenuItem(@"&File\&Close").Enabled = false;
            mainMenu.GetMenuItem(@"&File\&Save").Enabled = false;
            mainMenu.GetMenuItem(@"&File\Save &All").Enabled = false;
            mainMenu.GetMenuItem(@"&View\&Properties").Enabled = false;
            mainMenu.GetMenuItem(@"&View\&Overworld\&East Hyrule").Enabled = false;
            mainMenu.GetMenuItem(@"&View\&Overworld\&West Hyrule").Enabled = false;
            mainMenu.GetMenuItem(@"&View\&Overworld\&Maze Island").Enabled = false;
            mainMenu.GetMenuItem(@"&View\&Overworld\&Death Mountain").Enabled = false;
        }