Fixing window management issues

This commit is contained in:
Michael Becker 2014-06-25 15:05:05 -04:00
parent 21a8a80399
commit 0f2ab745ef
2 changed files with 22 additions and 5 deletions

View File

@ -378,7 +378,7 @@ namespace UniversalEditor.UserInterface.WindowsForms
}
}
public override void OpenWindow(params string[] FileNames)
protected override IHostApplicationWindow OpenWindowInternal(params string[] FileNames)
{
MainWindow mw = new MainWindow();
@ -387,8 +387,7 @@ namespace UniversalEditor.UserInterface.WindowsForms
mw.OpenFile(FileNames);
}
mw.Show();
Windows.Add(mw);
return mw;
}
public override void ExitApplication()

View File

@ -259,15 +259,33 @@ namespace UniversalEditor.UserInterface
public void OpenFile(params string[] FileNames)
{
if (LastWindow == null)
{
OpenWindow(FileNames);
return;
}
LastWindow.OpenFile(FileNames);
}
/// <summary>
/// Opens a new window, optionally loading the specified documents.
/// </summary>
/// <param name="FileNames">The file name(s) of the document(s) to load.</param>
public virtual void OpenWindow(params string[] FileNames)
{
/// <returns>An <see cref="IHostApplicationWindow"/> representing the window that was created.</returns>
protected abstract IHostApplicationWindow OpenWindowInternal(params string[] FileNames);
/// <summary>
/// Opens a new window, optionally loading the specified documents.
/// </summary>
/// <param name="FileNames">The file name(s) of the document(s) to load.</param>
public void OpenWindow(params string[] FileNames)
{
IHostApplicationWindow window = OpenWindowInternal(FileNames);
window.WindowClosed += delegate(object sender, EventArgs e)
{
mvarWindows.Remove(window);
};
mvarWindows.Add(window);
}
// UniversalDataStorage.Editor.WindowsForms.Program