diff --git a/Knossos.NET/App.axaml.cs b/Knossos.NET/App.axaml.cs index d94712c8..686d0fe7 100644 --- a/Knossos.NET/App.axaml.cs +++ b/Knossos.NET/App.axaml.cs @@ -295,8 +295,7 @@ private void OpenLog() } else { - if (MainWindow.instance != null) - MessageBox.Show(MainWindow.instance, "Log File " + KnUtils.GetKnossosDataFolderPath() + Path.DirectorySeparatorChar + "Knossos.log not found.", "File not found", MessageBox.MessageBoxButtons.OK); + MessageBox.Show(MainWindow.instance, "Log File " + KnUtils.GetKnossosDataFolderPath() + Path.DirectorySeparatorChar + "Knossos.log not found.", "File not found", MessageBox.MessageBoxButtons.OK); } } @@ -319,8 +318,7 @@ private void OpenFS2Log() } else { - if (MainWindow.instance != null) - MessageBox.Show(MainWindow.instance, "Log File " + KnUtils.GetFSODataFolderPath() + Path.DirectorySeparatorChar + "data" + Path.DirectorySeparatorChar + "fs2_open.log not found.", "File not found", MessageBox.MessageBoxButtons.OK); + MessageBox.Show(MainWindow.instance, "Log File " + KnUtils.GetFSODataFolderPath() + Path.DirectorySeparatorChar + "data" + Path.DirectorySeparatorChar + "fs2_open.log not found.", "File not found", MessageBox.MessageBoxButtons.OK); } } } diff --git a/Knossos.NET/Classes/Knossos.cs b/Knossos.NET/Classes/Knossos.cs index c18bc571..8daa14ca 100644 --- a/Knossos.NET/Classes/Knossos.cs +++ b/Knossos.NET/Classes/Knossos.cs @@ -408,13 +408,10 @@ private static async Task QuickLaunch() Log.Add(Log.LogSeverity.Error, "Knossos.QuickLaunch", "Quick launch was used but the modid was not detected."); } await Task.Delay(2000); - if (MainWindow.instance != null) + Dispatcher.UIThread.Invoke(() => { - Dispatcher.UIThread.Invoke(() => - { - MainWindow.instance.Close(); - }); - } + MainWindow.instance?.Close(); + }); } /// @@ -575,7 +572,7 @@ await Dispatcher.UIThread.Invoke(async () => { //Close App Dispatcher.UIThread.Invoke(() => { - MainWindow.instance!.Close(); + MainWindow.instance?.Close(); }); } catch (Exception ex) @@ -700,7 +697,7 @@ await Dispatcher.UIThread.Invoke(async () => //Close App Dispatcher.UIThread.Invoke(() => { - MainWindow.instance!.Close(); + MainWindow.instance?.Close(); }); } } @@ -752,7 +749,10 @@ public static void OpenQuickSetup() { var dialog = new QuickSetupView(); dialog.DataContext = new QuickSetupViewModel(dialog); - dialog.Show(MainWindow.instance!); + if(MainWindow.instance != null) + dialog.Show(MainWindow.instance); + else + dialog.Show(); }); } @@ -938,7 +938,7 @@ public static async void PlayMod(Mod mod, FsoExecType fsoExecType, bool standalo { if (TaskViewModel.Instance?.IsSafeState() == false) { - var result = await MessageBox.Show(MainWindow.instance!, "Other important tasks are running, it is recommended that you wait until they finish before launching the game because it may cause them to fail.\nIf you are absolutely sure those tasks cannot interfere you can continue.", "Tasks are running", MessageBox.MessageBoxButtons.ContinueCancel); + var result = await MessageBox.Show(MainWindow.instance, "Other important tasks are running, it is recommended that you wait until they finish before launching the game because it may cause them to fail.\nIf you are absolutely sure those tasks cannot interfere you can continue.", "Tasks are running", MessageBox.MessageBoxButtons.ContinueCancel); if(result != MessageBox.MessageBoxResult.Continue) return; } @@ -982,11 +982,7 @@ public static async void PlayMod(Mod mod, FsoExecType fsoExecType, bool standalo if(missingDeps.Count > 0) { - if (MainWindow.instance != null) - { - await MessageBox.Show(MainWindow.instance, errorMsg, "Unable to resolve dependencies", MessageBox.MessageBoxButtons.OK); - } - + await MessageBox.Show(MainWindow.instance, errorMsg, "Unable to resolve dependencies", MessageBox.MessageBoxButtons.OK); return; } @@ -1053,12 +1049,9 @@ public static async void PlayMod(Mod mod, FsoExecType fsoExecType, bool standalo } } Log.Add(Log.LogSeverity.Warning, "Knossos.PlayMod()", outputString); - if (MainWindow.instance != null) - { - var result = await MessageBox.Show(MainWindow.instance, outputString, "Dependency Conflict!", MessageBox.MessageBoxButtons.ContinueCancel); - if (result != MessageBox.MessageBoxResult.Continue) - return; - } + var result = await MessageBox.Show(MainWindow.instance, outputString, "Dependency Conflict!", MessageBox.MessageBoxButtons.ContinueCancel); + if (result != MessageBox.MessageBoxResult.Continue) + return; } } @@ -1121,10 +1114,7 @@ public static async void PlayMod(Mod mod, FsoExecType fsoExecType, bool standalo if(rootPath == string.Empty) { Log.Add(Log.LogSeverity.Error, "Knossos.PlayMod()", "Unable to determine working folder for mod: " + mod.folderName); - if (MainWindow.instance != null) - { - await MessageBox.Show(MainWindow.instance, "Unable to determine working folder for mod: " + mod.folderName, "Error launching mod", MessageBox.MessageBoxButtons.OK); - } + await MessageBox.Show(MainWindow.instance, "Unable to determine working folder for mod: " + mod.folderName, "Error launching mod", MessageBox.MessageBoxButtons.OK); return; } else @@ -1276,16 +1266,13 @@ public static async void PlayMod(Mod mod, FsoExecType fsoExecType, bool standalo if (fsoBuild == null) { Log.Add(Log.LogSeverity.Error, "Knossos.PlayMod()", "Unable to find a valid FSO build for this mod!"); - if (MainWindow.instance != null) + if (hasBuildDependency) { - if (hasBuildDependency) - { - await MessageBox.Show(MainWindow.instance!, "Unable to find a valid FSO build for this mod!", "Error launching mod", MessageBox.MessageBoxButtons.OK); - } - else - { - await MessageBox.Show(MainWindow.instance!, "This mod does not specify an engine build to use, you should select one in the mod settings.", "Error launching mod", MessageBox.MessageBoxButtons.OK); - } + await MessageBox.Show(MainWindow.instance, "Unable to find a valid FSO build for this mod!", "Error launching mod", MessageBox.MessageBoxButtons.OK); + } + else + { + await MessageBox.Show(MainWindow.instance, "This mod does not specify an engine build to use, you should select one in the mod settings.", "Error launching mod", MessageBox.MessageBoxButtons.OK); } return; } @@ -1298,12 +1285,9 @@ public static async void PlayMod(Mod mod, FsoExecType fsoExecType, bool standalo { if (mod.modSettings.isCompressed) { - if (MainWindow.instance != null) - { - var result = await MessageBox.Show(MainWindow.instance!, "This mod currently resolves to FSO build: " + fsoBuild.version + " and it is compressed, the minimum to fully support all compression features is: " + VPCompression.MinimumFSOVersion + ".\n23.0.0 may work if the mod do not have loose files, older versions are not going to work. Use a newer FSO version or uncompress this mod.", "FSO Version below minimum for compression", MessageBox.MessageBoxButtons.ContinueCancel); - if (result != MessageBox.MessageBoxResult.Continue) - return; - } + var result = await MessageBox.Show(MainWindow.instance, "This mod currently resolves to FSO build: " + fsoBuild.version + " and it is compressed, the minimum to fully support all compression features is: " + VPCompression.MinimumFSOVersion + ".\n23.0.0 may work if the mod do not have loose files, older versions are not going to work. Use a newer FSO version or uncompress this mod.", "FSO Version below minimum for compression", MessageBox.MessageBoxButtons.ContinueCancel); + if (result != MessageBox.MessageBoxResult.Continue) + return; } else { @@ -1330,12 +1314,9 @@ public static async void PlayMod(Mod mod, FsoExecType fsoExecType, bool standalo } if (compressedMods != string.Empty) { - if (MainWindow.instance != null) - { - var result = await MessageBox.Show(MainWindow.instance!, "This mod currently resolves to FSO build: " + fsoBuild.version + " and depends on mods: " + compressedMods + " that are currently compressed, the minimum to fully support all compression features is: " + VPCompression.MinimumFSOVersion + ".\n23.0.0 may work if the mod do not have loose files, older versions are not going to work. Use a newer FSO version or uncompress those mods.", "FSO Version below minimum for compression", MessageBox.MessageBoxButtons.ContinueCancel); - if (result != MessageBox.MessageBoxResult.Continue) - return; - } + var result = await MessageBox.Show(MainWindow.instance, "This mod currently resolves to FSO build: " + fsoBuild.version + " and depends on mods: " + compressedMods + " that are currently compressed, the minimum to fully support all compression features is: " + VPCompression.MinimumFSOVersion + ".\n23.0.0 may work if the mod do not have loose files, older versions are not going to work. Use a newer FSO version or uncompress those mods.", "FSO Version below minimum for compression", MessageBox.MessageBoxButtons.ContinueCancel); + if (result != MessageBox.MessageBoxResult.Continue) + return; } } } @@ -1388,7 +1369,7 @@ public static async void PlayMod(Mod mod, FsoExecType fsoExecType, bool standalo - if (MainWindow.instance != null && globalSettings.warnNewSettingsSystem && !CustomLauncher.IsCustomMode) + if (!KnUtils.IsAndroid && globalSettings.warnNewSettingsSystem && !CustomLauncher.IsCustomMode) { try { @@ -1450,10 +1431,7 @@ await Dispatcher.UIThread.InvokeAsync(async () => { if (!fsoResult.IsSuccess) { Log.Add(Log.LogSeverity.Error, "Knossos.PlayMod()", fsoResult.ErrorMessage); - if (MainWindow.instance != null) - { - await MessageBox.Show(MainWindow.instance, fsoResult.ErrorMessage, "Error launching mod", MessageBox.MessageBoxButtons.OK); - } + await MessageBox.Show(MainWindow.instance, fsoResult.ErrorMessage, "Error launching mod", MessageBox.MessageBoxButtons.OK); } } @@ -1610,12 +1588,9 @@ private static async Task FolderSearchRecursive(string path, bool isQuickLaunch, if (folderLevel == 0 ) { - if (MainWindow.instance != null) - { - Dispatcher.UIThread.Invoke(() => { - MessageBox.Show(MainWindow.instance!, "KnossosNET either cannot find or does not have permission to read a previously selected Library Folder.\nEither select a new Library Folder in KnossosNET's settings, or check if the folder is now protected.", "Knossos.NET Library Folder Error" , MessageBox.MessageBoxButtons.OK); - }); - } + Dispatcher.UIThread.Invoke(() => { + MessageBox.Show(MainWindow.instance, "KnossosNET either cannot find or does not have permission to read a previously selected Library Folder.\nEither select a new Library Folder in KnossosNET's settings, or check if the folder is now protected.", "Knossos.NET Library Folder Error" , MessageBox.MessageBoxButtons.OK); + }); } } } diff --git a/Knossos.NET/ViewModels/CustomHomeViewModel.cs b/Knossos.NET/ViewModels/CustomHomeViewModel.cs index 6426be2c..2ab057a7 100644 --- a/Knossos.NET/ViewModels/CustomHomeViewModel.cs +++ b/Knossos.NET/ViewModels/CustomHomeViewModel.cs @@ -184,7 +184,7 @@ private async void Install() { var dialog = new ModInstallView(); dialog.DataContext = new ModInstallViewModel(nebulaModVersions.First(), dialog); - await dialog.ShowDialog(MainWindow.instance!); + await dialog.ShowDialog(MainWindow.instance); } else { @@ -201,7 +201,7 @@ private async void Modify() { var dialog = new ModInstallView(); dialog.DataContext = new ModInstallViewModel(GetActiveInstalledModVersion, dialog, GetActiveInstalledModVersion.version); - await dialog.ShowDialog(MainWindow.instance!); + await dialog.ShowDialog(MainWindow.instance); } else { @@ -218,7 +218,7 @@ private async void Update() { var dialog = new ModInstallView(); dialog.DataContext = new ModInstallViewModel(GetActiveInstalledModVersion, dialog); - await dialog.ShowDialog(MainWindow.instance!); + await dialog.ShowDialog(MainWindow.instance); } else { @@ -303,7 +303,7 @@ public async void RemoveInstalledModVersion(Mod mod) { if (modVersions.Count > 1) { - var resp = await MessageBox.Show(MainWindow.instance!, "You are about to delete version " + GetActiveInstalledModVersion.version + ", this will remove this version only. Do you want to continue?", "Delete version", MessageBox.MessageBoxButtons.YesNo); + var resp = await MessageBox.Show(MainWindow.instance, "You are about to delete version " + GetActiveInstalledModVersion.version + ", this will remove this version only. Do you want to continue?", "Delete version", MessageBox.MessageBoxButtons.YesNo); if (resp == MessageBox.MessageBoxResult.Yes) { var delete = modVersions[ActiveVersionIndex]; @@ -316,7 +316,7 @@ public async void RemoveInstalledModVersion(Mod mod) } else { - var resp = await MessageBox.Show(MainWindow.instance!, "You are about to delete the last installed version. Do you want to continue?", "Delete last version", MessageBox.MessageBoxButtons.YesNo); + var resp = await MessageBox.Show(MainWindow.instance, "You are about to delete the last installed version. Do you want to continue?", "Delete last version", MessageBox.MessageBoxButtons.YesNo); if (resp == MessageBox.MessageBoxResult.Yes) { //Last version @@ -334,7 +334,7 @@ public async void RemoveInstalledModVersion(Mod mod) } else { - await MessageBox.Show(MainWindow.instance!, "You can not delete a mod while other install tasks are running, wait until they finish and try again.", "Tasks are running", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "You can not delete a mod while other install tasks are running, wait until they finish and try again.", "Tasks are running", MessageBox.MessageBoxButtons.OK); } } }catch(Exception ex) diff --git a/Knossos.NET/ViewModels/DebugViewModel.cs b/Knossos.NET/ViewModels/DebugViewModel.cs index cca2420f..eaac853e 100644 --- a/Knossos.NET/ViewModels/DebugViewModel.cs +++ b/Knossos.NET/ViewModels/DebugViewModel.cs @@ -124,7 +124,7 @@ internal async void OpenDebugFilterView() { var dialog = new Views.DebugFiltersView(); dialog.DataContext = new DebugFiltersViewModel(); - await dialog.ShowDialog(MainWindow.instance!); + await dialog.ShowDialog(MainWindow.instance); } } } diff --git a/Knossos.NET/ViewModels/DeveloperModsViewModel.cs b/Knossos.NET/ViewModels/DeveloperModsViewModel.cs index a1c862f3..899bc5fb 100644 --- a/Knossos.NET/ViewModels/DeveloperModsViewModel.cs +++ b/Knossos.NET/ViewModels/DeveloperModsViewModel.cs @@ -293,7 +293,7 @@ internal async void CreateMod() { var dialog = new DevModCreateNewView(); dialog.DataContext = new DevModCreateNewViewModel(dialog); - await dialog.ShowDialog(MainWindow.instance!); + await dialog.ShowDialog(MainWindow.instance); } public void UpdateBuildNames(string stableIn, string nightlyIn) diff --git a/Knossos.NET/ViewModels/FsoBuildsViewModel.cs b/Knossos.NET/ViewModels/FsoBuildsViewModel.cs index 29cb8bf9..1b42b68e 100644 --- a/Knossos.NET/ViewModels/FsoBuildsViewModel.cs +++ b/Knossos.NET/ViewModels/FsoBuildsViewModel.cs @@ -375,7 +375,7 @@ internal void CleanNightlies() installedNL.ForEach( x => fsoVersionString += "\n" + x.ToString() ); Dispatcher.UIThread.Invoke(async() => { - var reply = await MessageBox.Show(MainWindow.instance!, "You are about to delete the following FSO builds:" + fsoVersionString, "Deleting nightlies", MessageBox.MessageBoxButtons.ContinueCancel); + var reply = await MessageBox.Show(MainWindow.instance, "You are about to delete the following FSO builds:" + fsoVersionString, "Deleting nightlies", MessageBox.MessageBoxButtons.ContinueCancel); if(reply == MessageBox.MessageBoxResult.Continue) { foreach (var build in installedNL) @@ -407,7 +407,7 @@ internal void CleanNightlies() { Dispatcher.UIThread.Invoke(() => { - MessageBox.Show(MainWindow.instance!, "There are not installed FSO nightlies to delete", "Error deleting nightlies", MessageBox.MessageBoxButtons.OK); + MessageBox.Show(MainWindow.instance, "There are not installed FSO nightlies to delete", "Error deleting nightlies", MessageBox.MessageBoxButtons.OK); }); } } diff --git a/Knossos.NET/ViewModels/GlobalSettingsViewModel.cs b/Knossos.NET/ViewModels/GlobalSettingsViewModel.cs index 315d28be..9d5ef3fd 100644 --- a/Knossos.NET/ViewModels/GlobalSettingsViewModel.cs +++ b/Knossos.NET/ViewModels/GlobalSettingsViewModel.cs @@ -1573,13 +1573,9 @@ internal async void OpenPerformanceHelp() /// internal async void OpenGetVoices() { - if (MainWindow.instance != null) - { - var dialog = new AddSapiVoicesView(); - dialog.DataContext = new AddSapiVoicesViewModel(); - - await dialog.ShowDialog(MainWindow.instance); - } + var dialog = new AddSapiVoicesView(); + dialog.DataContext = new AddSapiVoicesViewModel(); + await dialog.ShowDialog(MainWindow.instance!); } /// @@ -1667,7 +1663,7 @@ internal async void OpenDebugFilterView() { var dialog = new Views.DebugFiltersView(); dialog.DataContext = new DebugFiltersViewModel(); - await dialog.ShowDialog(MainWindow.instance!); + await dialog.ShowDialog(MainWindow.instance); } internal void ToggleDeveloperOptions() diff --git a/Knossos.NET/ViewModels/PxoViewModel.cs b/Knossos.NET/ViewModels/PxoViewModel.cs index fcbdaff8..75751df0 100644 --- a/Knossos.NET/ViewModels/PxoViewModel.cs +++ b/Knossos.NET/ViewModels/PxoViewModel.cs @@ -100,19 +100,19 @@ internal async void SavePXOCredentials() Password = Password.Replace(" ", ""); if (Login == string.Empty || Password == string.Empty) { - await MessageBox.Show(MainWindow.instance!, "The PXO Login and Password cant be empty.", "Validation error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "The PXO Login and Password cant be empty.", "Validation error", MessageBox.MessageBoxButtons.OK); return; } if (!Login.All(char.IsDigit) || Login.Length > 8) { - await MessageBox.Show(MainWindow.instance!, "The PXO Login can only contain digits and have a max length of 8.", "Validation error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "The PXO Login can only contain digits and have a max length of 8.", "Validation error", MessageBox.MessageBoxButtons.OK); return; } if (Password.All(char.IsDigit) || !Password.All(char.IsLower) || Password.Length != 12) { - await MessageBox.Show(MainWindow.instance!, "The PXO Password can only contain 12 lowercase letters.", "Validation error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "The PXO Password can only contain 12 lowercase letters.", "Validation error", MessageBox.MessageBoxButtons.OK); return; } diff --git a/Knossos.NET/ViewModels/TaskViewModel.cs b/Knossos.NET/ViewModels/TaskViewModel.cs index 9734736e..cc4f9f93 100644 --- a/Knossos.NET/ViewModels/TaskViewModel.cs +++ b/Knossos.NET/ViewModels/TaskViewModel.cs @@ -257,7 +257,7 @@ public int NumberOfTasks() { await Dispatcher.UIThread.InvokeAsync(async () => { - await MessageBox.Show(MainWindow.instance!, "KnossosNET Library Folder path is not set! Before installing mods go to settings and select a Library Folder.", "Error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "KnossosNET Library Folder path is not set! Before installing mods go to settings and select a Library Folder.", "Error", MessageBox.MessageBoxButtons.OK); }); return null; } @@ -298,7 +298,7 @@ public async void InstallMod(Mod mod, List? reinstallPkgs = null, bo { await Dispatcher.UIThread.InvokeAsync(async () => { - await MessageBox.Show(MainWindow.instance!, "KnossosNET Library Folder path is not set! Before installing mods go to settings and select a Library Folder.", "Error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "KnossosNET Library Folder path is not set! Before installing mods go to settings and select a Library Folder.", "Error", MessageBox.MessageBoxButtons.OK); }); return; } diff --git a/Knossos.NET/ViewModels/Templates/DevBuildPkgMgrViewModel.cs b/Knossos.NET/ViewModels/Templates/DevBuildPkgMgrViewModel.cs index 0aa630f7..fbd58c5b 100644 --- a/Knossos.NET/ViewModels/Templates/DevBuildPkgMgrViewModel.cs +++ b/Knossos.NET/ViewModels/Templates/DevBuildPkgMgrViewModel.cs @@ -387,7 +387,7 @@ internal async void DeletePkg(EditorPackageItem editorPackageItem) if (editor != null) { var folderPath = Path.Combine(editor.ActiveVersion.fullPath, editorPackageItem.Package.folder != null ? editorPackageItem.Package.folder : string.Empty); - var resp = await MessageBox.Show(MainWindow.instance!, "This will delete the package: " + editorPackageItem.Package.name + " and ALL FILES on this folder: " + folderPath + " of the build and version " + editor.ActiveVersion + "\n Do you really want to do this? This action cannot be undone.", "Confirm package deletion", MessageBox.MessageBoxButtons.YesNo); + var resp = await MessageBox.Show(MainWindow.instance, "This will delete the package: " + editorPackageItem.Package.name + " and ALL FILES on this folder: " + folderPath + " of the build and version " + editor.ActiveVersion + "\n Do you really want to do this? This action cannot be undone.", "Confirm package deletion", MessageBox.MessageBoxButtons.YesNo); if (resp == MessageBox.MessageBoxResult.Yes) { Directory.Delete(folderPath, true); diff --git a/Knossos.NET/ViewModels/Templates/DevModDetailsViewModel.cs b/Knossos.NET/ViewModels/Templates/DevModDetailsViewModel.cs index 57c8efd4..23746bb3 100644 --- a/Knossos.NET/ViewModels/Templates/DevModDetailsViewModel.cs +++ b/Knossos.NET/ViewModels/Templates/DevModDetailsViewModel.cs @@ -204,7 +204,7 @@ internal async void ChangeTileImage() var length = file.Length; file.Close(); Dispatcher.UIThread.Invoke(() => { - MessageBox.Show(MainWindow.instance!, "The image file size (" + length + " bytes) is over the max limit allowed (307200 bytes)", "Selected image file too is too big", MessageBox.MessageBoxButtons.OK); + MessageBox.Show(MainWindow.instance, "The image file size (" + length + " bytes) is over the max limit allowed (307200 bytes)", "Selected image file too is too big", MessageBox.MessageBoxButtons.OK); }); throw new Exception("The image file size (" + length + " bytes) is over the max limit allowed (307200 bytes)"); } @@ -269,7 +269,7 @@ internal async void ChangeBannerImage() var length = file.Length; file.Close(); Dispatcher.UIThread.Invoke(() => { - MessageBox.Show(MainWindow.instance!, "The image file size (" + length + " bytes) is over the max limit allowed (10485760 bytes)", "Selected image file too is too big", MessageBox.MessageBoxButtons.OK); + MessageBox.Show(MainWindow.instance, "The image file size (" + length + " bytes) is over the max limit allowed (10485760 bytes)", "Selected image file too is too big", MessageBox.MessageBoxButtons.OK); }); throw new Exception("The image file size (" + length + " bytes) is over the max limit allowed (10485760 bytes)"); } @@ -404,7 +404,7 @@ internal async void NewScreenShot() var length = file.Length; file.Close(); Dispatcher.UIThread.Invoke(() => { - MessageBox.Show(MainWindow.instance!, "The image file size (" + length + " bytes) is over the max limit allowed (10485760 bytes)", "Selected image file too is too big", MessageBox.MessageBoxButtons.OK); + MessageBox.Show(MainWindow.instance, "The image file size (" + length + " bytes) is over the max limit allowed (10485760 bytes)", "Selected image file too is too big", MessageBox.MessageBoxButtons.OK); }); throw new Exception("The image file size (" + length + " bytes) is over the max limit allowed (10485760 bytes)"); } diff --git a/Knossos.NET/ViewModels/Templates/DevModFsoSettingsViewModel.cs b/Knossos.NET/ViewModels/Templates/DevModFsoSettingsViewModel.cs index bf79ddb9..111f7ebf 100644 --- a/Knossos.NET/ViewModels/Templates/DevModFsoSettingsViewModel.cs +++ b/Knossos.NET/ViewModels/Templates/DevModFsoSettingsViewModel.cs @@ -112,7 +112,7 @@ internal async void ConfigureBuild() { await Dispatcher.UIThread.InvokeAsync(async () => { - await MessageBox.Show(MainWindow.instance!, "Unable to get flag data from build " + fsoBuild + " It might be below the minimal version supported (3.8.1) or some other error ocurred.", "Invalid flag data", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Unable to get flag data from build " + fsoBuild + " It might be below the minimal version supported (3.8.1) or some other error ocurred.", "Invalid flag data", MessageBox.MessageBoxButtons.OK); }); } @@ -122,7 +122,7 @@ await Dispatcher.UIThread.InvokeAsync(async () => /* No valid build found, send message */ await Dispatcher.UIThread.InvokeAsync(async () => { - await MessageBox.Show(MainWindow.instance!, "Unable to resolve FSO build dependency, download the correct one or manually select a FSO version. ", "Not engine build found", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Unable to resolve FSO build dependency, download the correct one or manually select a FSO version. ", "Not engine build found", MessageBox.MessageBoxButtons.OK); }); } } diff --git a/Knossos.NET/ViewModels/Templates/DevModMembersMgrViewModel.cs b/Knossos.NET/ViewModels/Templates/DevModMembersMgrViewModel.cs index 1547b190..aa8fe137 100644 --- a/Knossos.NET/ViewModels/Templates/DevModMembersMgrViewModel.cs +++ b/Knossos.NET/ViewModels/Templates/DevModMembersMgrViewModel.cs @@ -107,7 +107,7 @@ public async void UpdateUI() //verify if the modid is already uploaded to nebula if(await Nebula.IsModIdInNebula(editor.ActiveVersion.id) == false) { - _ = MessageBox.Show(MainWindow.instance!, "The mod id: " + editor.ActiveVersion.id + ", was not found in Nebula's database. This likely means your mod was never uploaded to Nebula.\nYou need to upload at least one version to Nebula (public or private) in order to manage mod members.\nIt can also be caused by a network error.", "Mod ID not in Nebula", MessageBox.MessageBoxButtons.OK); + _ = MessageBox.Show(MainWindow.instance, "The mod id: " + editor.ActiveVersion.id + ", was not found in Nebula's database. This likely means your mod was never uploaded to Nebula.\nYou need to upload at least one version to Nebula (public or private) in order to manage mod members.\nIt can also be caused by a network error.", "Mod ID not in Nebula", MessageBox.MessageBoxButtons.OK); ButtonsEnabled = false; return; } @@ -125,7 +125,7 @@ public async void UpdateUI() } else { - _ = MessageBox.Show(MainWindow.instance!, "An error has ocurred while retrieving the mod member list. The log may provide more information.", "Error", MessageBox.MessageBoxButtons.OK); + _ = MessageBox.Show(MainWindow.instance, "An error has ocurred while retrieving the mod member list. The log may provide more information.", "Error", MessageBox.MessageBoxButtons.OK); } }); } else { @@ -165,7 +165,7 @@ internal async void Save() } if (!currentUserIsFound) { - _ = MessageBox.Show(MainWindow.instance!, "For some reason your nebula user name: " + Nebula.userName + ". Was not found in this mod team member list. You cant save changes in this condition.", "Error", MessageBox.MessageBoxButtons.OK); + _ = MessageBox.Show(MainWindow.instance, "For some reason your nebula user name: " + Nebula.userName + ". Was not found in this mod team member list. You cant save changes in this condition.", "Error", MessageBox.MessageBoxButtons.OK); return; } ButtonsEnabled = false; @@ -175,16 +175,16 @@ await Dispatcher.UIThread.InvokeAsync(async() => { { if(result == "ok") { - await MessageBox.Show(MainWindow.instance!, "Mod members updated successfully!", "Save Changes", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Mod members updated successfully!", "Save Changes", MessageBox.MessageBoxButtons.OK); } else { - await MessageBox.Show(MainWindow.instance!, "An error has ocurred while updating members, no changes were saved. Reason: " + result, "Error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "An error has ocurred while updating members, no changes were saved. Reason: " + result, "Error", MessageBox.MessageBoxButtons.OK); } } else { - await MessageBox.Show(MainWindow.instance!, "An error has ocurred while updating members, no changes were saved. Reason: Unknown", "Error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "An error has ocurred while updating members, no changes were saved. Reason: Unknown", "Error", MessageBox.MessageBoxButtons.OK); } ButtonsEnabled = true; }).ConfigureAwait(false); diff --git a/Knossos.NET/ViewModels/Templates/DevModPkgMgrViewModel.cs b/Knossos.NET/ViewModels/Templates/DevModPkgMgrViewModel.cs index 23b820a2..1a524556 100644 --- a/Knossos.NET/ViewModels/Templates/DevModPkgMgrViewModel.cs +++ b/Knossos.NET/ViewModels/Templates/DevModPkgMgrViewModel.cs @@ -745,7 +745,7 @@ internal async void DeletePkg(EditorModPackageItem editorPackageItem) if (editor != null) { var folderPath = editor.ActiveVersion.fullPath + Path.DirectorySeparatorChar + editorPackageItem.Package.folder; - var resp = await MessageBox.Show(MainWindow.instance!, "This will delete the package: " + editorPackageItem.Package.name + " and ALL FILES on this folder: " + folderPath + " of the mod and version " + editor.ActiveVersion + "\n Do you really want to do this? This action cannot be undone.","Confirm package deletion",MessageBox.MessageBoxButtons.YesNo); + var resp = await MessageBox.Show(MainWindow.instance, "This will delete the package: " + editorPackageItem.Package.name + " and ALL FILES on this folder: " + folderPath + " of the mod and version " + editor.ActiveVersion + "\n Do you really want to do this? This action cannot be undone.","Confirm package deletion",MessageBox.MessageBoxButtons.YesNo); if(resp == MessageBox.MessageBoxResult.Yes) { try diff --git a/Knossos.NET/ViewModels/Templates/DevModVersionsViewModel.cs b/Knossos.NET/ViewModels/Templates/DevModVersionsViewModel.cs index 4b95cf28..accd53e8 100644 --- a/Knossos.NET/ViewModels/Templates/DevModVersionsViewModel.cs +++ b/Knossos.NET/ViewModels/Templates/DevModVersionsViewModel.cs @@ -165,7 +165,7 @@ internal async void LoadVersionsFromNebula() { var dialog = new ModInstallView(); dialog.DataContext = new ModInstallViewModel(editor.ActiveVersion, dialog, editor.ActiveVersion.version, true); - await dialog.ShowDialog(MainWindow.instance!); + await dialog.ShowDialog(MainWindow.instance); } } catch(Exception ex) @@ -181,12 +181,12 @@ internal async void CreateNewVersion(object control) //Validate new version string if(!VerifyNewVersion()) { - await MessageBox.Show(MainWindow.instance!, "'" + NewVersion + "' is not a valid semantic version.", "Validation error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "'" + NewVersion + "' is not a valid semantic version.", "Validation error", MessageBox.MessageBoxButtons.OK); return; } if (Mods.FirstOrDefault(m => m.version == NewVersion) != null) { - await MessageBox.Show(MainWindow.instance!, "'" + NewVersion + "' already exists.", "Validation error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "'" + NewVersion + "' already exists.", "Validation error", MessageBox.MessageBoxButtons.OK); return; } var parentDir = new DirectoryInfo(editor.ActiveVersion.fullPath).Parent; @@ -198,7 +198,7 @@ internal async void CreateNewVersion(object control) var newDir = parentDir.FullName + Path.DirectorySeparatorChar + editor.ActiveVersion.id + "-" + NewVersion; if (Directory.Exists(newDir)) { - await MessageBox.Show(MainWindow.instance!, "The directory '"+ newDir + "' already exists.", "Validation error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "The directory '"+ newDir + "' already exists.", "Validation error", MessageBox.MessageBoxButtons.OK); return; } @@ -229,16 +229,16 @@ internal async void UploadModAdvanced() { var dialog = new DevModAdvancedUploadView(); dialog.DataContext = new DevModAdvancedUploadViewModel(mod, dialog, this); - await dialog.ShowDialog(MainWindow.instance!); + await dialog.ShowDialog(MainWindow.instance); } else { - _ = MessageBox.Show(MainWindow.instance!, "Advanced uploading is only available for Mods and TCs.", "Unsupported for type: " + mod.type, MessageBox.MessageBoxButtons.OK); + _ = MessageBox.Show(MainWindow.instance, "Advanced uploading is only available for Mods and TCs.", "Unsupported for type: " + mod.type, MessageBox.MessageBoxButtons.OK); } } else { - _ = MessageBox.Show(MainWindow.instance!, "This mod version is already uploaded to nebula, if you want to update the metadata use the basic upload", "Mod already uploaded", MessageBox.MessageBoxButtons.OK); + _ = MessageBox.Show(MainWindow.instance, "This mod version is already uploaded to nebula, if you want to update the metadata use the basic upload", "Mod already uploaded", MessageBox.MessageBoxButtons.OK); } } } @@ -298,7 +298,7 @@ private async Task UploadProcess(List? advData = null, { if(!TaskViewModel.Instance!.IsSafeState()) { - await MessageBox.Show(MainWindow.instance!, "You must wait for other tasks to finish before uploading a new mod.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "You must wait for other tasks to finish before uploading a new mod.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); ButtonsEnabled = true; return; } @@ -309,7 +309,7 @@ private async Task UploadProcess(List? advData = null, //Packages exist? && One requiered Package if (mod.packages == null || !mod.packages.Any() || mod.packages.FirstOrDefault(x => x.status == "required") == null) { - await MessageBox.Show(MainWindow.instance!, "The mod must include at least one required package.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "The mod must include at least one required package.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); ButtonsEnabled = true; return; } @@ -329,12 +329,12 @@ private async Task UploadProcess(List? advData = null, { if (mod.type == ModType.mod) { - await MessageBox.Show(MainWindow.instance!, "This mod depends on: " + depMod + ". That mod has a diferent parent mod: " + await MessageBox.Show(MainWindow.instance, "This mod depends on: " + depMod + ". That mod has a diferent parent mod: " + depMod.parent + ". And it is not intended to be used with your TC mod: " + mod.id, "Basic Check Fail", MessageBox.MessageBoxButtons.OK); } if (mod.type == ModType.tc) { - await MessageBox.Show(MainWindow.instance!, "This mod depends on: " + depMod + ". Thats a different TC mod. Your TC mod cant depend on another TC mod." + await MessageBox.Show(MainWindow.instance, "This mod depends on: " + depMod + ". Thats a different TC mod. Your TC mod cant depend on another TC mod." , "Basic Check Fail", MessageBox.MessageBoxButtons.OK); } return; @@ -363,7 +363,7 @@ await MessageBox.Show(MainWindow.instance!, "This mod depends on: " + depMod + " } if(!found) { - await MessageBox.Show(MainWindow.instance!, "Mods for TC other than 'FS2' must also include a dependency to that TC mod.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Mods for TC other than 'FS2' must also include a dependency to that TC mod.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); ButtonsEnabled = true; return; } @@ -372,7 +372,7 @@ await MessageBox.Show(MainWindow.instance!, "This mod depends on: " + depMod + " //if the tile image size is over the maximum allowed (300kb) if (!string.IsNullOrEmpty(mod.tile) && File.Exists(Path.Combine(mod.fullPath,mod.tile)) && new FileInfo(Path.Combine(mod.fullPath, mod.tile)).Length > 307200) { - await MessageBox.Show(MainWindow.instance!, "The mod tile image is over the maximum of 300kb allowed.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "The mod tile image is over the maximum of 300kb allowed.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); ButtonsEnabled = true; return; } @@ -384,7 +384,7 @@ await MessageBox.Show(MainWindow.instance!, "This mod depends on: " + depMod + " { if(string.IsNullOrEmpty(pkg.environment)) { - await MessageBox.Show(MainWindow.instance!, "Package " + pkg.name + " has a empty environment string.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Package " + pkg.name + " has a empty environment string.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); ButtonsEnabled = true; return; } @@ -412,7 +412,7 @@ await MessageBox.Show(MainWindow.instance!, "This mod depends on: " + depMod + " } if (!found) { - await MessageBox.Show(MainWindow.instance!, "Mods and TCs must include a FSO engine dependency in one of the required packages.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Mods and TCs must include a FSO engine dependency in one of the required packages.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); ButtonsEnabled = true; return; } @@ -431,7 +431,7 @@ await MessageBox.Show(MainWindow.instance!, "This mod depends on: " + depMod + " var modlist = await Nebula.GetAllModsWithID(dep.id); if(modlist == null || !modlist.Any()) { - await MessageBox.Show(MainWindow.instance!, "Your mod depends on mod id: " + dep.id + " that was not found in Nebula.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Your mod depends on mod id: " + dep.id + " that was not found in Nebula.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); ButtonsEnabled = true; return; } @@ -446,7 +446,7 @@ await MessageBox.Show(MainWindow.instance!, "This mod depends on: " + depMod + " } if(!found) { - await MessageBox.Show(MainWindow.instance!, "Your mod depends on mod id: " + dep.id + " Condition: " + dep.version + " we cant find " + + await MessageBox.Show(MainWindow.instance, "Your mod depends on mod id: " + dep.id + " Condition: " + dep.version + " we cant find " + "a candidate in Nebula that satisfies the condition with a compatible mod visibility.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); ButtonsEnabled = true; return; @@ -459,7 +459,7 @@ await MessageBox.Show(MainWindow.instance!, "Your mod depends on mod id: " + dep //User must be logged in nebula. if (!await Nebula.Login()) { - await MessageBox.Show(MainWindow.instance!, "You must be logged in to nebula in order to upload mods.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "You must be logged in to nebula in order to upload mods.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); ButtonsEnabled = true; return; } @@ -470,7 +470,7 @@ await MessageBox.Show(MainWindow.instance!, "Your mod depends on mod id: " + dep { if(!await Nebula.IsModEditable(mod.id)) { - await MessageBox.Show(MainWindow.instance!, "You do not have write permissions to this mod.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "You do not have write permissions to this mod.", "Basic Check Fail", MessageBox.MessageBoxButtons.OK); ButtonsEnabled = true; return; } @@ -480,7 +480,7 @@ await MessageBox.Show(MainWindow.instance!, "Your mod depends on mod id: " + dep //if there is no tile image (for type != engine) or description. if (string.IsNullOrEmpty(mod.description) && mod.type != ModType.engine) { - if(await MessageBox.Show(MainWindow.instance!, "Your mod does not include a description, it is recomended you set a description for users. " + + if(await MessageBox.Show(MainWindow.instance, "Your mod does not include a description, it is recomended you set a description for users. " + "This is only a warning and you can continue the upload if you want.", "Basic Check Warning", MessageBox.MessageBoxButtons.ContinueCancel) != MessageBox.MessageBoxResult.Continue) { ButtonsEnabled = true; @@ -489,7 +489,7 @@ await MessageBox.Show(MainWindow.instance!, "Your mod depends on mod id: " + dep } if (string.IsNullOrEmpty(mod.tile) && mod.type != ModType.engine) { - if (await MessageBox.Show(MainWindow.instance!, "Your mod does not include a tile image, it is recomended you set a tile image for users. " + + if (await MessageBox.Show(MainWindow.instance, "Your mod does not include a tile image, it is recomended you set a tile image for users. " + "This is only a warning and you can continue the upload if you want.", "Basic Check Warning", MessageBox.MessageBoxButtons.ContinueCancel) != MessageBox.MessageBoxResult.Continue) { ButtonsEnabled = true; @@ -500,7 +500,7 @@ await MessageBox.Show(MainWindow.instance!, "Your mod depends on mod id: " + dep //Warn about the mod visibility before upload, for both private and public, and what it means. if(mod.isPrivate) { - if (await MessageBox.Show(MainWindow.instance!, "The mod version you are uploading is set to 'PRIVATE'. " + + if (await MessageBox.Show(MainWindow.instance, "The mod version you are uploading is set to 'PRIVATE'. " + "This means only the mod members will be able to see it. Do you want to continue?", "Basic Check Warning", MessageBox.MessageBoxButtons.ContinueCancel) != MessageBox.MessageBoxResult.Continue) { ButtonsEnabled = true; @@ -509,7 +509,7 @@ await MessageBox.Show(MainWindow.instance!, "Your mod depends on mod id: " + dep } else { - if (await MessageBox.Show(MainWindow.instance!, "The mod version you are uploading is set to 'PUBLIC'. " + + if (await MessageBox.Show(MainWindow.instance, "The mod version you are uploading is set to 'PUBLIC'. " + "This means the mod will be available for everyone. Do you want to continue?", "Basic Check Warning", MessageBox.MessageBoxButtons.ContinueCancel) != MessageBox.MessageBoxResult.Continue) { ButtonsEnabled = true; @@ -522,7 +522,7 @@ await MessageBox.Show(MainWindow.instance!, "Your mod depends on mod id: " + dep if(await Nebula.GetModData(mod.id,mod.version) != null) { metaUpdOnly = true; - var res = await MessageBox.Show(MainWindow.instance!, "This mod and version '" + mod + "' is already uploaded to Nebula, if you continue only the metadata will be updated.", "Version already uploaded", MessageBox.MessageBoxButtons.ContinueCancel); + var res = await MessageBox.Show(MainWindow.instance, "This mod and version '" + mod + "' is already uploaded to Nebula, if you continue only the metadata will be updated.", "Version already uploaded", MessageBox.MessageBoxButtons.ContinueCancel); if(res == MessageBox.MessageBoxResult.Cancel) { ButtonsEnabled = true; @@ -554,7 +554,7 @@ internal async void DeleteAll() { if (editor != null) { - var response = await MessageBox.Show(MainWindow.instance!, "This is going to complete delete the mod " + editor.ActiveVersion.title + " from your library." + + var response = await MessageBox.Show(MainWindow.instance, "This is going to complete delete the mod " + editor.ActiveVersion.title + " from your library." + " All versions will be deleted. This is not going to affect any version already uploaded to Nebula.", "Delete ALL mod versions", MessageBox.MessageBoxButtons.OKCancel); if (response == MessageBox.MessageBoxResult.OK) { @@ -569,7 +569,7 @@ internal async void DeleteNebula() { if(editor.ActiveVersion.inNebula) { - var response = await MessageBox.Show(MainWindow.instance!, "Do you really want to remove mod " + editor.ActiveVersion + " from Nebula? " + + var response = await MessageBox.Show(MainWindow.instance, "Do you really want to remove mod " + editor.ActiveVersion + " from Nebula? " + "this is not going to affect local files. ", "Delete mod from Nebula", MessageBox.MessageBoxButtons.OKCancel); if (response == MessageBox.MessageBoxResult.OK) { @@ -582,16 +582,16 @@ internal async void DeleteNebula() { editor.ActiveVersion.inNebula = false; HackUpdateModList(); - await MessageBox.Show(MainWindow.instance!, "The mod " + editor.ActiveVersion + " was deleted from Nebula.", "Mod deleted", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "The mod " + editor.ActiveVersion + " was deleted from Nebula.", "Mod deleted", MessageBox.MessageBoxButtons.OK); } else { - await MessageBox.Show(MainWindow.instance!, "An error has ocurred while trying to remove mod " + editor.ActiveVersion + " from Nebula. Reason: " + result, "Mod delete error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "An error has ocurred while trying to remove mod " + editor.ActiveVersion + " from Nebula. Reason: " + result, "Mod delete error", MessageBox.MessageBoxButtons.OK); } } else { - await MessageBox.Show(MainWindow.instance!, "An error has ocurred while trying to remove mod " + editor.ActiveVersion + " from Nebula. Reason: unknown error", "Mod delete error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "An error has ocurred while trying to remove mod " + editor.ActiveVersion + " from Nebula. Reason: unknown error", "Mod delete error", MessageBox.MessageBoxButtons.OK); } ButtonsEnabled = true; } @@ -603,7 +603,7 @@ internal async void DeleteLocally() { if (editor != null) { - var response = await MessageBox.Show(MainWindow.instance!, "This is going to delete the mod/version " + editor.ActiveVersion + " from your library." + + var response = await MessageBox.Show(MainWindow.instance, "This is going to delete the mod/version " + editor.ActiveVersion + " from your library." + " This is not going to affect anything uploaded to Nebula.", "Delete mod version", MessageBox.MessageBoxButtons.OKCancel); if (response == MessageBox.MessageBoxResult.OK) { @@ -645,13 +645,13 @@ internal async void CreateDevEnv() string explanation = "A DevEnv version is a mod version intended to be used for continuous local development process, and it can't be uploaded to Nebula.\nThis version will always be the default active version every time you start Knet, and" + " provides a static folder you can always work on.\nWhen you want to release a new version you can create a new version from the DevEnv one and release it."; - if(await MessageBox.Show(MainWindow.instance!, explanation, "Creating Dev Environment version", MessageBox.MessageBoxButtons.ContinueCancel) != MessageBox.MessageBoxResult.Continue) + if(await MessageBox.Show(MainWindow.instance, explanation, "Creating Dev Environment version", MessageBox.MessageBoxButtons.ContinueCancel) != MessageBox.MessageBoxResult.Continue) { return; } if (Mods.FirstOrDefault(m => m.version == devVersion) != null) { - await MessageBox.Show(MainWindow.instance!, "'" + devVersion + "' already exists.", "Validation error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "'" + devVersion + "' already exists.", "Validation error", MessageBox.MessageBoxButtons.OK); return; } var parentDir = new DirectoryInfo(editor.ActiveVersion.fullPath).Parent; @@ -663,7 +663,7 @@ internal async void CreateDevEnv() var newDir = parentDir.FullName + Path.DirectorySeparatorChar + editor.ActiveVersion.id + "-" + devVersion; if (Directory.Exists(newDir)) { - await MessageBox.Show(MainWindow.instance!, "The directory '" + newDir + "' already exists.", "Validation error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "The directory '" + newDir + "' already exists.", "Validation error", MessageBox.MessageBoxButtons.OK); return; } diff --git a/Knossos.NET/ViewModels/Templates/ModCardViewModel.cs b/Knossos.NET/ViewModels/Templates/ModCardViewModel.cs index b2ffefc3..cc37f4e8 100644 --- a/Knossos.NET/ViewModels/Templates/ModCardViewModel.cs +++ b/Knossos.NET/ViewModels/Templates/ModCardViewModel.cs @@ -323,14 +323,14 @@ internal async void ButtonCommandUpdate() { var dialog = new ModInstallView(); dialog.DataContext = new ModInstallViewModel(modVersions[activeVersionIndex], dialog); - await dialog.ShowDialog(MainWindow.instance!); + await dialog.ShowDialog(MainWindow.instance); } internal async void ButtonCommandModify() { var dialog = new ModInstallView(); dialog.DataContext = new ModInstallViewModel(modVersions[activeVersionIndex], dialog, modVersions[activeVersionIndex].version); - await dialog.ShowDialog(MainWindow.instance!); + await dialog.ShowDialog(MainWindow.instance); } internal async void ButtonCommandDelete() @@ -339,7 +339,7 @@ internal async void ButtonCommandDelete() { if (TaskViewModel.Instance!.IsSafeState()) { - var result = await MessageBox.Show(MainWindow.instance!, "You are going to remove mod " + Name + " .This will delete ALL versions of the mod. If you only want to delete a specific version you can do it from mod details.\n Do you really want to delete the mod?", "Delete mod", MessageBox.MessageBoxButtons.OKCancel); + var result = await MessageBox.Show(MainWindow.instance, "You are going to remove mod " + Name + " .This will delete ALL versions of the mod. If you only want to delete a specific version you can do it from mod details.\n Do you really want to delete the mod?", "Delete mod", MessageBox.MessageBoxButtons.OKCancel); if (result == MessageBox.MessageBoxResult.OK) { modVersions[modVersions.Count - 1].installed = false; @@ -359,12 +359,12 @@ internal async void ButtonCommandDelete() } else { - await MessageBox.Show(MainWindow.instance!, "You can not delete a mod while other install tasks are running, wait until they finish and try again.", "Tasks are running", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "You can not delete a mod while other install tasks are running, wait until they finish and try again.", "Tasks are running", MessageBox.MessageBoxButtons.OK); } } else { - await MessageBox.Show(MainWindow.instance!, "Dev mode mods can not be delated from the main view, go to the Development section.", "Mod is dev mode", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Dev mode mods can not be delated from the main view, go to the Development section.", "Mod is dev mode", MessageBox.MessageBoxButtons.OK); } } diff --git a/Knossos.NET/ViewModels/Templates/NebulaLoginViewModel.cs b/Knossos.NET/ViewModels/Templates/NebulaLoginViewModel.cs index 0a69cde1..81910e96 100644 --- a/Knossos.NET/ViewModels/Templates/NebulaLoginViewModel.cs +++ b/Knossos.NET/ViewModels/Templates/NebulaLoginViewModel.cs @@ -86,7 +86,7 @@ internal async void Install() } var dialog = new ModInstallView(); dialog.DataContext = new ModInstallViewModel(mod, dialog, mod.version); - await dialog.ShowDialog(MainWindow.instance!); + await dialog.ShowDialog(MainWindow.instance); } } else @@ -102,13 +102,13 @@ internal async void LogIn() if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(UserPass)) { - await MessageBox.Show(MainWindow.instance!, "Username and password are required fields.", "Login error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Username and password are required fields.", "Login error", MessageBox.MessageBoxButtons.OK); return; } var result = await Nebula.Login(UserName, UserPass); if (!result) { - await MessageBox.Show(MainWindow.instance!, "Login failed, the user or password may be incorrect.", "Login error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Login failed, the user or password may be incorrect.", "Login error", MessageBox.MessageBoxButtons.OK); } else { @@ -143,29 +143,29 @@ internal async void Register() if(string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(UserPass) || string.IsNullOrEmpty(UserEmail)) { - await MessageBox.Show(MainWindow.instance!, "Username, password and email are all required fields.", "Register error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Username, password and email are all required fields.", "Register error", MessageBox.MessageBoxButtons.OK); return; } if(UserPass.Length < 5 || UserName.Length < 5) { - await MessageBox.Show(MainWindow.instance!, "The mininum length for password and username is 6.", "Register error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "The mininum length for password and username is 6.", "Register error", MessageBox.MessageBoxButtons.OK); return; } if(!KnUtils.IsValidEmail(UserEmail)) { - await MessageBox.Show(MainWindow.instance!, "Email: "+UserEmail+ " is not a valid email.", "Register error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Email: "+UserEmail+ " is not a valid email.", "Register error", MessageBox.MessageBoxButtons.OK); return; } var result = await Nebula.Register(UserName, UserPass, UserEmail); if (result == "ok") { - await MessageBox.Show(MainWindow.instance!, "You need to activate your user before you can log in. An an account activation email has sent to your email address.", "Register successfull", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "You need to activate your user before you can log in. An an account activation email has sent to your email address.", "Register successfull", MessageBox.MessageBoxButtons.OK); UpdateUI(); } else { //The only way this can fail at this point is username - await MessageBox.Show(MainWindow.instance!, "An error has ocurred while registering a new username. Reason: "+result, "Register error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "An error has ocurred while registering a new username. Reason: "+result, "Register error", MessageBox.MessageBoxButtons.OK); } } @@ -175,19 +175,19 @@ internal async void Reset() if (string.IsNullOrEmpty(UserName)) { - await MessageBox.Show(MainWindow.instance!, "Username is a required field.", "Reset password", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Username is a required field.", "Reset password", MessageBox.MessageBoxButtons.OK); return; } var result = await Nebula.Reset(UserName); if (result == "ok") { - await MessageBox.Show(MainWindow.instance!, "A password reset link has been sent to your email.", "Reset password", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "A password reset link has been sent to your email.", "Reset password", MessageBox.MessageBoxButtons.OK); UpdateUI(); } else { //The only way this can fail at this point is username - await MessageBox.Show(MainWindow.instance!, "An error has ocurred while requesting password reset. Reason: " + result, "Reset password", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "An error has ocurred while requesting password reset. Reason: " + result, "Reset password", MessageBox.MessageBoxButtons.OK); } } } diff --git a/Knossos.NET/ViewModels/Templates/NebulaModCardViewModel.cs b/Knossos.NET/ViewModels/Templates/NebulaModCardViewModel.cs index 2b8f9703..fc927837 100644 --- a/Knossos.NET/ViewModels/Templates/NebulaModCardViewModel.cs +++ b/Knossos.NET/ViewModels/Templates/NebulaModCardViewModel.cs @@ -123,7 +123,7 @@ internal async void ButtonCommandInstall() { var dialog = new ModInstallView(); dialog.DataContext = new ModInstallViewModel(modJson, dialog); - await dialog.ShowDialog(MainWindow.instance!); + await dialog.ShowDialog(MainWindow.instance); } } diff --git a/Knossos.NET/ViewModels/Templates/Tasks/InstallBuild.cs b/Knossos.NET/ViewModels/Templates/Tasks/InstallBuild.cs index 8452b377..b25e51bb 100644 --- a/Knossos.NET/ViewModels/Templates/Tasks/InstallBuild.cs +++ b/Knossos.NET/ViewModels/Templates/Tasks/InstallBuild.cs @@ -760,7 +760,7 @@ Task cancel forced due to a error await Dispatcher.UIThread.InvokeAsync(async () => { //Messagebox is not thread safe! - await MessageBox.Show(MainWindow.instance!, "An error was ocurred during the download of the mod: " + build.ToString() + ". Error: " + ex.Message, "Error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "An error was ocurred during the download of the mod: " + build.ToString() + ". Error: " + ex.Message, "Error", MessageBox.MessageBoxButtons.OK); }); while (TaskViewModel.Instance!.taskQueue.Count > 0 && TaskViewModel.Instance!.taskQueue.Peek() != this) { diff --git a/Knossos.NET/ViewModels/Templates/Tasks/InstallMod.cs b/Knossos.NET/ViewModels/Templates/Tasks/InstallMod.cs index 428c274e..b1878b30 100644 --- a/Knossos.NET/ViewModels/Templates/Tasks/InstallMod.cs +++ b/Knossos.NET/ViewModels/Templates/Tasks/InstallMod.cs @@ -803,7 +803,7 @@ Task cancel forced due to a error await Dispatcher.UIThread.InvokeAsync(async () => { //Messagebox is not thread safe! - await MessageBox.Show(MainWindow.instance!, "An error was ocurred during the download of the mod: " + mod.ToString() + ". Error: " + ex.Message, "Error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "An error was ocurred during the download of the mod: " + mod.ToString() + ". Error: " + ex.Message, "Error", MessageBox.MessageBoxButtons.OK); }); while (TaskViewModel.Instance!.taskQueue.Count > 0 && TaskViewModel.Instance!.taskQueue.Peek() != this) { diff --git a/Knossos.NET/ViewModels/Windows/AddSapiVoicesViewModel.cs b/Knossos.NET/ViewModels/Windows/AddSapiVoicesViewModel.cs index 3832ca61..cf293dc4 100644 --- a/Knossos.NET/ViewModels/Windows/AddSapiVoicesViewModel.cs +++ b/Knossos.NET/ViewModels/Windows/AddSapiVoicesViewModel.cs @@ -70,13 +70,11 @@ internal void CopyKeys() File.Delete(KnUtils.GetKnossosDataFolderPath() + @"\one_core.reg"); File.Delete(KnUtils.GetKnossosDataFolderPath() + @"\one_core_modified.reg"); - if (MainWindow.instance != null) - MessageBox.Show(MainWindow.instance, "Process completed. A backup of the original SAPI keys is saved here: "+KnUtils.GetKnossosDataFolderPath() + @"\sapi_tokens_backup.reg", "Registry keys copy", MessageBox.MessageBoxButtons.OK); + MessageBox.Show(MainWindow.instance, "Process completed. A backup of the original SAPI keys is saved here: "+KnUtils.GetKnossosDataFolderPath() + @"\sapi_tokens_backup.reg", "Registry keys copy", MessageBox.MessageBoxButtons.OK); } catch (Exception ex) { - if(MainWindow.instance != null) - MessageBox.Show(MainWindow.instance,ex.Message.ToString(),"An error has ocurred",MessageBox.MessageBoxButtons.OK); + MessageBox.Show(MainWindow.instance,ex.Message.ToString(),"An error has ocurred",MessageBox.MessageBoxButtons.OK); } } } diff --git a/Knossos.NET/ViewModels/Windows/DevModAdvancedUploadViewModel.cs b/Knossos.NET/ViewModels/Windows/DevModAdvancedUploadViewModel.cs index 4cd8999a..d3381fef 100644 --- a/Knossos.NET/ViewModels/Windows/DevModAdvancedUploadViewModel.cs +++ b/Knossos.NET/ViewModels/Windows/DevModAdvancedUploadViewModel.cs @@ -236,7 +236,7 @@ internal async void UploadMod() { if (String.IsNullOrWhiteSpace(data.CustomHash) || data.CustomHash.Length == 0) { - _ = MessageBox.Show(MainWindow.instance!, "Package: " + data.PackageName + " is not set to upload but it lacks a defined sha256. Operation cancelled.", "Missing hash data", MessageBox.MessageBoxButtons.OK); + _ = MessageBox.Show(MainWindow.instance, "Package: " + data.PackageName + " is not set to upload but it lacks a defined sha256. Operation cancelled.", "Missing hash data", MessageBox.MessageBoxButtons.OK); return; } else @@ -247,7 +247,7 @@ internal async void UploadMod() if(data.packageInNebula == null) { - _ = MessageBox.Show(MainWindow.instance!, "Package: " + data.PackageName + " is not set to upload but it lacks the package data from Nebula. Operation cancelled.", "Missing package data", MessageBox.MessageBoxButtons.OK); + _ = MessageBox.Show(MainWindow.instance, "Package: " + data.PackageName + " is not set to upload but it lacks the package data from Nebula. Operation cancelled.", "Missing package data", MessageBox.MessageBoxButtons.OK); return; } } @@ -262,7 +262,7 @@ internal async void UploadMod() { if(await Nebula.IsFileUploaded(data.CustomHash) == false) { - _ = MessageBox.Show(MainWindow.instance!, "The provided sha256 hash for package: " + data.PackageName + " is not valid or not uploaded to Nebula, operation cancelled. Passed hash:" + data.CustomHash, "File hash is not uploaded to nebula (or it is incorrect)", MessageBox.MessageBoxButtons.OK); + _ = MessageBox.Show(MainWindow.instance, "The provided sha256 hash for package: " + data.PackageName + " is not valid or not uploaded to Nebula, operation cancelled. Passed hash:" + data.CustomHash, "File hash is not uploaded to nebula (or it is incorrect)", MessageBox.MessageBoxButtons.OK); Log.Add(Log.LogSeverity.Error,"DevModAdvancedUploadViewModel.UploadMod", "The provided sha256 hash for package: " + data.PackageName + " is not valid or not uploaded to Nebula, operation cancelled. Passed hash:"+data.CustomHash); return; } diff --git a/Knossos.NET/ViewModels/Windows/Fs2InstallerViewModel.cs b/Knossos.NET/ViewModels/Windows/Fs2InstallerViewModel.cs index 2e019d6d..8d3227d0 100644 --- a/Knossos.NET/ViewModels/Windows/Fs2InstallerViewModel.cs +++ b/Knossos.NET/ViewModels/Windows/Fs2InstallerViewModel.cs @@ -82,7 +82,7 @@ internal async void InstallFS2Command() { if(Knossos.GetKnossosLibraryPath() == null) { - await MessageBox.Show(MainWindow.instance!, "The KnossosNET library path is not set, first set the library path in the settings tab before installing FS2 Retail.", "Library path is null", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "The KnossosNET library path is not set, first set the library path in the settings tab before installing FS2 Retail.", "Library path is null", MessageBox.MessageBoxButtons.OK); return; } @@ -174,7 +174,7 @@ ProccessFolder need to be pointed to the folder with all the vps and the datas f if (!filePaths.Any()) { - await MessageBox.Show(MainWindow.instance!, "Filepaths list is empty, something happened, if you are reading a gog exe it may be because its internal folder structure is different than the expected.", "Error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Filepaths list is empty, something happened, if you are reading a gog exe it may be because its internal folder structure is different than the expected.", "Error", MessageBox.MessageBoxButtons.OK); if (gogExe != null) { try @@ -468,7 +468,7 @@ internal async void LoadGoGExeCommand() { //Missing files gogExe = null; - await MessageBox.Show(MainWindow.instance!, "Unable to find all the required Freespace 2 files in gog exe.", "Files not found", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Unable to find all the required Freespace 2 files in gog exe.", "Files not found", MessageBox.MessageBoxButtons.OK); return; } ProgressMax = innoOutput.Split('\n').Length-2; @@ -544,7 +544,7 @@ private async void ProcessFolder(IStorageFolder? path, bool topLevel = true) if (reqFilesFound < 9) { //Missing files - await MessageBox.Show(MainWindow.instance!, "Unable to find all the required Freespace 2 files in this directory.", "Files not found", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Unable to find all the required Freespace 2 files in this directory.", "Files not found", MessageBox.MessageBoxButtons.OK); return; } CanInstall = true; diff --git a/Knossos.NET/ViewModels/Windows/ModDetailsViewModel.cs b/Knossos.NET/ViewModels/Windows/ModDetailsViewModel.cs index d10e16de..24acb447 100644 --- a/Knossos.NET/ViewModels/Windows/ModDetailsViewModel.cs +++ b/Knossos.NET/ViewModels/Windows/ModDetailsViewModel.cs @@ -534,7 +534,7 @@ internal async void ButtonCommandDelete() { if (modVersions.Count > 1) { - var resp = await MessageBox.Show(MainWindow.instance!, "You are about to delete version " + modVersions[ItemSelectedIndex].version + " of this mod, this will remove this version only. Do you want to continue?", "Delete mod version", MessageBox.MessageBoxButtons.YesNo); + var resp = await MessageBox.Show(MainWindow.instance, "You are about to delete version " + modVersions[ItemSelectedIndex].version + " of this mod, this will remove this version only. Do you want to continue?", "Delete mod version", MessageBox.MessageBoxButtons.YesNo); if (resp == MessageBox.MessageBoxResult.Yes) { var delete = modVersions[ItemSelectedIndex]; @@ -548,7 +548,7 @@ internal async void ButtonCommandDelete() } else { - var resp = await MessageBox.Show(MainWindow.instance!, "You are about to delete the last installed version of this mod. Do you want to continue?", "Delete mod version", MessageBox.MessageBoxButtons.YesNo); + var resp = await MessageBox.Show(MainWindow.instance, "You are about to delete the last installed version of this mod. Do you want to continue?", "Delete mod version", MessageBox.MessageBoxButtons.YesNo); if (resp == MessageBox.MessageBoxResult.Yes) { //Last version @@ -574,12 +574,12 @@ internal async void ButtonCommandDelete() } else { - await MessageBox.Show(MainWindow.instance!, "You can not delete a mod while other install tasks are running, wait until they finish and try again.", "Tasks are running", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "You can not delete a mod while other install tasks are running, wait until they finish and try again.", "Tasks are running", MessageBox.MessageBoxButtons.OK); } } else { - await MessageBox.Show(MainWindow.instance!, "Dev mode mods can not be delated from the main view, go to the Development section.", "Mod is dev mode", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Dev mode mods can not be delated from the main view, go to the Development section.", "Mod is dev mode", MessageBox.MessageBoxButtons.OK); } } @@ -596,12 +596,12 @@ internal async void ButtonCommandReport() { if (!Nebula.userIsLoggedIn) { - await MessageBox.Show(MainWindow.instance!, "You need to be logged to Nebula (in the Develop tab) to upload a report.", "Nebula loggin needed", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "You need to be logged to Nebula (in the Develop tab) to upload a report.", "Nebula loggin needed", MessageBox.MessageBoxButtons.OK); return; } var dialog = new ReportModView(); dialog.DataContext = new ReportModViewModel(modVersions[ItemSelectedIndex], dialog); - await dialog.ShowDialog(MainWindow.instance!); + await dialog.ShowDialog(MainWindow.instance); } } } diff --git a/Knossos.NET/ViewModels/Windows/ModInstallViewModel.cs b/Knossos.NET/ViewModels/Windows/ModInstallViewModel.cs index caf508f8..cfd1df39 100644 --- a/Knossos.NET/ViewModels/Windows/ModInstallViewModel.cs +++ b/Knossos.NET/ViewModels/Windows/ModInstallViewModel.cs @@ -143,7 +143,7 @@ private async void InitialLoad(string id, string? preSelectedVersion = null) else { Log.Add(Log.LogSeverity.Warning, "ModInstallViewModel.InitialLoad()", "Unable to find this mod id: "+ id +" on repo.json"); - await MessageBox.Show(MainWindow.instance!,"Unable to find this mod ID on nebula repo, maybe the mod was removed from nebula.","Unable to find mod on repo",MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance,"Unable to find this mod ID on nebula repo, maybe the mod was removed from nebula.","Unable to find mod on repo",MessageBox.MessageBoxButtons.OK); } } @@ -562,10 +562,10 @@ internal void VerifyCommand() SelectedMod.modSettings.Load(SelectedMod.fullPath); if (SelectedMod.modSettings.isCompressed) { - MessageBox.Show(MainWindow.instance!, "This mod is compressed, mod verify is not available for compressed mods, uncompress it and try again.", "Verify error", MessageBox.MessageBoxButtons.OK); + MessageBox.Show(MainWindow.instance, "This mod is compressed, mod verify is not available for compressed mods, uncompress it and try again.", "Verify error", MessageBox.MessageBoxButtons.OK); return; } - MessageBox.Show(MainWindow.instance!, "The verify process has started.", "Verify", MessageBox.MessageBoxButtons.OK); + MessageBox.Show(MainWindow.instance, "The verify process has started.", "Verify", MessageBox.MessageBoxButtons.OK); TaskViewModel.Instance!.VerifyMod(SelectedMod); } } diff --git a/Knossos.NET/ViewModels/Windows/ModSettingsViewModel.cs b/Knossos.NET/ViewModels/Windows/ModSettingsViewModel.cs index ffb2a81f..b168d72f 100644 --- a/Knossos.NET/ViewModels/Windows/ModSettingsViewModel.cs +++ b/Knossos.NET/ViewModels/Windows/ModSettingsViewModel.cs @@ -420,7 +420,7 @@ private async Task ConfigureBuild(bool ignoreUserSettings) { await Dispatcher.UIThread.InvokeAsync(async () => { - await MessageBox.Show(MainWindow.instance!, "Unable to get flag data from build " + fsoBuild + " It might be below the minimal version supported (3.8.1) or some other error ocurred.", "Invalid flag data", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Unable to get flag data from build " + fsoBuild + " It might be below the minimal version supported (3.8.1) or some other error ocurred.", "Invalid flag data", MessageBox.MessageBoxButtons.OK); }); } @@ -430,7 +430,7 @@ await Dispatcher.UIThread.InvokeAsync(async () => /* No valid build found, send message */ await Dispatcher.UIThread.InvokeAsync(async () => { - await MessageBox.Show(MainWindow.instance!, "Unable to resolve FSO build dependency, download the correct one or manually select a FSO version. ", "Not engine build found", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Unable to resolve FSO build dependency, download the correct one or manually select a FSO version. ", "Not engine build found", MessageBox.MessageBoxButtons.OK); }); } } @@ -491,7 +491,7 @@ internal async void CompressCommand() { await Dispatcher.UIThread.InvokeAsync(async () => { - var result = await MessageBox.Show(MainWindow.instance!, "This mod is in devmode, do not compress a mod that have not been uploaded to nebula yet! This increases upload size and disk space on nebula. It is ok if you compress old versions that are already uploaded.", "Mod is in devmode", MessageBox.MessageBoxButtons.ContinueCancel); + var result = await MessageBox.Show(MainWindow.instance, "This mod is in devmode, do not compress a mod that have not been uploaded to nebula yet! This increases upload size and disk space on nebula. It is ok if you compress old versions that are already uploaded.", "Mod is in devmode", MessageBox.MessageBoxButtons.ContinueCancel); if (result != MessageBox.MessageBoxResult.Continue) cancel = true; }); @@ -519,7 +519,7 @@ await Dispatcher.UIThread.InvokeAsync(async () => { await Dispatcher.UIThread.InvokeAsync(async () => { - var result = await MessageBox.Show(MainWindow.instance!, "This mod currently resolves to FSO build: "+fsoBuild.version+" the minimum to fully support all features is: "+VPCompression.MinimumFSOVersion + ".\n 23.0.0 may work if the mod do not have loose files, older versions are not going to work.", "FSO Version below minimum", MessageBox.MessageBoxButtons.ContinueCancel); + var result = await MessageBox.Show(MainWindow.instance, "This mod currently resolves to FSO build: "+fsoBuild.version+" the minimum to fully support all features is: "+VPCompression.MinimumFSOVersion + ".\n 23.0.0 may work if the mod do not have loose files, older versions are not going to work.", "FSO Version below minimum", MessageBox.MessageBoxButtons.ContinueCancel); if (result != MessageBox.MessageBoxResult.Continue) cancel = true; }); diff --git a/Knossos.NET/ViewModels/Windows/ReportModViewModel.cs b/Knossos.NET/ViewModels/Windows/ReportModViewModel.cs index 26da4073..4f7f0614 100644 --- a/Knossos.NET/ViewModels/Windows/ReportModViewModel.cs +++ b/Knossos.NET/ViewModels/Windows/ReportModViewModel.cs @@ -47,7 +47,7 @@ internal async void Submit() var reply = await Nebula.ReportMod(mod, ReasonString); if(reply) { - await MessageBox.Show(MainWindow.instance!, "Your report has been submitted to fsnebula, we will act as soon as possible.", "Mod Report OK", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Your report has been submitted to fsnebula, we will act as soon as possible.", "Mod Report OK", MessageBox.MessageBoxButtons.OK); if(dialog != null) { dialog.Close(); @@ -55,12 +55,12 @@ internal async void Submit() } else { - await MessageBox.Show(MainWindow.instance!, "An error has ocurred while reporting a mod.", "Mod Report Error", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "An error has ocurred while reporting a mod.", "Mod Report Error", MessageBox.MessageBoxButtons.OK); } } else { - await MessageBox.Show(MainWindow.instance!, "Please provide a reason for your report.", "Reason is empty", MessageBox.MessageBoxButtons.OK); + await MessageBox.Show(MainWindow.instance, "Please provide a reason for your report.", "Reason is empty", MessageBox.MessageBoxButtons.OK); } } diff --git a/Knossos.NET/ViewModels/Windows/ServerCreatorViewModel.cs b/Knossos.NET/ViewModels/Windows/ServerCreatorViewModel.cs index ab899980..a39f6d84 100644 --- a/Knossos.NET/ViewModels/Windows/ServerCreatorViewModel.cs +++ b/Knossos.NET/ViewModels/Windows/ServerCreatorViewModel.cs @@ -213,12 +213,9 @@ internal void LaunchServer() /// internal async void OpenModSettings() { - if (MainWindow.instance != null) - { - var dialog = new ModSettingsView(); - dialog.DataContext = new ModSettingsViewModel(ListOfMods[ModIndex]); - await dialog.ShowDialog(MainWindow.instance); - } + var dialog = new ModSettingsView(); + dialog.DataContext = new ModSettingsViewModel(ListOfMods[ModIndex]); + await dialog.ShowDialog(MainWindow.instance); } } }