diff --git a/BizHawk.Client.EmuHawk/AboutBox.cs b/BizHawk.Client.EmuHawk/AboutBox.cs index cf4643b863..0c552ff6a5 100644 --- a/BizHawk.Client.EmuHawk/AboutBox.cs +++ b/BizHawk.Client.EmuHawk/AboutBox.cs @@ -192,7 +192,8 @@ namespace BizHawk.Client.EmuHawk private void btnBizBox_Click(object sender, EventArgs e) { - new BizBox().ShowDialog(); + using var bizBox = new BizBox(); + bizBox.ShowDialog(); } } diff --git a/BizHawk.Client.EmuHawk/CustomControls/TextDebugView.cs b/BizHawk.Client.EmuHawk/CustomControls/TextDebugView.cs index 4baad2400f..33f83808ac 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/TextDebugView.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/TextDebugView.cs @@ -15,9 +15,8 @@ namespace BizHawk.Client.EmuHawk { base.OnPaint(e); e.Graphics.Clear(SystemColors.Control); - Font font = new Font(new FontFamily("Courier New"), 8); + using var font = new Font(new FontFamily("Courier New"), 8); e.Graphics.DrawString(Text, font, Brushes.Black,0,0); - font.Dispose(); } public override string Text diff --git a/BizHawk.Client.EmuHawk/Extensions/ControlExtensions.cs b/BizHawk.Client.EmuHawk/Extensions/ControlExtensions.cs index b37ca52fa2..5a4f5c4ef4 100644 --- a/BizHawk.Client.EmuHawk/Extensions/ControlExtensions.cs +++ b/BizHawk.Client.EmuHawk/Extensions/ControlExtensions.cs @@ -131,9 +131,8 @@ namespace BizHawk.Client.EmuHawk.WinFormExtensions public static DialogResult ShowHawkDialog(this CommonDialog form) { GlobalWin.Sound.StopSound(); - var tempForm = new Form() { TopMost = true }; + using var tempForm = new Form() { TopMost = true }; var result = form.ShowDialog(tempForm); - tempForm.Dispose(); GlobalWin.Sound.StartSound(); return result; } diff --git a/BizHawk.Client.EmuHawk/LogWindow.cs b/BizHawk.Client.EmuHawk/LogWindow.cs index 212ec849d2..ff8b4eb2a3 100644 --- a/BizHawk.Client.EmuHawk/LogWindow.cs +++ b/BizHawk.Client.EmuHawk/LogWindow.cs @@ -142,7 +142,7 @@ namespace BizHawk.Client.EmuHawk private void AddToGameDbBtn_Click(object sender, EventArgs e) { - var picker = new RomStatusPicker(); + using var picker = new RomStatusPicker(); var result = picker.ShowDialog(); if (result == DialogResult.OK) { diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs index 6ac855a1ee..381a9ff917 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -312,7 +312,7 @@ namespace BizHawk.Client.EmuHawk private void OpenAdvancedMenuItem_Click(object sender, EventArgs e) { - var oac = new OpenAdvancedChooser(this); + using var oac = new OpenAdvancedChooser(this); if (oac.ShowHawkDialog() == DialogResult.Cancel) { return; @@ -355,7 +355,7 @@ namespace BizHawk.Client.EmuHawk /*************************/ /* CLONE OF CODE FROM OpenRom (mostly) */ - var ofd = new OpenFileDialog + using var ofd = new OpenFileDialog { InitialDirectory = PathManager.GetRomsPath(Emulator.SystemId), Filter = filter, @@ -489,12 +489,14 @@ namespace BizHawk.Client.EmuHawk // Inaccurate core but allow the user to continue anyway } - new RecordMovie(Emulator).ShowDialog(); + using var form = new RecordMovie(Emulator); + form.ShowDialog(); } private void PlayMovieMenuItem_Click(object sender, EventArgs e) { - new PlayMovie().ShowDialog(); + using var form = new PlayMovie(); + form.ShowDialog(); } private void StopMovieMenuItem_Click(object sender, EventArgs e) @@ -509,7 +511,7 @@ namespace BizHawk.Client.EmuHawk private void ImportMovieMenuItem_Click(object sender, EventArgs e) { - var ofd = new OpenFileDialog + using var ofd = new OpenFileDialog { InitialDirectory = PathManager.GetRomsPath(Emulator.SystemId), Multiselect = true, @@ -646,7 +648,7 @@ namespace BizHawk.Client.EmuHawk { var path = $"{PathManager.ScreenshotPrefix(Global.Game)}.{DateTime.Now:yyyy-MM-dd HH.mm.ss}.png"; - var sfd = new SaveFileDialog + using var sfd = new SaveFileDialog { InitialDirectory = Path.GetDirectoryName(path), FileName = Path.GetFileName(path), @@ -965,7 +967,7 @@ namespace BizHawk.Client.EmuHawk private void ControllersMenuItem_Click(object sender, EventArgs e) { - var controller = new ControllerConfig(Emulator.ControllerDefinition); + using var controller = new ControllerConfig(Emulator.ControllerDefinition); if (controller.ShowDialog() == DialogResult.OK) { InitControls(); @@ -975,7 +977,8 @@ namespace BizHawk.Client.EmuHawk private void HotkeysMenuItem_Click(object sender, EventArgs e) { - if (new HotkeyConfig().ShowDialog() == DialogResult.OK) + using var hotkeyConfig = new HotkeyConfig(); + if (hotkeyConfig.ShowDialog() == DialogResult.OK) { InitControls(); InputManager.SyncControls(); @@ -986,28 +989,33 @@ namespace BizHawk.Client.EmuHawk { if (e is RomLoader.RomErrorArgs args) { - var result = new FirmwaresConfig(true, args.RomPath).ShowDialog(); + using var configForm = new FirmwaresConfig(true, args.RomPath); + var result = configForm.ShowDialog(); args.Retry = result == DialogResult.Retry; } else { - new FirmwaresConfig().ShowDialog(); + using var configForm = new FirmwaresConfig(); + configForm.ShowDialog(); } } private void MessagesMenuItem_Click(object sender, EventArgs e) { - new MessageConfig().ShowDialog(); + using var form = new MessageConfig(); + form.ShowDialog(); } private void PathsMenuItem_Click(object sender, EventArgs e) { - new PathConfig().ShowDialog(); + using var form = new PathConfig(); + form.ShowDialog(); } private void SoundMenuItem_Click(object sender, EventArgs e) { - if (new SoundConfig().ShowDialog() == DialogResult.OK) + using var form = new SoundConfig(); + if (form.ShowDialog() == DialogResult.OK) { RewireSound(); } @@ -1015,27 +1023,32 @@ namespace BizHawk.Client.EmuHawk private void AutofireMenuItem_Click(object sender, EventArgs e) { - new AutofireConfig().ShowDialog(); + using var form = new AutofireConfig(); + form.ShowDialog(); } private void RewindOptionsMenuItem_Click(object sender, EventArgs e) { - new RewindConfig().ShowDialog(); + using var form = new RewindConfig(); + form.ShowDialog(); } private void FileExtensionsMenuItem_Click(object sender, EventArgs e) { - new FileExtensionPreferences().ShowDialog(); + using var form = new FileExtensionPreferences(); + form.ShowDialog(); } private void CustomizeMenuItem_Click(object sender, EventArgs e) { - new EmuHawkOptions().ShowDialog(); + using var form = new EmuHawkOptions(); + form.ShowDialog(); } private void ProfilesMenuItem_Click(object sender, EventArgs e) { - if (new ProfileConfig().ShowDialog() == DialogResult.OK) + using var form = new ProfileConfig(); + if (form.ShowDialog() == DialogResult.OK) { GlobalWin.OSD.AddMessage("Profile settings saved"); @@ -1305,7 +1318,7 @@ namespace BizHawk.Client.EmuHawk private void SaveConfigAsMenuItem_Click(object sender, EventArgs e) { var path = PathManager.DefaultIniPath; - var sfd = new SaveFileDialog + using var sfd = new SaveFileDialog { InitialDirectory = Path.GetDirectoryName(path), FileName = Path.GetFileName(path), @@ -1331,7 +1344,7 @@ namespace BizHawk.Client.EmuHawk private void LoadConfigFromMenuItem_Click(object sender, EventArgs e) { var path = PathManager.DefaultIniPath; - var ofd = new OpenFileDialog + using var ofd = new OpenFileDialog { InitialDirectory = Path.GetDirectoryName(path), FileName = Path.GetFileName(path), @@ -1507,7 +1520,8 @@ namespace BizHawk.Client.EmuHawk private void BatchRunnerToolStripMenuItem_Click(object sender, EventArgs e) { - new BatchRun().ShowDialog(); + using var form = new BatchRun(); + form.ShowDialog(); } private void NewHexEditorMenuItem_Click(object sender, EventArgs e) @@ -1595,15 +1609,18 @@ namespace BizHawk.Client.EmuHawk { if (Emulator is NES) { - new NESGraphicsConfig().ShowDialog(this); + using var form = new NESGraphicsConfig(); + form.ShowDialog(this); } else if (Emulator is SubNESHawk) { - new NESGraphicsConfig().ShowDialog(this); + using var form = new NESGraphicsConfig(); + form.ShowDialog(this); } else if (Emulator is QuickNES) { - new QuickNesConfig().ShowDialog(this); + using var form = new QuickNesConfig(); + form.ShowDialog(this); } } @@ -1616,7 +1633,8 @@ namespace BizHawk.Client.EmuHawk { if (Emulator is NES nes && nes.IsVS) { - new NesVsSettings().ShowHawkDialog(); + using var form = new NesVsSettings(); + form.ShowHawkDialog(); } } @@ -1669,11 +1687,13 @@ namespace BizHawk.Client.EmuHawk { if (Emulator is NES) { - new NesControllerSettings().ShowDialog(); + using var form = new NesControllerSettings(); + form.ShowDialog(); } else if (Emulator is SubNESHawk) { - new NesControllerSettings().ShowDialog(); + using var form = new NesControllerSettings(); + form.ShowDialog(); } else if (Emulator is QuickNES) { @@ -1719,7 +1739,8 @@ namespace BizHawk.Client.EmuHawk private void PceGraphicsSettingsMenuItem_Click(object sender, EventArgs e) { - new PCEGraphicsConfig().ShowDialog(); + using var form = new PCEGraphicsConfig(); + form.ShowDialog(); } private void PceBgViewerMenuItem_Click(object sender, EventArgs e) @@ -1926,7 +1947,8 @@ namespace BizHawk.Client.EmuHawk private void SMSGraphicsSettingsMenuItem_Click(object sender, EventArgs e) { - new SMSGraphicsConfig().ShowDialog(); + using var form = new SMSGraphicsConfig(); + form.ShowDialog(); } private void GGGameGenieMenuItem_Click(object sender, EventArgs e) @@ -1996,7 +2018,7 @@ namespace BizHawk.Client.EmuHawk private void LoadTIFileMenuItem_Click(object sender, EventArgs e) { var ti83 = (TI83)Emulator; - var ofd = new OpenFileDialog + using var ofd = new OpenFileDialog { InitialDirectory = PathManager.GetRomsPath(Emulator.SystemId), Filter = "TI-83 Program Files (*.83p,*.8xp)|*.83P;*.8xp|All Files|*.*", @@ -2023,7 +2045,8 @@ namespace BizHawk.Client.EmuHawk private void TI83PaletteMenuItem_Click(object sender, EventArgs e) { - GlobalWin.OSD.AddMessage(new TI83PaletteConfig().ShowDialog() == DialogResult.OK + using var form = new TI83PaletteConfig(); + GlobalWin.OSD.AddMessage(form.ShowDialog() == DialogResult.OK ? "Palette settings saved" : "Palette config aborted"); } @@ -2049,12 +2072,14 @@ namespace BizHawk.Client.EmuHawk private void A7800ControllerSettingsToolStripMenuItem_Click(object sender, EventArgs e) { - new A7800ControllerSettings().ShowDialog(); + using var form = new A7800ControllerSettings(); + form.ShowDialog(); } private void A7800FilterSettingsToolStripMenuItem_Click(object sender, EventArgs e) { - new A7800FilterSettings().ShowDialog(); + using var form = new A7800FilterSettings(); + form.ShowDialog(); } #endregion @@ -2141,7 +2166,8 @@ namespace BizHawk.Client.EmuHawk private void PSXControllerSettingsMenuItem_Click(object sender, EventArgs e) { - new PSXControllerConfigNew().ShowDialog(); + using var form = new PSXControllerConfigNew(); + form.ShowDialog(); } private void PSXOptionsMenuItem_Click(object sender, EventArgs e) @@ -2160,7 +2186,8 @@ namespace BizHawk.Client.EmuHawk private void PSXHashDiscsToolStripMenuItem_Click(object sender, EventArgs e) { - new PSXHashDiscs().ShowDialog(); + using var form = new PSXHashDiscs(); + form.ShowDialog(); } #endregion @@ -2184,7 +2211,8 @@ namespace BizHawk.Client.EmuHawk private void SNESControllerConfigurationMenuItem_Click(object sender, EventArgs e) { - new SNESControllerSettings().ShowDialog(); + using var form = new SNESControllerSettings(); + form.ShowDialog(); } private void SnesGfxDebuggerMenuItem_Click(object sender, EventArgs e) @@ -2241,7 +2269,8 @@ namespace BizHawk.Client.EmuHawk private void ColecoControllerSettingsMenuItem_Click(object sender, EventArgs e) { - new ColecoControllerSettings().ShowDialog(); + using var form = new ColecoControllerSettings(); + form.ShowDialog(); } #endregion @@ -2266,7 +2295,8 @@ namespace BizHawk.Client.EmuHawk private void N64PluginSettingsMenuItem_Click(object sender, EventArgs e) { - if (new N64VideoPluginconfig().ShowDialog() == DialogResult.OK) + using var form = new N64VideoPluginconfig(); + if (form.ShowDialog() == DialogResult.OK) { if (Emulator.IsNull()) { @@ -2285,7 +2315,8 @@ namespace BizHawk.Client.EmuHawk private void N64ControllerSettingsMenuItem_Click(object sender, EventArgs e) { - if (new N64ControllersSetup().ShowDialog() == DialogResult.OK) + using var form = new N64ControllersSetup(); + if (form.ShowDialog() == DialogResult.OK) { FlagNeedsReboot(); GlobalWin.OSD.AddMessage("Controller settings saved but a core reboot is required"); @@ -2502,7 +2533,8 @@ namespace BizHawk.Client.EmuHawk private void IntVControllerSettingsMenuItem_Click(object sender, EventArgs e) { - new IntvControllerSettings().ShowDialog(); + using var form = new IntvControllerSettings(); + form.ShowDialog(); } #endregion @@ -2537,27 +2569,32 @@ namespace BizHawk.Client.EmuHawk private void ZXSpectrumControllerConfigurationMenuItem_Click(object sender, EventArgs e) { - new ZXSpectrumJoystickSettings().ShowDialog(); + using var form = new ZXSpectrumJoystickSettings(); + form.ShowDialog(); } private void ZXSpectrumCoreEmulationSettingsMenuItem_Click(object sender, EventArgs e) { - new ZXSpectrumCoreEmulationSettings().ShowDialog(); + using var form = new ZXSpectrumCoreEmulationSettings(); + form.ShowDialog(); } private void ZXSpectrumNonSyncSettingsMenuItem_Click(object sender, EventArgs e) { - new ZXSpectrumNonSyncSettings().ShowDialog(); + using var form = new ZXSpectrumNonSyncSettings(); + form.ShowDialog(); } private void ZXSpectrumAudioSettingsMenuItem_Click(object sender, EventArgs e) { - new ZXSpectrumAudioSettings().ShowDialog(); + using var form = new ZXSpectrumAudioSettings(); + form.ShowDialog(); } private void ZXSpectrumPokeMemoryMenuItem_Click(object sender, EventArgs e) { - new ZXSpectrumPokeMemory().ShowDialog(); + using var form = new ZXSpectrumPokeMemory(); + form.ShowDialog(); } private void ZXSpectrumMediaMenuItem_DropDownOpened(object sender, EventArgs e) @@ -2639,7 +2676,7 @@ namespace BizHawk.Client.EmuHawk private void ZXSpectrumExportSnapshotMenuItemMenuItem_Click(object sender, EventArgs e) { - var zxSnapExpDialog = new SaveFileDialog + using var zxSnapExpDialog = new SaveFileDialog { RestoreDirectory = true , Title = "EXPERIMENTAL - Export 3rd party snapshot formats" @@ -2670,17 +2707,20 @@ namespace BizHawk.Client.EmuHawk private void amstradCPCCoreEmulationSettingsToolStripMenuItem_Click(object sender, EventArgs e) { - new AmstradCPCCoreEmulationSettings().ShowDialog(); + using var form = new AmstradCPCCoreEmulationSettings(); + form.ShowDialog(); } private void AmstradCPCAudioSettingsToolStripMenuItem_Click(object sender, EventArgs e) { - new AmstradCPCAudioSettings().ShowDialog(); + using var form = new AmstradCPCAudioSettings(); + form.ShowDialog(); } private void AmstradCPCPokeMemoryToolStripMenuItem_Click(object sender, EventArgs e) { - new AmstradCPCPokeMemory().ShowDialog(); + using var form = new AmstradCPCPokeMemory(); + form.ShowDialog(); } private void AmstradCPCMediaToolStripMenuItem_DropDownOpened(object sender, EventArgs e) @@ -2762,7 +2802,8 @@ namespace BizHawk.Client.EmuHawk private void AmstradCPCNonSyncSettingsToolStripMenuItem_Click(object sender, EventArgs e) { - new AmstradCPCNonSyncSettings().ShowDialog(); + using var form = new AmstradCPCNonSyncSettings(); + form.ShowDialog(); } #endregion @@ -2793,11 +2834,13 @@ namespace BizHawk.Client.EmuHawk { if (VersionInfo.DeveloperBuild) { - new AboutBox().ShowDialog(); + using var form = new AboutBox(); + form.ShowDialog(); } else { - new BizBox().ShowDialog(); + using var form = new BizBox(); + form.ShowDialog(); } } @@ -2936,7 +2979,7 @@ namespace BizHawk.Client.EmuHawk private void DisplayConfigMenuItem_Click(object sender, EventArgs e) { - var window = new DisplayConfigLite(); + using var window = new DisplayConfigLite(); var result = window.ShowDialog(); if (result == DialogResult.OK) { @@ -2969,7 +3012,7 @@ namespace BizHawk.Client.EmuHawk { if (Global.MovieSession.Movie.IsActive) { - var form = new EditSubtitlesForm { ReadOnly = Global.MovieSession.ReadOnly }; + using var form = new EditSubtitlesForm { ReadOnly = Global.MovieSession.ReadOnly }; form.GetMovie(Global.MovieSession.Movie); form.ShowDialog(); } @@ -3015,7 +3058,7 @@ namespace BizHawk.Client.EmuHawk { if (Global.MovieSession.Movie.IsActive) { - var form = new EditCommentsForm(); + using var form = new EditCommentsForm(); form.GetMovie(Global.MovieSession.Movie); form.ShowDialog(); } @@ -3112,7 +3155,7 @@ namespace BizHawk.Client.EmuHawk { // We do not check if the user is actually setting a profile here. // This is intentional. - var profileForm = new ProfileConfig(); + using var profileForm = new ProfileConfig(); profileForm.ShowDialog(); Global.Config.FirstBoot = false; ProfileFirstBootLabel.Visible = false; diff --git a/BizHawk.Client.EmuHawk/MainForm.Movie.cs b/BizHawk.Client.EmuHawk/MainForm.Movie.cs index d7094c8893..36fbffa3fc 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Movie.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Movie.cs @@ -30,7 +30,8 @@ namespace BizHawk.Client.EmuHawk } catch (MoviePlatformMismatchException ex) { - MessageBox.Show(new Form(){TopMost = true}, ex.Message, "Movie/Platform Mismatch", MessageBoxButtons.OK, MessageBoxIcon.Error); + using var ownerForm = new Form() { TopMost = true }; + MessageBox.Show(ownerForm, ex.Message, "Movie/Platform Mismatch", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index 1661e2eca6..2117cf3411 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -1293,7 +1293,7 @@ namespace BizHawk.Client.EmuHawk public bool RunLibretroCoreChooser() { - var ofd = new OpenFileDialog(); + using var ofd = new OpenFileDialog(); if (Global.Config.LibretroCore != null) { @@ -1625,14 +1625,14 @@ namespace BizHawk.Client.EmuHawk } } - var writer = new BinaryWriter(new FileStream(newPath, FileMode.Create, FileAccess.Write)); - var saveram = Emulator.AsSaveRam().CloneSaveRam(); - - if (saveram != null) + using (var writer = new BinaryWriter(new FileStream(newPath, FileMode.Create, FileAccess.Write))) { - writer.Write(saveram, 0, saveram.Length); + var saveram = Emulator.AsSaveRam().CloneSaveRam(); + if (saveram != null) + { + writer.Write(saveram, 0, saveram.Length); + } } - writer.Close(); if (file.Exists) { @@ -2164,7 +2164,7 @@ namespace BizHawk.Client.EmuHawk private void OpenRom() { - var ofd = new OpenFileDialog + using var ofd = new OpenFileDialog { InitialDirectory = PathManager.GetRomsPath(Emulator.SystemId), Filter = RomFilter, @@ -3139,7 +3139,7 @@ namespace BizHawk.Client.EmuHawk // handle directories first if (ext == "") { - var fbd = new FolderBrowserEx(); + using var fbd = new FolderBrowserEx(); if (fbd.ShowDialog() == DialogResult.Cancel) { aw.Dispose(); @@ -3150,7 +3150,7 @@ namespace BizHawk.Client.EmuHawk } else { - var sfd = new SaveFileDialog(); + using var sfd = new SaveFileDialog(); if (Global.Game != null) { sfd.FileName = $"{PathManager.FilesystemSafeName(Global.Game)}.{ext}"; // don't use Path.ChangeExtension, it might wreck game names with dots in them @@ -3364,7 +3364,7 @@ namespace BizHawk.Client.EmuHawk private int? LoadArchiveChooser(HawkFile file) { - var ac = new ArchiveChooser(file); + using var ac = new ArchiveChooser(file); if (ac.ShowDialog(this) == DialogResult.OK) { return ac.SelectedMemberIndex; @@ -3422,7 +3422,7 @@ namespace BizHawk.Client.EmuHawk private string ChoosePlatformForRom(RomGame rom) { - var platformChooser = new PlatformChooser + using var platformChooser = new PlatformChooser { RomGame = rom }; @@ -3569,7 +3569,7 @@ namespace BizHawk.Client.EmuHawk // determine the xml assets and create RomStatusDetails for all of them var xmlGame = XmlGame.Create(new HawkFile(oa_openrom.Path)); - StringWriter xSw = new StringWriter(); + using var xSw = new StringWriter(); for (int xg = 0; xg < xmlGame.Assets.Count; xg++) { @@ -4079,7 +4079,7 @@ namespace BizHawk.Client.EmuHawk file.Directory.Create(); } - var sfd = new SaveFileDialog + using var sfd = new SaveFileDialog { AddExtension = true, DefaultExt = "State", @@ -4113,7 +4113,7 @@ namespace BizHawk.Client.EmuHawk return; } - var ofd = new OpenFileDialog + using var ofd = new OpenFileDialog { InitialDirectory = PathManager.GetSaveStatePath(Global.Game), Filter = "Save States (*.State)|*.State|All Files|*.*", diff --git a/BizHawk.Client.EmuHawk/Program.cs b/BizHawk.Client.EmuHawk/Program.cs index 4bf8cad0c9..bb5288884f 100644 --- a/BizHawk.Client.EmuHawk/Program.cs +++ b/BizHawk.Client.EmuHawk/Program.cs @@ -47,7 +47,7 @@ namespace BizHawk.Client.EmuHawk $"[{(vc2012.HasValue ? " OK " : "FAIL")}] Visual C++ 2012 Runtime", $"[{(vc2015.HasValue ? " OK " : "FAIL")}] Visual C++ 2015 Runtime" }; - var box = new CustomControls.PrereqsAlert(reqPresent) + using var box = new CustomControls.PrereqsAlert(reqPresent) { textBox1 = { Text = string.Join(Environment.NewLine, alertLines) } }; diff --git a/BizHawk.Client.EmuHawk/config/DisplayConfigLite.cs b/BizHawk.Client.EmuHawk/config/DisplayConfigLite.cs index cb4f4f7515..0407f6ccd6 100644 --- a/BizHawk.Client.EmuHawk/config/DisplayConfigLite.cs +++ b/BizHawk.Client.EmuHawk/config/DisplayConfigLite.cs @@ -211,7 +211,7 @@ namespace BizHawk.Client.EmuHawk private void btnSelectUserFilter_Click(object sender, EventArgs e) { - var ofd = new OpenFileDialog(); + using var ofd = new OpenFileDialog(); ofd.Filter = ".CGP (*.cgp)|*.cgp"; ofd.FileName = PathSelection; if (ofd.ShowDialog() == DialogResult.OK) @@ -241,7 +241,8 @@ namespace BizHawk.Client.EmuHawk catch {} if (!ok) { - new ExceptionBox(errors).ShowDialog(); + using var errorForm = new ExceptionBox(errors); + errorForm.ShowDialog(); return; } } diff --git a/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs b/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs index 6c0751f964..7a58db21ed 100644 --- a/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs +++ b/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs @@ -569,7 +569,8 @@ namespace BizHawk.Client.EmuHawk return; } - new PathConfig().ShowDialog(this); + using var pathConfig = new PathConfig(); + pathConfig.ShowDialog(this); RefreshBasePath(); } diff --git a/BizHawk.Client.EmuHawk/config/GB/BmpView.cs b/BizHawk.Client.EmuHawk/config/GB/BmpView.cs index e7513fbaf8..800cd1aa2d 100644 --- a/BizHawk.Client.EmuHawk/config/GB/BmpView.cs +++ b/BizHawk.Client.EmuHawk/config/GB/BmpView.cs @@ -101,7 +101,7 @@ namespace BizHawk.Client.EmuHawk di.Create(); } - var sfd = new SaveFileDialog + using var sfd = new SaveFileDialog { FileName = $"{PathManager.FilesystemSafeName(Global.Game)}-Palettes", InitialDirectory = path, diff --git a/BizHawk.Client.EmuHawk/config/MessageConfig.cs b/BizHawk.Client.EmuHawk/config/MessageConfig.cs index 2878232135..b391e9eb86 100644 --- a/BizHawk.Client.EmuHawk/config/MessageConfig.cs +++ b/BizHawk.Client.EmuHawk/config/MessageConfig.cs @@ -302,7 +302,7 @@ namespace BizHawk.Client.EmuHawk y = (int)YNumeric.Maximum - _py; } - var p = new Pen(_brush); + using var p = new Pen(_brush); e.Graphics.DrawLine(p, new Point(x, y), new Point(x + 8, y + 8)); e.Graphics.DrawLine(p, new Point(x + 8, y), new Point(x, y + 8)); e.Graphics.DrawRectangle(p, new Rectangle(x, y, 8, 8)); diff --git a/BizHawk.Client.EmuHawk/config/NES/NESGraphicsConfig.cs b/BizHawk.Client.EmuHawk/config/NES/NESGraphicsConfig.cs index 2c3a963428..ce857f04d1 100644 --- a/BizHawk.Client.EmuHawk/config/NES/NESGraphicsConfig.cs +++ b/BizHawk.Client.EmuHawk/config/NES/NESGraphicsConfig.cs @@ -59,7 +59,7 @@ namespace BizHawk.Client.EmuHawk private void BrowsePalette_Click(object sender, EventArgs e) { - OpenFileDialog ofd = new OpenFileDialog + using var ofd = new OpenFileDialog { InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Palettes"].Path, "NES"), Filter = "Palette Files (.pal)|*.PAL|All Files (*.*)|*.*", diff --git a/BizHawk.Client.EmuHawk/config/NES/QuickNesConfig.cs b/BizHawk.Client.EmuHawk/config/NES/QuickNesConfig.cs index 34b7f7dd7c..c43c35e357 100644 --- a/BizHawk.Client.EmuHawk/config/NES/QuickNesConfig.cs +++ b/BizHawk.Client.EmuHawk/config/NES/QuickNesConfig.cs @@ -72,7 +72,7 @@ namespace BizHawk.Client.EmuHawk private void ButtonPal_Click(object sender, EventArgs e) { - var ofd = new OpenFileDialog + using var ofd = new OpenFileDialog { InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Palettes"].Path, "NES"), Filter = "Palette Files (.pal)|*.PAL|All Files (*.*)|*.*", diff --git a/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.cs b/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.cs index 91b1e36367..a5175cb108 100644 --- a/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.cs +++ b/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.cs @@ -73,7 +73,7 @@ namespace BizHawk.Client.EmuHawk var ss = psx.GetSyncSettings(); var vid = psx.SystemVidStandard; var size = psx.CurrentVideoSize; - var dlg = new PSXOptions(s, ss, vid, size); + using var dlg = new PSXOptions(s, ss, vid, size); var result = dlg.ShowDialog(owner); return result; diff --git a/BizHawk.Client.EmuHawk/config/PathConfig.cs b/BizHawk.Client.EmuHawk/config/PathConfig.cs index bb3e6e8820..bacc20384d 100644 --- a/BizHawk.Client.EmuHawk/config/PathConfig.cs +++ b/BizHawk.Client.EmuHawk/config/PathConfig.cs @@ -173,7 +173,7 @@ namespace BizHawk.Client.EmuHawk return; } - var f = new FirmwaresConfig { TargetSystem = "Global" }; + using var f = new FirmwaresConfig { TargetSystem = "Global" }; f.ShowDialog(this); }; @@ -217,7 +217,7 @@ namespace BizHawk.Client.EmuHawk system = null; } - var f = new FolderBrowserEx + using var f = new FolderBrowserEx { Description = $"Set the directory for {name}", SelectedPath = PathManager.MakeAbsolutePath(box.Text, system) diff --git a/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs b/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs index f9617c753f..331bcbf375 100644 --- a/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs +++ b/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs @@ -19,7 +19,7 @@ namespace BizHawk.Client.EmuHawk { var s = ((LibsnesCore)Global.Emulator).GetSettings(); var ss = ((LibsnesCore)Global.Emulator).GetSyncSettings(); - var dlg = new SNESOptions + using var dlg = new SNESOptions { AlwaysDoubleSize = s.AlwaysDoubleSize, CropSGBFrame = s.CropSGBFrame, diff --git a/BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.cs b/BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.cs index 2b8f4dc603..e59d421e98 100644 --- a/BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.cs +++ b/BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.cs @@ -49,7 +49,7 @@ namespace BizHawk.Client.EmuHawk // and the rgb order is switched int customColor = BackgroundPanel.BackColor.R | BackgroundPanel.BackColor.G << 8 | BackgroundPanel.BackColor.B << 16; - var dlg = new ColorDialog + using var dlg = new ColorDialog { AllowFullOpen = true, AnyColor = true, @@ -70,7 +70,7 @@ namespace BizHawk.Client.EmuHawk // and the rgb order is switched int customColor = ForeGroundPanel.BackColor.R | ForeGroundPanel.BackColor.G << 8 | ForeGroundPanel.BackColor.B << 16; - var dlg = new ColorDialog + using var dlg = new ColorDialog { AllowFullOpen = true, AnyColor = true, diff --git a/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumNonSyncSettings.cs b/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumNonSyncSettings.cs index 8ba83a082b..d7da354c59 100644 --- a/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumNonSyncSettings.cs +++ b/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumNonSyncSettings.cs @@ -103,7 +103,7 @@ namespace BizHawk.Client.EmuHawk { var currColor = _settings.BackgroundColor; System.Drawing.Color c = System.Drawing.Color.FromArgb(currColor); - ColorDialog cd = new ColorDialog(); + using var cd = new ColorDialog(); System.Drawing.Color[] colors = new System.Drawing.Color[] { diff --git a/BizHawk.Client.EmuHawk/movie/EditSubtitlesForm.cs b/BizHawk.Client.EmuHawk/movie/EditSubtitlesForm.cs index 9c2b079bff..6a9f76ab7f 100644 --- a/BizHawk.Client.EmuHawk/movie/EditSubtitlesForm.cs +++ b/BizHawk.Client.EmuHawk/movie/EditSubtitlesForm.cs @@ -176,7 +176,7 @@ namespace BizHawk.Client.EmuHawk return; } - var s = new SubtitleMaker {Sub = GetRow(c[0].Index)}; + using var s = new SubtitleMaker {Sub = GetRow(c[0].Index)}; if (s.ShowDialog() == DialogResult.OK) { ChangeRow(s.Sub, SubGrid.SelectedRows[0].Index); @@ -186,7 +186,7 @@ namespace BizHawk.Client.EmuHawk private void Export_Click(object sender, EventArgs e) { // Get file to save as - var form = new SaveFileDialog + using var form = new SaveFileDialog { AddExtension = true, Filter = "SubRip Files (*.srt)|*.srt|All files (*.*)|*.*" diff --git a/BizHawk.Client.EmuHawk/movie/PlayMovie.cs b/BizHawk.Client.EmuHawk/movie/PlayMovie.cs index 7a3169b96f..2b5d95e8d0 100644 --- a/BizHawk.Client.EmuHawk/movie/PlayMovie.cs +++ b/BizHawk.Client.EmuHawk/movie/PlayMovie.cs @@ -557,7 +557,7 @@ namespace BizHawk.Client.EmuHawk private void BrowseMovies_Click(object sender, EventArgs e) { - var ofd = new OpenFileDialog + using var ofd = new OpenFileDialog { Filter = $"Movie Files (*.{MovieService.DefaultExtension})|*.{MovieService.DefaultExtension}|TAS project Files (*.{TasMovie.Extension})|*.{TasMovie.Extension}|All Files|*.*", InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null) diff --git a/BizHawk.Client.EmuHawk/movie/RecordMovie.cs b/BizHawk.Client.EmuHawk/movie/RecordMovie.cs index 8e8e1eeb8f..7512fdbbb0 100644 --- a/BizHawk.Client.EmuHawk/movie/RecordMovie.cs +++ b/BizHawk.Client.EmuHawk/movie/RecordMovie.cs @@ -177,7 +177,7 @@ namespace BizHawk.Client.EmuHawk else throw; } - var sfd = new SaveFileDialog + using var sfd = new SaveFileDialog { InitialDirectory = movieFolderPath, DefaultExt = $".{Global.MovieSession.Movie.PreferredExtension}", diff --git a/BizHawk.Client.EmuHawk/tools/CDL.cs b/BizHawk.Client.EmuHawk/tools/CDL.cs index af444b8e08..a233a9c117 100644 --- a/BizHawk.Client.EmuHawk/tools/CDL.cs +++ b/BizHawk.Client.EmuHawk/tools/CDL.cs @@ -457,7 +457,7 @@ namespace BizHawk.Client.EmuHawk return; } - var sfd = new SaveFileDialog(); + using var sfd = new SaveFileDialog(); var result = sfd.ShowDialog(this); if (result == DialogResult.OK) { @@ -584,7 +584,7 @@ namespace BizHawk.Client.EmuHawk private void tsbExportText_Click(object sender, EventArgs e) { - StringWriter sw = new StringWriter(); + using var sw = new StringWriter(); foreach(var line in listContents) { foreach (var entry in line) diff --git a/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs b/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs index a7a3259c89..16bcc5bc14 100644 --- a/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs +++ b/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs @@ -953,7 +953,7 @@ namespace BizHawk.Client.EmuHawk private string GetBinarySaveFileFromUser() { - var sfd = new SaveFileDialog + using var sfd = new SaveFileDialog { Filter = GetSaveFileFilter(), RestoreDirectory = true, @@ -976,7 +976,7 @@ namespace BizHawk.Client.EmuHawk private string GetSaveFileFromUser() { - var sfd = new SaveFileDialog + using var sfd = new SaveFileDialog { Filter = "Text (*.txt)|*.txt|All Files|*.*", RestoreDirectory = true, @@ -1348,7 +1348,7 @@ namespace BizHawk.Client.EmuHawk return; } - var sfd = new OpenFileDialog + using var sfd = new OpenFileDialog { Filter = "Binary (*.bin)|*.bin|Save Files (*.sav)|*.sav|All Files|*.*", RestoreDirectory = true, @@ -1407,7 +1407,7 @@ namespace BizHawk.Client.EmuHawk romName = Global.Config.RecentRoms.MostRecent; } - var ofd = new OpenFileDialog + using var ofd = new OpenFileDialog { FileName = $"{Path.GetFileNameWithoutExtension(romName)}.tbl", InitialDirectory = intialDirectory, @@ -1676,7 +1676,7 @@ namespace BizHawk.Client.EmuHawk private void GoToAddressMenuItem_Click(object sender, EventArgs e) { - var inputPrompt = new InputPrompt + using var inputPrompt = new InputPrompt { Text = "Go to Address", StartLocation = this.ChildPointToScreen(MemoryViewerBox), @@ -1759,7 +1759,7 @@ namespace BizHawk.Client.EmuHawk if (addresses.Any()) { - var poke = new RamPoke + using var poke = new RamPoke { InitialLocation = this.ChildPointToScreen(AddressLabel), ParentTool = this @@ -1785,7 +1785,8 @@ namespace BizHawk.Client.EmuHawk private void SetColorsMenuItem_Click(object sender, EventArgs e) { - new HexColorsForm().ShowHawkDialog(); + using var form = new HexColorsForm(); + form.ShowHawkDialog(); } private void ResetColorsToDefaultMenuItem_Click(object sender, EventArgs e) @@ -2461,7 +2462,7 @@ namespace BizHawk.Client.EmuHawk //mat.M41 = matVals[3, 0]; mat.M42 = matVals[3, 1]; mat.M43 = matVals[3, 2]; mat.M44 = matVals[3, 3]; //MessageBox.Show(mat.ToString()); - StringWriter sw = new StringWriter(); + using var sw = new StringWriter(); for(int i=0;i<4;i++) sw.WriteLine("{0,18:0.00000} {1,18:0.00000} {2,18:0.00000} {3,18:0.00000}", matVals[i, 0], matVals[i, 1], matVals[i, 2], matVals[i, 3]); var str = sw.ToString(); diff --git a/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.cs b/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.cs index a8ed28bd2a..5f5c434c64 100644 --- a/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.cs +++ b/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.cs @@ -302,7 +302,7 @@ namespace BizHawk.Client.EmuHawk public static bool SaveMacroAs(MovieZone macro) { - var dialog = new SaveFileDialog + using var dialog = new SaveFileDialog { InitialDirectory = SuggestedFolder(), FileName = macro.Name, @@ -336,7 +336,7 @@ namespace BizHawk.Client.EmuHawk public static MovieZone LoadMacro() { - var dialog = new OpenFileDialog + using var dialog = new OpenFileDialog { InitialDirectory = SuggestedFolder(), Filter = "Movie Macros (*.bk2m)|*.bk2m|All Files|*.*" diff --git a/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs b/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs index 8216a3666b..364d1ead02 100644 --- a/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs +++ b/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs @@ -251,7 +251,7 @@ namespace BizHawk.Client.EmuHawk initialDirectory = Path.GetDirectoryName(filename); } - var sfd = new SaveFileDialog + using var sfd = new SaveFileDialog { FileName = filename, InitialDirectory = initialDirectory, diff --git a/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskFileSelector.cs b/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskFileSelector.cs index f02f38edcd..3859e0d905 100644 --- a/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskFileSelector.cs +++ b/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskFileSelector.cs @@ -70,63 +70,61 @@ namespace BizHawk.Client.EmuHawk private void BrowseButton_Click(object sender, EventArgs e) { - using (var ofd = new OpenFileDialog + using var ofd = new OpenFileDialog { InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global_NULL", "ROM"].Path, "Global_NULL"), Filter = MainForm.RomFilter, RestoreDirectory = true - }) + }; + string _path = ""; + + var result = ofd.ShowHawkDialog(); + if (result == DialogResult.OK) { - string _path = ""; + _path = ofd.FileName; + } + else + { + return; + } - var result = ofd.ShowHawkDialog(); - if (result == DialogResult.OK) + try + { + var file = new FileInfo(ofd.FileName); + var path = BizHawk.Common.HawkFile.Util_ResolveLink(file.FullName); + + using (var hf = new BizHawk.Common.HawkFile(path)) { - _path = ofd.FileName; + if (hf.IsArchive) + { + // archive - run the archive chooser + if (SystemString == "PSX" || SystemString == "PCFX" || SystemString == "SAT") + { + MessageBox.Show("Using archives with PSX, PCFX or SATURN is not currently recommended/supported."); + return; + } + + using var ac = new ArchiveChooser(new BizHawk.Common.HawkFile(_path)); + int memIdx = -1; + + if (ac.ShowDialog(this) == DialogResult.OK) + { + memIdx = ac.SelectedMemberIndex; + } + + var intName = hf.ArchiveItems[memIdx]; + PathBox.Text = $"{_path}|{intName.Name}"; + } + else + { + // file is not an archive + PathBox.Text = _path; + } } - else - { - return; - } - - try - { - var file = new FileInfo(ofd.FileName); - var path = BizHawk.Common.HawkFile.Util_ResolveLink(file.FullName); - - using (var hf = new BizHawk.Common.HawkFile(path)) - { - if (hf.IsArchive) - { - // archive - run the archive chooser - if (SystemString == "PSX" || SystemString == "PCFX" || SystemString == "SAT") - { - MessageBox.Show("Using archives with PSX, PCFX or SATURN is not currently recommended/supported."); - return; - } - - var ac = new ArchiveChooser(new BizHawk.Common.HawkFile(_path)); - int memIdx = -1; - - if (ac.ShowDialog(this) == DialogResult.OK) - { - memIdx = ac.SelectedMemberIndex; - } - - var intName = hf.ArchiveItems[memIdx]; - PathBox.Text = $"{_path}|{intName.Name}"; - } - else - { - // file is not an archive - PathBox.Text = _path; - } - } - } - catch - { - return; - } + } + catch + { + return; } } diff --git a/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs b/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs index e5c2a12963..20ac555b42 100644 --- a/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs +++ b/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs @@ -109,7 +109,7 @@ namespace BizHawk.Client.EmuHawk private void btnExport_Click(object sender, EventArgs e) { //acquire target - var sfd = new SaveFileDialog + using var sfd = new SaveFileDialog { Filter = "XRNS (*.xrns)|*.xrns" }; diff --git a/BizHawk.Client.EmuHawk/tools/NES/NameTableViewer.cs b/BizHawk.Client.EmuHawk/tools/NES/NameTableViewer.cs index 7ba1173f50..541542d680 100644 --- a/BizHawk.Client.EmuHawk/tools/NES/NameTableViewer.cs +++ b/BizHawk.Client.EmuHawk/tools/NES/NameTableViewer.cs @@ -69,7 +69,7 @@ namespace BizHawk.Client.EmuHawk public void Screenshot() { - var sfd = new SaveFileDialog + using var sfd = new SaveFileDialog { FileName = $"{PathManager.FilesystemSafeName(Global.Game)}-Nametables", InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Screenshots"].Path, "NES"), diff --git a/BizHawk.Client.EmuHawk/tools/ToolHelpers.cs b/BizHawk.Client.EmuHawk/tools/ToolHelpers.cs index 05f3c4e27e..04b9a91465 100644 --- a/BizHawk.Client.EmuHawk/tools/ToolHelpers.cs +++ b/BizHawk.Client.EmuHawk/tools/ToolHelpers.cs @@ -20,7 +20,7 @@ namespace BizHawk.Client.EmuHawk Directory.CreateDirectory(path); } - var ofd = new OpenFileDialog + using var ofd = new OpenFileDialog { FileName = !string.IsNullOrWhiteSpace(currentFile) ? Path.GetFileName(currentFile) @@ -46,7 +46,7 @@ namespace BizHawk.Client.EmuHawk Directory.CreateDirectory(path); } - var sfd = new SaveFileDialog + using var sfd = new SaveFileDialog { FileName = !string.IsNullOrWhiteSpace(currentFile) ? Path.GetFileName(currentFile) diff --git a/BizHawk.Client.EmuHawk/tools/TraceLogger.cs b/BizHawk.Client.EmuHawk/tools/TraceLogger.cs index 1c0cb24a42..c7bad8fa36 100644 --- a/BizHawk.Client.EmuHawk/tools/TraceLogger.cs +++ b/BizHawk.Client.EmuHawk/tools/TraceLogger.cs @@ -291,7 +291,7 @@ namespace BizHawk.Client.EmuHawk private FileInfo GetFileFromUser() { - var sfd = new SaveFileDialog(); + using var sfd = new SaveFileDialog(); if (LogFile == null) { sfd.FileName = PathManager.FilesystemSafeName(Global.Game) + _extension; @@ -367,7 +367,7 @@ namespace BizHawk.Client.EmuHawk private void MaxLinesMenuItem_Click(object sender, EventArgs e) { - var prompt = new InputPrompt + using var prompt = new InputPrompt { StartLocation = this.ChildPointToScreen(TraceView), TextInputType = InputPrompt.InputType.Unsigned, @@ -388,7 +388,7 @@ namespace BizHawk.Client.EmuHawk private void SegmentSizeMenuItem_Click(object sender, EventArgs e) { - var prompt = new InputPrompt + using var prompt = new InputPrompt { StartLocation = this.ChildPointToScreen(TraceView), TextInputType = InputPrompt.InputType.Unsigned,