Window manager refactor

This commit is contained in:
Andy Adshead 2019-01-27 22:53:57 +00:00
commit 1469cac9bf

View file

@ -4,19 +4,19 @@ namespace Ryujinx.Profiler.UI
{ {
public class ProfileWindowManager public class ProfileWindowManager
{ {
private ProfileWindow Window; private ProfileWindow _window;
private Thread ProfileThread; private Thread _profileThread;
public ProfileWindowManager() public ProfileWindowManager()
{ {
if (Profile.ProfilingEnabled()) if (Profile.ProfilingEnabled())
{ {
ProfileThread = new Thread(() => _profileThread = new Thread(() =>
{ {
Window = new ProfileWindow(); _window = new ProfileWindow();
Window.Run(60, 60); _window.Run(60, 60);
}); });
ProfileThread.Start(); _profileThread.Start();
} }
} }
@ -24,21 +24,21 @@ namespace Ryujinx.Profiler.UI
{ {
if (Profile.ProfilingEnabled()) if (Profile.ProfilingEnabled())
{ {
Window.ToggleVisible(); _window.ToggleVisible();
} }
} }
public void Close() public void Close()
{ {
if (Window != null) if (_window != null)
{ {
Window.Close(); _window.Close();
Window.Dispose(); _window.Dispose();
} }
ProfileThread.Join(); _profileThread.Join();
Window = null; _window = null;
} }
} }
} }