mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-18 00:21:33 -07:00
handle clipboard copying exceptions
This commit is contained in:
parent
e8d311445c
commit
845b5b7074
9
Bloxstrap/Resources/Strings.Designer.cs
generated
9
Bloxstrap/Resources/Strings.Designer.cs
generated
@ -87,6 +87,15 @@ namespace Bloxstrap.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Failed to copy to the clipboard: {0}.
|
||||||
|
/// </summary>
|
||||||
|
public static string Bootstrapper_ClipboardCopyFailed {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Bootstrapper.ClipboardCopyFailed", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Roblox is currently running, and launching another instance will close it. Are you sure you want to continue launching?.
|
/// Looks up a localized string similar to Roblox is currently running, and launching another instance will close it. Are you sure you want to continue launching?.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -126,6 +126,9 @@
|
|||||||
<data name="Bootstrapper.AutoUpdateFailed" xml:space="preserve">
|
<data name="Bootstrapper.AutoUpdateFailed" xml:space="preserve">
|
||||||
<value>Bloxstrap was unable to auto-update to {0}. Please update it manually by downloading and running the latest release from the GitHub page.</value>
|
<value>Bloxstrap was unable to auto-update to {0}. Please update it manually by downloading and running the latest release from the GitHub page.</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Bootstrapper.ClipboardCopyFailed" xml:space="preserve">
|
||||||
|
<value>Failed to copy to the clipboard: {0}</value>
|
||||||
|
</data>
|
||||||
<data name="Bootstrapper.ConfirmLaunch" xml:space="preserve">
|
<data name="Bootstrapper.ConfirmLaunch" xml:space="preserve">
|
||||||
<value>Roblox is currently running, and launching another instance will close it. Are you sure you want to continue launching?</value>
|
<value>Roblox is currently running, and launching another instance will close it. Are you sure you want to continue launching?</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Media;
|
using System.Media;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
@ -30,9 +31,20 @@ namespace Bloxstrap.UI.Elements.Dialogs
|
|||||||
LocateLogFileButton.Click += delegate
|
LocateLogFileButton.Click += delegate
|
||||||
{
|
{
|
||||||
if (App.Logger.Initialized)
|
if (App.Logger.Initialized)
|
||||||
|
{
|
||||||
Process.Start("explorer.exe", $"/select,\"{App.Logger.FileLocation}\"");
|
Process.Start("explorer.exe", $"/select,\"{App.Logger.FileLocation}\"");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
Clipboard.SetDataObject(String.Join("\r\n", App.Logger.Backlog));
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Clipboard.SetText(String.Join("\r\n", App.Logger.Backlog));
|
||||||
|
}
|
||||||
|
catch (COMException ex)
|
||||||
|
{
|
||||||
|
Frontend.ShowMessageBox(string.Format(Bloxstrap.Resources.Strings.Bootstrapper_ClipboardCopyFailed, ex.Message), MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ReportOptions.DropDownClosed += (sender, e) =>
|
ReportOptions.DropDownClosed += (sender, e) =>
|
||||||
|
@ -6,6 +6,7 @@ using System.Collections.ObjectModel;
|
|||||||
using Wpf.Ui.Mvvm.Contracts;
|
using Wpf.Ui.Mvvm.Contracts;
|
||||||
|
|
||||||
using Bloxstrap.UI.Elements.Dialogs;
|
using Bloxstrap.UI.Elements.Dialogs;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Bloxstrap.UI.Elements.Menu.Pages
|
namespace Bloxstrap.UI.Elements.Menu.Pages
|
||||||
{
|
{
|
||||||
@ -341,8 +342,22 @@ namespace Bloxstrap.UI.Elements.Menu.Pages
|
|||||||
|
|
||||||
private void ExportJSONButton_Click(object sender, RoutedEventArgs e)
|
private void ExportJSONButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
const string LOG_IDENT = "FastFlagEditorPage::ExportJSONButton_Click";
|
||||||
|
|
||||||
string json = JsonSerializer.Serialize(App.FastFlags.Prop, new JsonSerializerOptions { WriteIndented = true });
|
string json = JsonSerializer.Serialize(App.FastFlags.Prop, new JsonSerializerOptions { WriteIndented = true });
|
||||||
Clipboard.SetText(json);
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Clipboard.SetText(json);
|
||||||
|
}
|
||||||
|
catch (COMException ex)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Failed to copy to the clipboard");
|
||||||
|
App.Logger.WriteException(LOG_IDENT, ex);
|
||||||
|
Frontend.ShowMessageBox(string.Format(Bloxstrap.Resources.Strings.Bootstrapper_ClipboardCopyFailed, ex.Message), MessageBoxImage.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Frontend.ShowMessageBox(Bloxstrap.Resources.Strings.Menu_FastFlagEditor_JsonCopiedToClipboard, MessageBoxImage.Information);
|
Frontend.ShowMessageBox(Bloxstrap.Resources.Strings.Menu_FastFlagEditor_JsonCopiedToClipboard, MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user