Fixed crash:

If clicking Cancel on Import Config the program crashed
This commit is contained in:
NicoAICP 2020-04-09 00:28:21 +02:00
parent 8b759ec064
commit 52b2c321e7
2 changed files with 10 additions and 12 deletions

View file

@ -592,7 +592,7 @@ namespace UWUVCI_AIO_WPF
}
return false;
}
public string selectConfig()
public void selectConfig(GameConsoles console)
{
string ret = string.Empty;
using (var dialog = new System.Windows.Forms.OpenFileDialog())
@ -602,9 +602,14 @@ namespace UWUVCI_AIO_WPF
if (res == DialogResult.OK)
{
ret = dialog.FileName;
if (GetConsoleOfConfig(ret, console))
{
ImportConfig(ret);
MessageBox.Show("Please re-select a base!");
}
}
}
return ret;
}
public string GetFilePath(bool ROM, bool INI)

View file

@ -21,10 +21,12 @@ namespace UWUVCI_AIO_WPF.UI.Frames
public partial class INJECTFRAME : Page, IDisposable
{
MainViewModel mvm;
GameConsoles console;
public INJECTFRAME(GameConsoles console)
{
mvm = FindResource("mvm") as MainViewModel;
InitializeComponent();
this.console = console;
if(console == GameConsoles.N64)
{
fLoadConfig.Content = new InjectFrames.Configurations.N64Config();
@ -47,17 +49,8 @@ namespace UWUVCI_AIO_WPF.UI.Frames
private void Button_Click(object sender, RoutedEventArgs e)
{
//import config
string s = mvm.selectConfig();
mvm.selectConfig(console);
if (s != null)
{
if (mvm.GetConsoleOfConfig(s, mvm.GameConfiguration.Console))
{
mvm.ImportConfig(s);
MessageBox.Show("Please re-select a base!");
}
}
}