From 1e63e82f8d1f547d9aea56fb09477b55cf091147 Mon Sep 17 00:00:00 2001 From: praydog Date: Fri, 22 Dec 2023 16:10:22 -0800 Subject: [PATCH] Custom VDWarnDialog + ignore future warnings option --- UnrealVR/MainWindow.xaml.cs | 14 ++++++++++++-- UnrealVR/MainWindowSettings.cs | 7 +++++++ UnrealVR/VDWarnDialog.xaml | 25 +++++++++++++++++++++++++ UnrealVR/VDWarnDialog.xaml.cs | 28 ++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 UnrealVR/VDWarnDialog.xaml create mode 100644 UnrealVR/VDWarnDialog.xaml.cs diff --git a/UnrealVR/MainWindow.xaml.cs b/UnrealVR/MainWindow.xaml.cs index 23c839e..256ee3e 100644 --- a/UnrealVR/MainWindow.xaml.cs +++ b/UnrealVR/MainWindow.xaml.cs @@ -171,6 +171,7 @@ public partial class MainWindow : Window { private ExecutableFilter m_executableFilter = new ExecutableFilter(); private string? m_commandLineAttachExe = null; + private bool m_ignoreFutureVDWarnings = false; public MainWindow() { InitializeComponent(); @@ -202,6 +203,7 @@ private void MainWindow_Loaded(object sender, RoutedEventArgs e) { m_openvrRadio.IsChecked = m_mainWindowSettings.OpenVRRadio; m_openxrRadio.IsChecked = m_mainWindowSettings.OpenXRRadio; m_nullifyVRPluginsCheckbox.IsChecked = m_mainWindowSettings.NullifyVRPluginsCheckbox; + m_ignoreFutureVDWarnings = m_mainWindowSettings.IgnoreFutureVDWarnings; m_updateTimer.Tick += (sender, e) => Dispatcher.Invoke(MainWindow_Update); m_updateTimer.Start(); @@ -508,13 +510,20 @@ private void ImportConfig_Clicked(object sender, RoutedEventArgs e) { private bool m_virtualDesktopWarned = false; private bool m_virtualDesktopChecked = false; private void Check_VirtualDesktop() { - if (m_virtualDesktopWarned) { + if (m_virtualDesktopWarned || m_ignoreFutureVDWarnings) { return; } if (IsExecutableRunning("VirtualDesktop.Streamer")) { m_virtualDesktopWarned = true; - MessageBox.Show("Virtual Desktop has been detected running.\nMake sure you use OpenXR for the least issues.", "VD Warning", MessageBoxButton.OK, MessageBoxImage.Information); + var dialog = new VDWarnDialog(); + dialog.ShowDialog(); + + if (dialog.DialogResultOK) { + if (dialog.HideFutureWarnings) { + m_ignoreFutureVDWarnings = true; + } + } } } @@ -532,6 +541,7 @@ private void MainWindow_Closing(object sender, System.ComponentModel.CancelEvent m_mainWindowSettings.OpenXRRadio = m_openxrRadio.IsChecked == true; m_mainWindowSettings.OpenVRRadio = m_openvrRadio.IsChecked == true; m_mainWindowSettings.NullifyVRPluginsCheckbox = m_nullifyVRPluginsCheckbox.IsChecked == true; + m_mainWindowSettings.IgnoreFutureVDWarnings = m_ignoreFutureVDWarnings; m_mainWindowSettings.Save(); } diff --git a/UnrealVR/MainWindowSettings.cs b/UnrealVR/MainWindowSettings.cs index e72c372..0842a46 100644 --- a/UnrealVR/MainWindowSettings.cs +++ b/UnrealVR/MainWindowSettings.cs @@ -27,5 +27,12 @@ public bool NullifyVRPluginsCheckbox { get { return (bool)this["NullifyVRPluginsCheckbox"]; } set { this["NullifyVRPluginsCheckbox"] = value; } } + + [UserScopedSettingAttribute()] + [DefaultSettingValueAttribute("false")] + public bool IgnoreFutureVDWarnings { + get { return (bool)this["IgnoreFutureVDWarnings"]; } + set { this["IgnoreFutureVDWarnings"] = value; } + } } } diff --git a/UnrealVR/VDWarnDialog.xaml b/UnrealVR/VDWarnDialog.xaml new file mode 100644 index 0000000..4aa7be2 --- /dev/null +++ b/UnrealVR/VDWarnDialog.xaml @@ -0,0 +1,25 @@ + + + + + +