Ram Watch - Hook up AskSave to appropriate functions

This commit is contained in:
andres.delikat 2011-01-21 05:23:44 +00:00
parent ff7271c2e2
commit 52f968e379
1 changed files with 23 additions and 11 deletions

View File

@ -70,15 +70,21 @@ namespace BizHawk.MultiClient
public void LoadWatchFromRecent(string file) public void LoadWatchFromRecent(string file)
{ {
bool r = LoadWatchFile(file, false); bool z = true;
if (!r) if (changes) z = AskSave();
if (z)
{ {
DialogResult result = MessageBox.Show("Could not open " + file + "\nRemove from list?", "File not found", MessageBoxButtons.YesNo, MessageBoxIcon.Error); bool r = LoadWatchFile(file, false);
if (result == DialogResult.Yes) if (!r)
Global.Config.RecentWatches.Remove(file); {
DialogResult result = MessageBox.Show("Could not open " + file + "\nRemove from list?", "File not found", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
if (result == DialogResult.Yes)
Global.Config.RecentWatches.Remove(file);
}
DisplayWatchList();
changes = false;
} }
DisplayWatchList();
changes = false;
} }
private void NewWatchList() private void NewWatchList()
@ -86,7 +92,7 @@ namespace BizHawk.MultiClient
bool result = true; bool result = true;
if (changes) result = AskSave(); if (changes) result = AskSave();
if (AskSave() == true) if (result == true)
{ {
watchList.Clear(); watchList.Clear();
DisplayWatchList(); DisplayWatchList();
@ -293,7 +299,6 @@ namespace BizHawk.MultiClient
private void newListToolStripMenuItem_Click(object sender, EventArgs e) private void newListToolStripMenuItem_Click(object sender, EventArgs e)
{ {
NewWatchList(); NewWatchList();
//TODO: prompt to save changes if necessary;
} }
private FileInfo GetFileFromUser() private FileInfo GetFileFromUser()
@ -317,8 +322,15 @@ namespace BizHawk.MultiClient
{ {
var file = GetFileFromUser(); var file = GetFileFromUser();
if (file != null) if (file != null)
LoadWatchFile(file.FullName, false); {
DisplayWatchList(); bool r = true;
if (changes) r = AskSave();
if (r)
{
LoadWatchFile(file.FullName, false);
DisplayWatchList();
}
}
} }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) private void saveToolStripMenuItem_Click(object sender, EventArgs e)