MultidiskBundler - add a RequiredService of IEmulator and use that property instead of Global.Emulator

This commit is contained in:
adelikat 2016-12-04 12:34:37 -06:00
parent 5258f9385c
commit b11a76f739
2 changed files with 11 additions and 8 deletions

View File

@ -1,7 +1,5 @@
using BizHawk.Client.Common;
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
@ -10,8 +8,10 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Xml.Linq;
using BizHawk.Client.EmuHawk.WinFormExtensions;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.WinFormExtensions;
namespace BizHawk.Client.EmuHawk
{
@ -19,6 +19,9 @@ namespace BizHawk.Client.EmuHawk
{
private XElement _currentXml = null;
[RequiredService]
public IEmulator Emulator { get; set; }
public MultiDiskBundler()
{
InitializeComponent();
@ -46,9 +49,9 @@ namespace BizHawk.Client.EmuHawk
NameBox.Text = Path.ChangeExtension(GlobalWin.MainForm.CurrentlyOpenRom, ".xml");
}
if (SystemDropDown.Items.Contains(Global.Emulator.SystemId))
if (SystemDropDown.Items.Contains(Emulator.SystemId))
{
SystemDropDown.SelectedItem = Global.Emulator.SystemId;
SystemDropDown.SelectedItem = Emulator.SystemId;
}
FileSelectors.First().SetName(GlobalWin.MainForm.CurrentlyOpenRom);

View File

@ -104,8 +104,8 @@ namespace BizHawk.Client.EmuHawk
public void UpdateValues()
{
UseCurrentRomButton.Enabled = Global.Emulator != null // For the designer
&& !string.IsNullOrEmpty(GlobalWin.MainForm.CurrentlyOpenRom)
UseCurrentRomButton.Enabled =
!string.IsNullOrEmpty(GlobalWin.MainForm.CurrentlyOpenRom)
&& !GlobalWin.MainForm.CurrentlyOpenRom.Contains(".xml"); // Can't already be an xml
}