From 5c397a91c8e91633741e91d7956747734c4b7a4f Mon Sep 17 00:00:00 2001 From: Dabble1SC <119721976+Dabble1SC@users.noreply.github.com> Date: Fri, 24 Nov 2023 17:52:47 -0800 Subject: [PATCH 1/7] added 1 radio panel variants (horizontal and vertical) added buttons to the client window BUG: Buttons do not currently work. Still investigating --- DCS-SR-Client/DCS-SR-Client.csproj | 14 + DCS-SR-Client/UI/ClientWindow/MainWindow.xaml | 16 + .../UI/ClientWindow/MainWindow.xaml.cs | 16 + .../RadioOverlayOneHorizontal.xaml | 172 +++++++++ .../RadioOverlayOneHorizontal.xaml.cs | 270 +++++++++++++ .../RadioOverlayOneVertical.xaml | 118 ++++++ .../RadioOverlayOneVertical.xaml.cs | 357 ++++++++++++++++++ 7 files changed, 963 insertions(+) create mode 100644 DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneHorizontal.xaml create mode 100644 DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneHorizontal.xaml.cs create mode 100644 DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneVertical.xaml create mode 100644 DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneVertical.xaml.cs diff --git a/DCS-SR-Client/DCS-SR-Client.csproj b/DCS-SR-Client/DCS-SR-Client.csproj index 434249d9..c00466b7 100644 --- a/DCS-SR-Client/DCS-SR-Client.csproj +++ b/DCS-SR-Client/DCS-SR-Client.csproj @@ -323,6 +323,9 @@ ClientListWindow.xaml + + RadioOverlayOneHorizontal.xaml + RadioOverlayTwoHorizontal.xaml @@ -338,6 +341,9 @@ RadioOverlayThreeVertical.xaml + + RadioOverlayOneVertical.xaml + RadioCapabilities.xaml @@ -404,6 +410,10 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -424,6 +434,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + Designer MSBuild:Compile diff --git a/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml b/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml index 954b6a16..4b726466 100644 --- a/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml +++ b/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml @@ -308,6 +308,14 @@ HorizontalAlignment="Center" Margin="0" Orientation="Horizontal"> + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneHorizontal.xaml.cs b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneHorizontal.xaml.cs new file mode 100644 index 00000000..3a6674a8 --- /dev/null +++ b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneHorizontal.xaml.cs @@ -0,0 +1,270 @@ +using System; +using System.ComponentModel; +using System.Windows; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Threading; +using Ciribob.DCS.SimpleRadio.Standalone.Client.Network; +using Ciribob.DCS.SimpleRadio.Standalone.Client.Settings; +using Ciribob.DCS.SimpleRadio.Standalone.Client.Singletons; +using Ciribob.DCS.SimpleRadio.Standalone.Client.UI.AwacsRadioOverlayWindow; +using Ciribob.DCS.SimpleRadio.Standalone.Common; +using NLog; + +namespace Ciribob.DCS.SimpleRadio.Standalone.Overlay +{ + /// + /// Interaction logic for RadioOverlayWindow.xaml + /// + public partial class RadioOverlayWindowOneHorizontal : Window + { + private readonly double _aspectRatio; + private readonly Logger Logger = LogManager.GetCurrentClassLogger(); + + private readonly RadioControlGroup[] radioControlGroup = new RadioControlGroup[2]; + + private readonly DispatcherTimer _updateTimer; + + private long _lastUnitId; + + private readonly ClientStateSingleton _clientStateSingleton = ClientStateSingleton.Instance; + + private GlobalSettingsStore _globalSettings = GlobalSettingsStore.Instance; + + public RadioOverlayWindowOneHorizontal() + { + InitializeComponent(); + + this.WindowStartupLocation = WindowStartupLocation.Manual; + + _aspectRatio = MinWidth / MinHeight; + + AllowsTransparency = true; + Opacity = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalOpacity).DoubleValue; + windowOpacitySlider.Value = Opacity; + + Left = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalX).DoubleValue; + Top = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalY).DoubleValue; + + Width = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalWidth).DoubleValue; + Height = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalHeight).DoubleValue; + + radioControlGroup[0] = radio1; + + + //allows click and drag anywhere on the window + containerPanel.MouseLeftButtonDown += WrapPanel_MouseLeftButtonDown; + + CalculateScale(); + + LocationChanged += Location_Changed; + + RadioRefresh(null, null); + + //init radio refresh + _updateTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(80)}; + _updateTimer.Tick += RadioRefresh; + _updateTimer.Start(); + } + + private void Location_Changed(object sender, EventArgs e) + { + // AppConfiguration.Instance.RadioX = Top; + // AppConfiguration.Instance.RadioY = Left; + } + + private void RadioRefresh(object sender, EventArgs eventArgs) + { + var dcsPlayerRadioInfo = _clientStateSingleton.DcsPlayerRadioInfo; + + foreach (var radio in radioControlGroup) + { + radio.RepaintRadioStatus(); + radio.RepaintRadioReceive(); + } + + intercom.RepaintRadioStatus(); + + if ((dcsPlayerRadioInfo != null) && dcsPlayerRadioInfo.IsCurrent()) + { + //reset when we switch planes + if (_lastUnitId != dcsPlayerRadioInfo.unitId) + { + _lastUnitId = dcsPlayerRadioInfo.unitId; + } + + var availableRadios = 0; + + for (var i = 0; i < dcsPlayerRadioInfo.radios.Length; i++) + { + if (dcsPlayerRadioInfo.radios[i].modulation != RadioInformation.Modulation.DISABLED) + { + availableRadios++; + + } + } + + if (availableRadios > 1) + { + if (dcsPlayerRadioInfo.control == DCSPlayerRadioInfo.RadioSwitchControls.HOTAS) + { + ControlText.Text = "2 Horizontal"; + } + else + { + ControlText.Text = "2 Horizontal"; + } + } + else + { + ControlText.Text = "2 Horizontal (Disconnected)"; + + } + } + else + { + ControlText.Text = "2 Horizontal (Disconnected)"; + } + } + + private void WrapPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + DragMove(); + } + + protected override void OnClosing(CancelEventArgs e) + { + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalX, Left); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalY, Top); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalWidth, Width); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalHeight, Height); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalOpacity, Opacity); + + base.OnClosing(e); + + _updateTimer.Stop(); + } + + private void Button_Minimise(object sender, RoutedEventArgs e) + { + // Minimising a window without a taskbar icon leads to the window's menu bar still showing up in the bottom of screen + // Since controls are unusable, but a very small portion of the always-on-top window still showing, we're closing it instead, similar to toggling the overlay + if (_globalSettings.GetClientSettingBool(GlobalSettingsKeys.RadioOverlayTaskbarHide)) + { + Close(); + } + else + { + WindowState = WindowState.Minimized; + } + } + + + private void Button_Close(object sender, RoutedEventArgs e) + { + Close(); + } + + private void windowOpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + Opacity = e.NewValue; + //AppConfiguration.Instance.RadioOpacity = Opacity; + } + + private void containerPanel_SizeChanged(object sender, SizeChangedEventArgs e) + { + //force aspect ratio + CalculateScale(); + + WindowState = WindowState.Normal; + } + +// +// + private void CalculateScale() + { + var yScale = ActualHeight / RadioOverlayWin.MinHeight; + var xScale = ActualWidth / RadioOverlayWin.MinWidth; + var value = Math.Max(xScale, yScale); + ScaleValue = (double) OnCoerceScaleValue(RadioOverlayWin, value); + } + + protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) + { + if (sizeInfo.WidthChanged) + Width = sizeInfo.NewSize.Height * _aspectRatio; + else + Height = sizeInfo.NewSize.Width / _aspectRatio; + + // AppConfiguration.Instance.RadioWidth = Width; + // AppConfiguration.Instance.RadioHeight = Height; + // Console.WriteLine(this.Height +" width:"+ this.Width); + } + + #region ScaleValue Depdency Property //StackOverflow: http://stackoverflow.com/questions/3193339/tips-on-developing-resolution-independent-application/5000120#5000120 + + public static readonly DependencyProperty ScaleValueProperty = DependencyProperty.Register("ScaleValue", + typeof(double), typeof(RadioOverlayWindowOneHorizontal), + new UIPropertyMetadata(1.0, OnScaleValueChanged, + OnCoerceScaleValue)); + + + private static object OnCoerceScaleValue(DependencyObject o, object value) + { + var mainWindow = o as RadioOverlayWindowOneHorizontal; + if (mainWindow != null) + return mainWindow.OnCoerceScaleValue((double) value); + return value; + } + + private static void OnScaleValueChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) + { + var mainWindow = o as RadioOverlayWindowOneHorizontal; + if (mainWindow != null) + mainWindow.OnScaleValueChanged((double) e.OldValue, (double) e.NewValue); + } + + protected virtual double OnCoerceScaleValue(double value) + { + if (double.IsNaN(value)) + return 1.0f; + + value = Math.Max(0.1, value); + return value; + } + + protected virtual void OnScaleValueChanged(double oldValue, double newValue) + { + } + + public double ScaleValue + { + get { return (double) GetValue(ScaleValueProperty); } + set { SetValue(ScaleValueProperty, value); } + } + + #endregion + + private void ToggleGlobalSimultaneousTransmissionButton_Click(object sender, RoutedEventArgs e) + { + var dcsPlayerRadioInfo = _clientStateSingleton.DcsPlayerRadioInfo; + if (dcsPlayerRadioInfo != null) + { + dcsPlayerRadioInfo.simultaneousTransmission = !dcsPlayerRadioInfo.simultaneousTransmission; + + if (!dcsPlayerRadioInfo.simultaneousTransmission) + { + foreach (var radio in dcsPlayerRadioInfo.radios) + { + radio.simul = false; + } + } + + foreach (var radio in radioControlGroup) + { + radio.RepaintRadioStatus(); + } + } + } + } +} \ No newline at end of file diff --git a/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneVertical.xaml b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneVertical.xaml new file mode 100644 index 00000000..d5e1baaa --- /dev/null +++ b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneVertical.xaml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneVertical.xaml.cs b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneVertical.xaml.cs new file mode 100644 index 00000000..7004b110 --- /dev/null +++ b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneVertical.xaml.cs @@ -0,0 +1,357 @@ +using System; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Windows; +using System.Windows.Input; +using System.Windows.Interop; +using System.Windows.Threading; +using Ciribob.DCS.SimpleRadio.Standalone.Client; +using Ciribob.DCS.SimpleRadio.Standalone.Client.Network; +using Ciribob.DCS.SimpleRadio.Standalone.Client.Settings; +using Ciribob.DCS.SimpleRadio.Standalone.Client.Singletons; +using Ciribob.DCS.SimpleRadio.Standalone.Client.UI; +using Ciribob.DCS.SimpleRadio.Standalone.Client.UI.RadioOverlayWindow; +using NLog; +using Ciribob.DCS.SimpleRadio.Standalone.Common; +using System.Windows.Forms; +using Ciribob.DCS.SimpleRadio.Standalone.Client.UI.AwacsRadioOverlayWindow; +using MessageBox = System.Windows.Forms.MessageBox; + +namespace Ciribob.DCS.SimpleRadio.Standalone.Overlay +{ + /// + /// Interaction logic for RadioOverlayWindow.xaml + /// + public partial class RadioOverlayWindowOneVertical : Window + { + private double _aspectRatio; + private readonly Logger Logger = LogManager.GetCurrentClassLogger(); + + private readonly Client.UI.AwacsRadioOverlayWindow.RadioControlGroup[] radioControlGroup = + new Client.UI.AwacsRadioOverlayWindow.RadioControlGroup[2]; + + private readonly DispatcherTimer _updateTimer; + + private readonly ClientStateSingleton _clientStateSingleton = ClientStateSingleton.Instance; + + private readonly GlobalSettingsStore _globalSettings = GlobalSettingsStore.Instance; + + private readonly double _originalMinHeight; + + private readonly double _radioHeight; + + private long _lastUnitId; + + + public RadioOverlayWindowOneVertical() + { + //load opacity before the intialising as the slider changed + //method fires after initialisation + InitializeComponent(); + + this.WindowStartupLocation = WindowStartupLocation.Manual; + + _aspectRatio = MinWidth / MinHeight; + + _originalMinHeight = MinHeight; + _radioHeight = Radio1.Height; + WindowInteropHelper windowInteropHelper = new WindowInteropHelper(MainWindow.GetWindow(this)); + Screen screen = System.Windows.Forms.Screen.FromHandle(windowInteropHelper.Handle); + MaxHeight = screen.Bounds.Height; + + AllowsTransparency = true; + Opacity = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalOpacity).DoubleValue; + WindowOpacitySlider.Value = Opacity; + + radioControlGroup[0] = Radio1; + + + //allows click and drag anywhere on the window + ContainerPanel.MouseLeftButtonDown += WrapPanel_MouseLeftButtonDown; + + Left = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalX).DoubleValue; + Top = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalY).DoubleValue; + + Width = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalWidth).DoubleValue; + Height = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalHeight).DoubleValue; + + // Window_Loaded(null, null); + CalculateScale(); + + LocationChanged += Location_Changed; + + RadioRefresh(null, null); + + //init radio refresh + _updateTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(80)}; + _updateTimer.Tick += RadioRefresh; + _updateTimer.Start(); + } + + private void Location_Changed(object sender, EventArgs e) + { + } + + private void RadioRefresh(object sender, EventArgs eventArgs) + { + var dcsPlayerRadioInfo = _clientStateSingleton.DcsPlayerRadioInfo; + + foreach (var radio in radioControlGroup) + { + radio.RepaintRadioStatus(); + radio.RepaintRadioReceive(); + } + + Intercom.RepaintRadioStatus(); + + if ((dcsPlayerRadioInfo != null) && dcsPlayerRadioInfo.IsCurrent()) + { + //reset when we switch planes + if (_lastUnitId != dcsPlayerRadioInfo.unitId) + { + _lastUnitId = dcsPlayerRadioInfo.unitId; + ResetHeight(); + } + + var availableRadios = 0; + + for (var i = 0; i < dcsPlayerRadioInfo.radios.Length; i++) + { + if (dcsPlayerRadioInfo.radios[i].modulation != RadioInformation.Modulation.DISABLED) + { + availableRadios++; + + } + } + + if (availableRadios == 2 + || dcsPlayerRadioInfo.radios.Length >= 2 + && dcsPlayerRadioInfo.radios[1].modulation != RadioInformation.Modulation.DISABLED) + { + if (MinHeight != _originalMinHeight) + { + MinHeight = _originalMinHeight; + Recalculate(); + } + } + else + { + ResetHeight(); + } + + + if (availableRadios > 1) + { + if (dcsPlayerRadioInfo.control == DCSPlayerRadioInfo.RadioSwitchControls.HOTAS) + { + ControlText.Text = "2 Vertical"; + } + else + { + ControlText.Text = "2 Vertical"; + } + } + else + { + ControlText.Text = "2 Vertical (Disconnected)"; + + } + } + else + { + ResetHeight(); + ControlText.Text = "2 Vertical (Disconnected)"; + } + + FocusDCS(); + } + + private void ResetHeight() + { + + if (MinHeight != _originalMinHeight) + { + MinHeight = _originalMinHeight; + Recalculate(); + } + } + + private void Recalculate() + { + _aspectRatio = MinWidth / MinHeight; + containerPanel_SizeChanged(null, null); + Height = Height+1; + } + + private long _lastFocus; + private RadioCapabilities _radioCapabilitiesWindow; + + private void FocusDCS() + { + if (_globalSettings.GetClientSettingBool(GlobalSettingsKeys.RefocusDCS)) + { + var overlayWindow = new WindowInteropHelper(this).Handle; + + //focus DCS if needed + var foreGround = WindowHelper.GetForegroundWindow(); + + Process[] localByName = Process.GetProcessesByName("dcs"); + + if (localByName != null && localByName.Length > 0) + { + //either DCS is in focus OR Overlay window is not in focus + if (foreGround == localByName[0].MainWindowHandle || overlayWindow != foreGround || + this.IsMouseOver) + { + _lastFocus = DateTime.Now.Ticks; + } + else if (DateTime.Now.Ticks > _lastFocus + 20000000 && overlayWindow == foreGround) + { + WindowHelper.BringProcessToFront(localByName[0]); + } + } + } + } + + private void WrapPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + DragMove(); + } + + protected override void OnClosing(CancelEventArgs e) + { + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalWidth, Width); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalHeight,Height); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalOpacity,Opacity); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalX,Left); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalY, Top); + base.OnClosing(e); + + _updateTimer.Stop(); + } + + private void Button_Minimise(object sender, RoutedEventArgs e) + { + // Minimising a window without a taskbar icon leads to the window's menu bar still showing up in the bottom of screen + // Since controls are unusable, but a very small portion of the always-on-top window still showing, we're closing it instead, similar to toggling the overlay + if (_globalSettings.GetClientSettingBool(GlobalSettingsKeys.RadioOverlayTaskbarHide)) + { + Close(); + } + else + { + WindowState = WindowState.Minimized; + } + } + + private void Button_About(object sender, RoutedEventArgs e) + { + //Show Radio Capabilities + if ((_radioCapabilitiesWindow == null) || !_radioCapabilitiesWindow.IsVisible || + (_radioCapabilitiesWindow.WindowState == WindowState.Minimized)) + { + _radioCapabilitiesWindow?.Close(); + + _radioCapabilitiesWindow = new RadioCapabilities(); + _radioCapabilitiesWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; + _radioCapabilitiesWindow.Owner = this; + _radioCapabilitiesWindow.ShowDialog(); + } + else + { + _radioCapabilitiesWindow?.Close(); + _radioCapabilitiesWindow = null; + } + + } + + + private void Button_Close(object sender, RoutedEventArgs e) + { + Close(); + } + + private void windowOpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + Opacity = e.NewValue; + } + + private void containerPanel_SizeChanged(object sender, SizeChangedEventArgs e) + { + //force aspect ratio + CalculateScale(); + + WindowState = WindowState.Normal; + } + + + private void CalculateScale() + { + var yScale = ActualHeight / RadioOverlayWin.MinHeight; + var xScale = ActualWidth / RadioOverlayWin.MinWidth; + var value = Math.Min(xScale, yScale); + ScaleValue = (double) OnCoerceScaleValue(RadioOverlayWin, value); + } + + protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) + { + if (sizeInfo.WidthChanged) + Width = sizeInfo.NewSize.Height * _aspectRatio; + else + Height = sizeInfo.NewSize.Width / _aspectRatio; + + + // Console.WriteLine(this.Height +" width:"+ this.Width); + } + + #region ScaleValue Depdency Property //StackOverflow: http://stackoverflow.com/questions/3193339/tips-on-developing-resolution-independent-application/5000120#5000120 + + public static readonly DependencyProperty ScaleValueProperty = DependencyProperty.Register("ScaleValue", + typeof(double), typeof(RadioOverlayWindowOneVertical), + new UIPropertyMetadata(1.0, OnScaleValueChanged, + OnCoerceScaleValue)); + + private static object OnCoerceScaleValue(DependencyObject o, object value) + { + var mainWindow = o as RadioOverlayWindowOneVertical; + if (mainWindow != null) + return mainWindow.OnCoerceScaleValue((double) value); + return value; + } + + private static void OnScaleValueChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) + { + var mainWindow = o as RadioOverlayWindowOneVertical; + if (mainWindow != null) + mainWindow.OnScaleValueChanged((double) e.OldValue, (double) e.NewValue); + } + + protected virtual double OnCoerceScaleValue(double value) + { + if (double.IsNaN(value)) + return 1.0f; + + value = Math.Max(0.1, value); + return value; + } + + protected virtual void OnScaleValueChanged(double oldValue, double newValue) + { + } + + public double ScaleValue + { + get { return (double) GetValue(ScaleValueProperty); } + set { SetValue(ScaleValueProperty, value); } + } + + #endregion + + private void RadioOverlayWindow_OnLocationChanged(object sender, EventArgs e) + { + //reset last focus so we dont switch back to dcs while dragging + _lastFocus = DateTime.Now.Ticks; + } + } +} \ No newline at end of file From eeaba6292e443461d7e5274eb1460b3c03099cd7 Mon Sep 17 00:00:00 2001 From: Dabble1SC <119721976+Dabble1SC@users.noreply.github.com> Date: Sat, 25 Nov 2023 02:25:38 -0800 Subject: [PATCH 2/7] Added ultrawide radio panels variants for 10 radios - Adjusted MainWindow GUI for clarity - Added MainWindow buttons for additional radio panels - All radio panels seem to work except the 1 horizontal variant. The window simply doesn't open. Not sure why. --- DCS-SR-Client/DCS-SR-Client.csproj | 14 + DCS-SR-Client/Settings/GlobalSettingsStore.cs | 33 +- DCS-SR-Client/UI/ClientWindow/MainWindow.xaml | 754 ++++++++++-------- .../UI/ClientWindow/MainWindow.xaml.cs | 31 +- .../RadioOverlayOneHorizontal.xaml.cs | 30 +- .../RadioOverlayOneVertical.xaml.cs | 45 +- .../RadioOverlayTenHorizontalWide.xaml | 213 +++++ .../RadioOverlayTenHorizontalWide.xaml.cs | 262 ++++++ .../RadioOverlayTenVerticalLong.xaml | 201 +++++ .../RadioOverlayTenVerticalLong.xaml.cs | 254 ++++++ 10 files changed, 1444 insertions(+), 393 deletions(-) create mode 100644 DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenHorizontalWide.xaml create mode 100644 DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenHorizontalWide.xaml.cs create mode 100644 DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenVerticalLong.xaml create mode 100644 DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenVerticalLong.xaml.cs diff --git a/DCS-SR-Client/DCS-SR-Client.csproj b/DCS-SR-Client/DCS-SR-Client.csproj index c00466b7..4b1dee2e 100644 --- a/DCS-SR-Client/DCS-SR-Client.csproj +++ b/DCS-SR-Client/DCS-SR-Client.csproj @@ -326,6 +326,12 @@ RadioOverlayOneHorizontal.xaml + + RadioOverlayTenHorizontalWide.xaml + + + RadioOverlayTenVerticalLong.xaml + RadioOverlayTwoHorizontal.xaml @@ -414,6 +420,14 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + MSBuild:Compile Designer diff --git a/DCS-SR-Client/Settings/GlobalSettingsStore.cs b/DCS-SR-Client/Settings/GlobalSettingsStore.cs index b298483e..fc86ba3e 100644 --- a/DCS-SR-Client/Settings/GlobalSettingsStore.cs +++ b/DCS-SR-Client/Settings/GlobalSettingsStore.cs @@ -31,6 +31,14 @@ public enum GlobalSettingsKeys #region Radio panel settings + // Radio 1V + RadioOneVerticalX, + RadioOneVerticalY, + RadioOneVerticalSize, + RadioOneVerticalOpacity, + RadioOneVerticalWidth, + RadioOneVerticalHeight, + // Radio 2V RadioTwoVerticalX, RadioTwoVerticalY, @@ -63,6 +71,21 @@ public enum GlobalSettingsKeys RadioTenVerticalWidth, RadioTenVerticalHeight, + // Radio 10VL + RadioTenLongVerticalX, + RadioTenLongVerticalY, + RadioTenLongVerticalSize, + RadioTenLongVerticalOpacity, + RadioTenLongVerticalWidth, + RadioTenLongVerticalHeight, + + // Radio 1H + RadioOneHorizontalX, + RadioOneHorizontalY, + RadioOneHorizontalSize, + RadioOneHorizontalOpacity, + RadioOneHorizontalWidth, + RadioOneHorizontalHeight, // Radio 2H RadioTwoHorizontalX, @@ -95,7 +118,15 @@ public enum GlobalSettingsKeys RadioTenHorizontalOpacity, RadioTenHorizontalWidth, RadioTenHorizontalHeight, - + + // Radio 10HW + RadioTenWideHorizontalX, + RadioTenWideHorizontalY, + RadioTenWideHorizontalSize, + RadioTenWideHorizontalOpacity, + RadioTenWideHorizontalWidth, + RadioTenWideHorizontalHeight, + // Client Window ClientX, ClientY, diff --git a/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml b/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml index 4b726466..c1af8650 100644 --- a/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml +++ b/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml @@ -1,5 +1,5 @@  - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenHorizontalWide.xaml.cs b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenHorizontalWide.xaml.cs new file mode 100644 index 00000000..67f18ac9 --- /dev/null +++ b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenHorizontalWide.xaml.cs @@ -0,0 +1,262 @@ +using System; +using System.ComponentModel; +using System.Windows; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Threading; +using Ciribob.DCS.SimpleRadio.Standalone.Client.Network; +using Ciribob.DCS.SimpleRadio.Standalone.Client.Settings; +using Ciribob.DCS.SimpleRadio.Standalone.Client.Singletons; +using Ciribob.DCS.SimpleRadio.Standalone.Client.UI.AwacsRadioOverlayWindow; +using Ciribob.DCS.SimpleRadio.Standalone.Common; +using NLog; + +namespace Ciribob.DCS.SimpleRadio.Standalone.Overlay +{ + /// + /// Interaction logic for RadioOverlayWindow.xaml + /// + public partial class RadioOverlayWindowTenHorizontalWide : Window + { + private readonly double _aspectRatio; + private readonly Logger Logger = LogManager.GetCurrentClassLogger(); + + private readonly RadioControlGroup[] radioControlGroup = new RadioControlGroup[10]; + + private readonly DispatcherTimer _updateTimer; + + public static bool AwacsActive = false + ; //when false and we're in spectator mode / not in an aircraft the other 7 radios will be disabled + + private readonly ClientStateSingleton _clientStateSingleton = ClientStateSingleton.Instance; + + private GlobalSettingsStore _globalSettings = GlobalSettingsStore.Instance; + + public RadioOverlayWindowTenHorizontalWide() + { + //load opacity before the intialising as the slider changed + //method fires after initialisation + // var opacity = AppConfiguration.Instance.RadioOpacity; + AwacsActive = true; + + InitializeComponent(); + + this.WindowStartupLocation = WindowStartupLocation.Manual; + + _aspectRatio = MinWidth / MinHeight; + + AllowsTransparency = true; + Opacity = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenHorizontalOpacity).DoubleValue; + windowOpacitySlider.Value = Opacity; + + Left = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenWideHorizontalX).DoubleValue; + Top = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenWideHorizontalY).DoubleValue; + + Width = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenWideHorizontalWidth).DoubleValue; + Height = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenWideHorizontalHeight).DoubleValue; + + radioControlGroup[0] = radio1; + radioControlGroup[1] = radio2; + radioControlGroup[2] = radio3; + radioControlGroup[3] = radio4; + radioControlGroup[4] = radio5; + radioControlGroup[5] = radio6; + radioControlGroup[6] = radio7; + radioControlGroup[7] = radio8; + radioControlGroup[8] = radio9; + radioControlGroup[9] = radio10; + + + //allows click and drag anywhere on the window + containerPanel.MouseLeftButtonDown += WrapPanel_MouseLeftButtonDown; + + CalculateScale(); + + LocationChanged += Location_Changed; + + RadioRefresh(null, null); + + //init radio refresh + _updateTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(80)}; + _updateTimer.Tick += RadioRefresh; + _updateTimer.Start(); + } + + private void Location_Changed(object sender, EventArgs e) + { + // AppConfiguration.Instance.RadioX = Top; + // AppConfiguration.Instance.RadioY = Left; + } + + private void RadioRefresh(object sender, EventArgs eventArgs) + { + foreach (var radio in radioControlGroup) + { + radio.RepaintRadioStatus(); + radio.RepaintRadioReceive(); + } + + intercom.RepaintRadioStatus(); + + var dcsPlayerRadioInfo = _clientStateSingleton.DcsPlayerRadioInfo; + if (dcsPlayerRadioInfo != null) + { + if (_clientStateSingleton.IsConnected && dcsPlayerRadioInfo.IsCurrent() + && _clientStateSingleton.DcsPlayerRadioInfo.simultaneousTransmissionControl == DCSPlayerRadioInfo.SimultaneousTransmissionControl.ENABLED_INTERNAL_SRS_CONTROLS) + { + + var avalilableRadios = 0; + + for (var i = 0; i < dcsPlayerRadioInfo.radios.Length; i++) + { + if (dcsPlayerRadioInfo.radios[i].modulation != RadioInformation.Modulation.DISABLED) + { + avalilableRadios++; + } + } + } + } + } + + private void WrapPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + DragMove(); + } + + protected override void OnClosing(CancelEventArgs e) + { + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenWideHorizontalX, Left); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenWideHorizontalY, Top); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenWideHorizontalWidth, Width); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenWideHorizontalHeight, Height); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenWideHorizontalOpacity, Opacity); + + base.OnClosing(e); + + AwacsActive = false; + _updateTimer.Stop(); + } + + private void Button_Minimise(object sender, RoutedEventArgs e) + { + // Minimising a window without a taskbar icon leads to the window's menu bar still showing up in the bottom of screen + // Since controls are unusable, but a very small portion of the always-on-top window still showing, we're closing it instead, similar to toggling the overlay + if (_globalSettings.GetClientSettingBool(GlobalSettingsKeys.RadioOverlayTaskbarHide)) + { + Close(); + } + else + { + WindowState = WindowState.Minimized; + } + } + + + private void Button_Close(object sender, RoutedEventArgs e) + { + Close(); + } + + private void windowOpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + Opacity = e.NewValue; + //AppConfiguration.Instance.RadioOpacity = Opacity; + } + + private void containerPanel_SizeChanged(object sender, SizeChangedEventArgs e) + { + //force aspect ratio + CalculateScale(); + + WindowState = WindowState.Normal; + } + +// +// + private void CalculateScale() + { + var yScale = ActualHeight / RadioOverlayWin.MinWidth; + var xScale = ActualWidth / RadioOverlayWin.MinWidth; + var value = Math.Max(xScale, yScale); + ScaleValue = (double) OnCoerceScaleValue(RadioOverlayWin, value); + } + + protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) + { + if (sizeInfo.WidthChanged) + Width = sizeInfo.NewSize.Height * _aspectRatio; + else + Height = sizeInfo.NewSize.Width / _aspectRatio; + + // AppConfiguration.Instance.RadioWidth = Width; + // AppConfiguration.Instance.RadioHeight = Height; + // Console.WriteLine(this.Height +" width:"+ this.Width); + } + + #region ScaleValue Depdency Property //StackOverflow: http://stackoverflow.com/questions/3193339/tips-on-developing-resolution-independent-application/5000120#5000120 + + public static readonly DependencyProperty ScaleValueProperty = DependencyProperty.Register("ScaleValue", + typeof(double), typeof(RadioOverlayWindowTenHorizontalWide), + new UIPropertyMetadata(1.0, OnScaleValueChanged, + OnCoerceScaleValue)); + + + private static object OnCoerceScaleValue(DependencyObject o, object value) + { + var mainWindow = o as RadioOverlayWindowTenHorizontalWide; + if (mainWindow != null) + return mainWindow.OnCoerceScaleValue((double) value); + return value; + } + + private static void OnScaleValueChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) + { + var mainWindow = o as RadioOverlayWindowTenHorizontalWide; + if (mainWindow != null) + mainWindow.OnScaleValueChanged((double) e.OldValue, (double) e.NewValue); + } + + protected virtual double OnCoerceScaleValue(double value) + { + if (double.IsNaN(value)) + return 1.0f; + + value = Math.Max(0.1, value); + return value; + } + + protected virtual void OnScaleValueChanged(double oldValue, double newValue) + { + } + + public double ScaleValue + { + get { return (double) GetValue(ScaleValueProperty); } + set { SetValue(ScaleValueProperty, value); } + } + + #endregion + + private void ToggleGlobalSimultaneousTransmissionButton_Click(object sender, RoutedEventArgs e) + { + var dcsPlayerRadioInfo = _clientStateSingleton.DcsPlayerRadioInfo; + if (dcsPlayerRadioInfo != null) + { + dcsPlayerRadioInfo.simultaneousTransmission = !dcsPlayerRadioInfo.simultaneousTransmission; + + if (!dcsPlayerRadioInfo.simultaneousTransmission) + { + foreach (var radio in dcsPlayerRadioInfo.radios) + { + radio.simul = false; + } + } + + foreach (var radio in radioControlGroup) + { + radio.RepaintRadioStatus(); + } + } + } + } +} \ No newline at end of file diff --git a/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenVerticalLong.xaml b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenVerticalLong.xaml new file mode 100644 index 00000000..f874c49d --- /dev/null +++ b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenVerticalLong.xaml @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenVerticalLong.xaml.cs b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenVerticalLong.xaml.cs new file mode 100644 index 00000000..6985dcb6 --- /dev/null +++ b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenVerticalLong.xaml.cs @@ -0,0 +1,254 @@ +using System; +using System.ComponentModel; +using System.Windows; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Threading; +using Ciribob.DCS.SimpleRadio.Standalone.Client.Network; +using Ciribob.DCS.SimpleRadio.Standalone.Client.Settings; +using Ciribob.DCS.SimpleRadio.Standalone.Client.Singletons; +using Ciribob.DCS.SimpleRadio.Standalone.Client.UI.AwacsRadioOverlayWindow; +using Ciribob.DCS.SimpleRadio.Standalone.Common; +using NLog; + +namespace Ciribob.DCS.SimpleRadio.Standalone.Overlay +{ + /// + /// Interaction logic for RadioOverlayWindow.xaml + /// + public partial class RadioOverlayWindowTenVerticalLong : Window + { + private readonly double _aspectRatio; + private readonly Logger Logger = LogManager.GetCurrentClassLogger(); + + private readonly RadioControlGroup[] radioControlGroup = new RadioControlGroup[10]; + + private readonly DispatcherTimer _updateTimer; + + public static bool AwacsActive = false + ; //when false and we're in spectator mode / not in an aircraft the other 7 radios will be disabled + + private readonly ClientStateSingleton _clientStateSingleton = ClientStateSingleton.Instance; + + private GlobalSettingsStore _globalSettings = GlobalSettingsStore.Instance; + + public RadioOverlayWindowTenVerticalLong() + { + //load opacity before the intialising as the slider changed + //method fires after initialisation + // var opacity = AppConfiguration.Instance.RadioOpacity; + AwacsActive = true; + + InitializeComponent(); + + this.WindowStartupLocation = WindowStartupLocation.Manual; + + _aspectRatio = MinWidth / MinHeight; + + AllowsTransparency = true; + Opacity = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalOpacity).DoubleValue; + windowOpacitySlider.Value = Opacity; + + Left = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalX).DoubleValue; + Top = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalY).DoubleValue; + + Width = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalWidth).DoubleValue; + Height = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalHeight).DoubleValue; + + radioControlGroup[0] = radio1; + radioControlGroup[1] = radio2; + radioControlGroup[2] = radio3; + radioControlGroup[3] = radio4; + radioControlGroup[4] = radio5; + radioControlGroup[5] = radio6; + radioControlGroup[6] = radio7; + radioControlGroup[7] = radio8; + radioControlGroup[8] = radio9; + radioControlGroup[9] = radio10; + + + //allows click and drag anywhere on the window + containerPanel.MouseLeftButtonDown += WrapPanel_MouseLeftButtonDown; + + CalculateScale(); + + RadioRefresh(null, null); + + //init radio refresh + _updateTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(80)}; + _updateTimer.Tick += RadioRefresh; + _updateTimer.Start(); + } + + private void RadioRefresh(object sender, EventArgs eventArgs) + { + foreach (var radio in radioControlGroup) + { + radio.RepaintRadioStatus(); + radio.RepaintRadioReceive(); + } + + intercom.RepaintRadioStatus(); + + var dcsPlayerRadioInfo = _clientStateSingleton.DcsPlayerRadioInfo; + if (dcsPlayerRadioInfo != null) + { + if (_clientStateSingleton.IsConnected && dcsPlayerRadioInfo.IsCurrent() + && _clientStateSingleton.DcsPlayerRadioInfo.simultaneousTransmissionControl == DCSPlayerRadioInfo.SimultaneousTransmissionControl.ENABLED_INTERNAL_SRS_CONTROLS) + { + + var avalilableRadios = 0; + + for (var i = 0; i < dcsPlayerRadioInfo.radios.Length; i++) + { + if (dcsPlayerRadioInfo.radios[i].modulation != RadioInformation.Modulation.DISABLED) + { + avalilableRadios++; + } + } + } + } + } + + private void WrapPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + DragMove(); + } + + protected override void OnClosing(CancelEventArgs e) + { + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalX, Left); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalY, Top); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalWidth, Width); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalHeight, Height); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalOpacity, Opacity); + + base.OnClosing(e); + + AwacsActive = false; + _updateTimer.Stop(); + } + + private void Button_Minimise(object sender, RoutedEventArgs e) + { + // Minimising a window without a taskbar icon leads to the window's menu bar still showing up in the bottom of screen + // Since controls are unusable, but a very small portion of the always-on-top window still showing, we're closing it instead, similar to toggling the overlay + if (_globalSettings.GetClientSettingBool(GlobalSettingsKeys.RadioOverlayTaskbarHide)) + { + Close(); + } + else + { + WindowState = WindowState.Minimized; + } + } + + + private void Button_Close(object sender, RoutedEventArgs e) + { + Close(); + } + + private void windowOpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + Opacity = e.NewValue; + //AppConfiguration.Instance.RadioOpacity = Opacity; + } + + private void containerPanel_SizeChanged(object sender, SizeChangedEventArgs e) + { + //force aspect ratio + CalculateScale(); + + WindowState = WindowState.Normal; + } + +// +// + private void CalculateScale() + { + var yScale = ActualHeight / RadioOverlayWin.MinHeight; + var xScale = ActualWidth / RadioOverlayWin.MinWidth; + var value = Math.Max(xScale, yScale); + ScaleValue = (double) OnCoerceScaleValue(RadioOverlayWin, value); + } + + protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) + { + if (sizeInfo.WidthChanged) + Width = sizeInfo.NewSize.Height * _aspectRatio; + else + Height = sizeInfo.NewSize.Width / _aspectRatio; + + // AppConfiguration.Instance.RadioWidth = Width; + // AppConfiguration.Instance.RadioHeight = Height; + // Console.WriteLine(this.Height +" width:"+ this.Width); + } + + #region ScaleValue Depdency Property //StackOverflow: http://stackoverflow.com/questions/3193339/tips-on-developing-resolution-independent-application/5000120#5000120 + + public static readonly DependencyProperty ScaleValueProperty = DependencyProperty.Register("ScaleValue", + typeof(double), typeof(RadioOverlayWindowTenVerticalLong), + new UIPropertyMetadata(1.0, OnScaleValueChanged, + OnCoerceScaleValue)); + + + private static object OnCoerceScaleValue(DependencyObject o, object value) + { + var mainWindow = o as RadioOverlayWindowTenVerticalLong; + if (mainWindow != null) + return mainWindow.OnCoerceScaleValue((double) value); + return value; + } + + private static void OnScaleValueChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) + { + var mainWindow = o as RadioOverlayWindowTenVerticalLong; + if (mainWindow != null) + mainWindow.OnScaleValueChanged((double) e.OldValue, (double) e.NewValue); + } + + protected virtual double OnCoerceScaleValue(double value) + { + if (double.IsNaN(value)) + return 1.0f; + + value = Math.Max(0.1, value); + return value; + } + + protected virtual void OnScaleValueChanged(double oldValue, double newValue) + { + } + + public double ScaleValue + { + get { return (double) GetValue(ScaleValueProperty); } + set { SetValue(ScaleValueProperty, value); } + } + + #endregion + + private void ToggleGlobalSimultaneousTransmissionButton_Click(object sender, RoutedEventArgs e) + { + var dcsPlayerRadioInfo = _clientStateSingleton.DcsPlayerRadioInfo; + if (dcsPlayerRadioInfo != null) + { + dcsPlayerRadioInfo.simultaneousTransmission = !dcsPlayerRadioInfo.simultaneousTransmission; + + if (!dcsPlayerRadioInfo.simultaneousTransmission) + { + foreach (var radio in dcsPlayerRadioInfo.radios) + { + radio.simul = false; + } + } + + foreach (var radio in radioControlGroup) + { + radio.RepaintRadioStatus(); + } + } + } + } +} \ No newline at end of file From 4ff3ab437974958b45e5987bea43e8c4318c4266 Mon Sep 17 00:00:00 2001 From: Dabble1SC <119721976+Dabble1SC@users.noreply.github.com> Date: Sat, 25 Nov 2023 10:19:23 -0800 Subject: [PATCH 3/7] updated min height to match panel height on 10H Wide panel --- .../UI/RadioOverlayWindow/RadioOverlayTenHorizontalWide.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenHorizontalWide.xaml b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenHorizontalWide.xaml index 7a172f43..df2b8985 100644 --- a/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenHorizontalWide.xaml +++ b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenHorizontalWide.xaml @@ -8,7 +8,7 @@ Width="1650" Height="127" MinWidth="1650" - MinHeight="120" + MinHeight="127" AllowsTransparency="True" Background="#444" Opacity="1.0" From c6d517291f02e2e1c02a5a1f91f5b9ecf70f189c Mon Sep 17 00:00:00 2001 From: Dabble1SC <119721976+Dabble1SC@users.noreply.github.com> Date: Sat, 25 Nov 2023 22:15:47 -0800 Subject: [PATCH 4/7] Added logging functionality for all additional panels --- DCS-SR-Client/Settings/GlobalSettingsStore.cs | 2 + .../UI/ClientWindow/MainWindow.xaml.cs | 400 ++++++++++++++++-- .../RadioOverlayFiveVertical.xaml | 1 + .../RadioOverlayOneHorizontal.xaml.cs | 104 ++++- .../RadioOverlayTenVerticalLong.xaml | 6 +- 5 files changed, 464 insertions(+), 49 deletions(-) diff --git a/DCS-SR-Client/Settings/GlobalSettingsStore.cs b/DCS-SR-Client/Settings/GlobalSettingsStore.cs index fc86ba3e..23605fb6 100644 --- a/DCS-SR-Client/Settings/GlobalSettingsStore.cs +++ b/DCS-SR-Client/Settings/GlobalSettingsStore.cs @@ -31,6 +31,7 @@ public enum GlobalSettingsKeys #region Radio panel settings + // --------- Vertical Panels -------------- // Radio 1V RadioOneVerticalX, RadioOneVerticalY, @@ -79,6 +80,7 @@ public enum GlobalSettingsKeys RadioTenLongVerticalWidth, RadioTenLongVerticalHeight, + // --------- Horizontal Panels -------------- // Radio 1H RadioOneHorizontalX, RadioOneHorizontalY, diff --git a/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml.cs b/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml.cs index f8df39c9..648f9228 100644 --- a/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml.cs +++ b/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml.cs @@ -229,21 +229,68 @@ private void CheckWindowVisibility() bool mainWindowVisible = false; bool radioWindowVisible = false; - bool awacsWindowVisible = false; + bool awacsWindowVisible = true; //changed to bypass check int mainWindowX = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.ClientX).DoubleValue; int mainWindowY = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.ClientY).DoubleValue; + + Logger.Info($"Checking window visibility for main client window {{X={mainWindowX},Y={mainWindowY}}}"); + + + // -------- Vertical Panels ------- + // 1 Radio + int radioOneVerticalX = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioOneVerticalX).DoubleValue; + int radioOneVerticalY = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioOneVerticalY).DoubleValue; + Logger.Info($"Checking window visibility for one vertical radio overlay {{X={radioOneVerticalX},Y={radioOneVerticalY}}}"); + // 2 Radio int radioTwoVerticalX = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalX).DoubleValue; int radioTwoVerticalY = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalY).DoubleValue; + Logger.Info($"Checking window visibility for two vertical radio overlay {{X={radioTwoVerticalX},Y={radioTwoVerticalY}}}"); + // 3 Radio + int radioThreeVerticalX = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioThreeVerticalX).DoubleValue; + int radioThreeVerticalY = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioThreeVerticalY).DoubleValue; + Logger.Info($"Checking window visibility for three vertical radio overlay {{X={radioThreeVerticalX},Y={radioThreeVerticalY}}}"); + // 5 Radio int radioFiveVerticalX = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioFiveX).DoubleValue; int radioFiveVerticalY = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioFiveY).DoubleValue; + Logger.Info($"Checking window visibility for five vertical radio horizontal overlay {{X={radioFiveVerticalX},Y={radioFiveVerticalY}}}"); + // 10 Radio + int radioTenVerticalX = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenVerticalX).DoubleValue; + int radioTenVerticalY = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenVerticalY).DoubleValue; + Logger.Info($"Checking window visibility for ten vertical radio overlay {{X={radioTenVerticalX},Y={radioTenVerticalY}}}"); + // 10 Radio Long + int radioTenLongVerticalX = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalX).DoubleValue; + int radioTenLongVerticalY = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalY).DoubleValue; + Logger.Info($"Checking window visibility for ten vertical long radio overlay {{X={radioTenLongVerticalX},Y={radioTenLongVerticalY}}}"); + + // -------- Horizontal Panels ------- + // 1 Radio + int radioOneHorizontalX = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalX).DoubleValue; + int radioOneHorizontalY = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalY).DoubleValue; + Logger.Info($"Checking window visibility for one horizontal radio overlay {{X={radioOneHorizontalX},Y={radioOneHorizontalY}}}"); + // 2 Radio + int radioTwoHorizontalX = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalX).DoubleValue; + int radioTwoHorizontalY = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalY).DoubleValue; + Logger.Info($"Checking window visibility for two horizontal radio overlay {{X={radioTwoHorizontalX},Y={radioTwoHorizontalY}}}"); + // 3 Radio + int radioThreeHorizontalX = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioThreeHorizontalX).DoubleValue; + int radioThreeHorizontalY = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioThreeHorizontalY).DoubleValue; + Logger.Info($"Checking window visibility for three horizontal radio overlay {{X={radioThreeHorizontalX},Y={radioThreeHorizontalY}}}"); + // 5 Radio + int radioFiveHorizontalX = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioFiveHorizontalX).DoubleValue; + int radioFiveHorizontalY = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioFiveHorizontalY).DoubleValue; + Logger.Info($"Checking window visibility for five horizontal radio overlay {{X={radioFiveHorizontalX},Y={radioFiveHorizontalY}}}"); + + //10 Radio int radioTenHorizontalX = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenHorizontalX).DoubleValue; int radioTenHorizontalY = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenHorizontalY).DoubleValue; + Logger.Info($"Checking window visibility for ten radio horizontal overlay {{X={radioTenHorizontalX},Y={radioTenHorizontalY}}}"); + //10 Radio Wide + int radioTenWideHorizontalX = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenWideHorizontalX).DoubleValue; + int radioTenWideHorizontalY = (int)_globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTenWideHorizontalY).DoubleValue; + Logger.Info($"Checking window visibility for ten wide radio horizontal overlay {{X={radioTenWideHorizontalX},Y={radioTenWideHorizontalY}}}"); + - Logger.Info($"Checking window visibility for main client window {{X={mainWindowX},Y={mainWindowY}}}"); - Logger.Info($"Checking window visibility for two radio overlay {{X={radioTwoVerticalX},Y={radioTwoVerticalY}}}"); - Logger.Info($"Checking window visibility for five radio overlay {{X={radioFiveVerticalX},Y={radioFiveVerticalY}}}"); - Logger.Info($"Checking window visibility for AWACS overlay {{X={radioTenHorizontalX},Y={radioTenHorizontalY}}}"); foreach (System.Windows.Forms.Screen screen in System.Windows.Forms.Screen.AllScreens) { @@ -254,20 +301,67 @@ private void CheckWindowVisibility() Logger.Info($"Main client window {{X={mainWindowX},Y={mainWindowY}}} is visible on {(screen.Primary ? "primary " : "")}screen {screen.DeviceName} with bounds {screen.Bounds}"); mainWindowVisible = true; } + // ------- Vertical Panels ------ + if (screen.Bounds.Contains(radioOneVerticalX, radioOneVerticalY)) + { + Logger.Info($"Radio One Vertical overlay {{X={radioOneVerticalX},Y={radioOneVerticalY}}} is visible on {(screen.Primary ? "primary " : "")}screen {screen.DeviceName} with bounds {screen.Bounds}"); + radioWindowVisible = true; + } if (screen.Bounds.Contains(radioTwoVerticalX, radioTwoVerticalY)) { - Logger.Info($"Radio Two overlay {{X={radioTwoVerticalX},Y={radioTwoVerticalY}}} is visible on {(screen.Primary ? "primary " : "")}screen {screen.DeviceName} with bounds {screen.Bounds}"); + Logger.Info($"Radio Two Vertical overlay {{X={radioTwoVerticalX},Y={radioTwoVerticalY}}} is visible on {(screen.Primary ? "primary " : "")}screen {screen.DeviceName} with bounds {screen.Bounds}"); + radioWindowVisible = true; + } + if (screen.Bounds.Contains(radioThreeVerticalX, radioThreeVerticalY)) + { + Logger.Info($"Radio Three Vertical overlay {{X={radioThreeVerticalX},Y={radioThreeVerticalY}}} is visible on {(screen.Primary ? "primary " : "")}screen {screen.DeviceName} with bounds {screen.Bounds}"); radioWindowVisible = true; } if (screen.Bounds.Contains(radioFiveVerticalX, radioFiveVerticalY)) { - Logger.Info($"Radio Five overlay {{X={radioFiveVerticalX},Y={radioFiveVerticalY}}} is visible on {(screen.Primary ? "primary " : "")}screen {screen.DeviceName} with bounds {screen.Bounds}"); + Logger.Info($"Radio Five Vertical overlay {{X={radioFiveVerticalX},Y={radioFiveVerticalY}}} is visible on {(screen.Primary ? "primary " : "")}screen {screen.DeviceName} with bounds {screen.Bounds}"); + radioWindowVisible = true; + } + if (screen.Bounds.Contains(radioTenVerticalX, radioTenVerticalY)) + { + Logger.Info($"Radio Ten Vertical overlay {{X={radioTenVerticalX},Y={radioTenVerticalY}}} is visible on {(screen.Primary ? "primary " : "")}screen {screen.DeviceName} with bounds {screen.Bounds}"); + radioWindowVisible = true; + } + if (screen.Bounds.Contains(radioTenLongVerticalX, radioTenLongVerticalY)) + { + Logger.Info($"Radio Ten Long Vertical overlay {{X={radioTenLongVerticalX},Y={radioTenLongVerticalY}}} is visible on {(screen.Primary ? "primary " : "")}screen {screen.DeviceName} with bounds {screen.Bounds}"); + radioWindowVisible = true; + } + // -------- Horizontal Panels ----------- + if (screen.Bounds.Contains(radioOneHorizontalX, radioOneHorizontalY)) + { + Logger.Info($"Radio One Horizontal overlay {{X={radioOneHorizontalX},Y={radioOneHorizontalY}}} is visible on {(screen.Primary ? "primary " : "")}screen {screen.DeviceName} with bounds {screen.Bounds}"); + radioWindowVisible = true; + } + if (screen.Bounds.Contains(radioTwoHorizontalX, radioTwoHorizontalY)) + { + Logger.Info($"Radio Two Horizontal overlay {{X={radioTwoHorizontalX},Y={radioTwoHorizontalY}}} is visible on {(screen.Primary ? "primary " : "")}screen {screen.DeviceName} with bounds {screen.Bounds}"); + radioWindowVisible = true; + } + if (screen.Bounds.Contains(radioThreeHorizontalX, radioThreeHorizontalY)) + { + Logger.Info($"Radio Three Horizontal overlay {{X={radioThreeHorizontalX},Y={radioThreeHorizontalY}}} is visible on {(screen.Primary ? "primary " : "")}screen {screen.DeviceName} with bounds {screen.Bounds}"); + radioWindowVisible = true; + } + if (screen.Bounds.Contains(radioFiveHorizontalX, radioFiveHorizontalY)) + { + Logger.Info($"Radio Five Horizontal overlay {{X={radioFiveHorizontalX},Y={radioFiveHorizontalY}}} is visible on {(screen.Primary ? "primary " : "")}screen {screen.DeviceName} with bounds {screen.Bounds}"); radioWindowVisible = true; } if (screen.Bounds.Contains(radioTenHorizontalX, radioTenHorizontalY)) { - Logger.Info($"AWACS overlay {{X={radioTenHorizontalX},Y={radioTenHorizontalY}}} is visible on {(screen.Primary ? "primary " : "")}screen {screen.DeviceName} with bounds {screen.Bounds}"); - awacsWindowVisible = true; + Logger.Info($"Radio Ten Horizontal overlay {{X={radioTenHorizontalX},Y={radioTenHorizontalY}}} is visible on {(screen.Primary ? "primary " : "")}screen {screen.DeviceName} with bounds {screen.Bounds}"); + radioWindowVisible = true; + } + if (screen.Bounds.Contains(radioTenWideHorizontalX, radioTenWideHorizontalY)) + { + Logger.Info($"Radio Ten Wide Horizontal overlay {{X={radioTenWideHorizontalX},Y={radioTenWideHorizontalY}}} is visible on {(screen.Primary ? "primary " : "")}screen {screen.DeviceName} with bounds {screen.Bounds}"); + radioWindowVisible = true; } } @@ -296,29 +390,138 @@ private void CheckWindowVisibility() MessageBoxButton.OK, MessageBoxImage.Warning); - Logger.Warn($"Radio Two overlay window outside visible area of monitors, resetting position ({radioTwoVerticalX},{radioTwoVerticalY}) to defaults"); - Logger.Warn($"Radio Five overlay window outside visible area of monitors, resetting position ({radioFiveVerticalX},{radioFiveVerticalY}) to defaults"); + // ------- Vertical Panels --------- + Logger.Warn($"Radio One Vertical overlay window outside visible area of monitors, resetting position ({radioOneVerticalX},{radioOneVerticalY}) to defaults"); + Logger.Warn($"Radio Two Vertical overlay window outside visible area of monitors, resetting position ({radioTwoVerticalX},{radioTwoVerticalY}) to defaults"); + Logger.Warn($"Radio Three Vertical overlay window outside visible area of monitors, resetting position ({radioThreeVerticalX},{radioThreeVerticalY}) to defaults"); + Logger.Warn($"Radio Five Vertical overlay window outside visible area of monitors, resetting position ({radioFiveVerticalX},{radioFiveVerticalY}) to defaults"); + Logger.Warn($"Radio Ten Vertical overlay window outside visible area of monitors, resetting position ({radioTenVerticalX},{radioTenVerticalY}) to defaults"); + Logger.Warn($"Radio Ten Long Vertical overlay window outside visible area of monitors, resetting position ({radioTenLongVerticalX},{radioTenLongVerticalY}) to defaults"); + + // ------- Horizontal Panels ---------- + Logger.Warn($"Radio One Horizontal overlay window outside visible area of monitors, resetting position ({radioOneHorizontalX},{radioOneHorizontalY}) to defaults"); + Logger.Warn($"Radio Two Horizontal overlay window outside visible area of monitors, resetting position ({radioTwoHorizontalX},{radioTwoHorizontalY}) to defaults"); + Logger.Warn($"Radio Three Horizontal overlay window outside visible area of monitors, resetting position ({radioThreeHorizontalX},{radioThreeHorizontalY}) to defaults"); + Logger.Warn($"Radio Five Horizontal overlay window outside visible area of monitors, resetting position ({radioFiveHorizontalX},{radioFiveHorizontalY}) to defaults"); + Logger.Warn($"Radio Ten Horizontal overlay window outside visible area of monitors, resetting position ({radioTenHorizontalX},{radioTenHorizontalY}) to defaults"); + Logger.Warn($"Radio Ten Wide Horizontal overlay window outside visible area of monitors, resetting position ({radioTenWideHorizontalX},{radioTenWideHorizontalY}) to defaults"); + + // Reset Radio Panel Positions + // ----- Vertical ------- + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneVerticalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneVerticalY, 300); _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalX, 300); _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalY, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioThreeVerticalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioThreeVerticalY, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioFiveX, 300); _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioFiveY, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenVerticalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenVerticalY, 300); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalY, 300); + + // ------ Horizontal ------ + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalY, 300); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalY, 300); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioThreeHorizontalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioThreeHorizontalY, 300); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioFiveHorizontalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioFiveHorizontalY, 300); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenHorizontalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenHorizontalY, 300); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenWideHorizontalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenWideHorizontalY, 300); + + // Null Value Protection + // ---- Vertical Panels ----- + if (_radioOverlayWindowOneVertical != null) + { + _radioOverlayWindowOneVertical.Left = 300; + _radioOverlayWindowOneVertical.Top = 300; + } + if (_radioOverlayWindowTwoVertical != null) { _radioOverlayWindowTwoVertical.Left = 300; _radioOverlayWindowTwoVertical.Top = 300; } + if (_radioOverlayWindowThreeVertical != null) + { + _radioOverlayWindowThreeVertical.Left = 300; + _radioOverlayWindowThreeVertical.Top = 300; + } + if (_radioOverlayWindowFiveVertical != null) { _radioOverlayWindowFiveVertical.Left = 300; _radioOverlayWindowFiveVertical.Top = 300; } + + if (_radioOverlayWindowTenVertical != null) + { + _radioOverlayWindowTenVertical.Left = 300; + _radioOverlayWindowTenVertical.Top = 300; + } + + if (_radioOverlayWindowTenVerticalLong != null) + { + _radioOverlayWindowTenVerticalLong.Left = 300; + _radioOverlayWindowTenVerticalLong.Top = 300; + } + + // ------- Horizontal Panels --------- + if (_radioOverlayWindowOneHorizontal != null) + { + _radioOverlayWindowOneHorizontal.Left = 300; + _radioOverlayWindowOneHorizontal.Top = 300; + } + + if (_radioOverlayWindowTwoHorizontal != null) + { + _radioOverlayWindowTwoHorizontal.Left = 300; + _radioOverlayWindowTwoHorizontal.Top = 300; + } + + if (_radioOverlayWindowThreeHorizontal != null) + { + _radioOverlayWindowThreeHorizontal.Left = 300; + _radioOverlayWindowThreeHorizontal.Top = 300; + } + + if (_radioOverlayWindowFiveHorizontal != null) + { + _radioOverlayWindowFiveHorizontal.Left = 300; + _radioOverlayWindowFiveHorizontal.Top = 300; + } + + if (_radioOverlayWindowTenHorizontal != null) + { + _radioOverlayWindowTenHorizontal.Left = 300; + _radioOverlayWindowTenHorizontal.Top = 300; + } + + if (_radioOverlayWindowTenHorizontalWide != null) + { + _radioOverlayWindowTenHorizontalWide.Left = 300; + _radioOverlayWindowTenHorizontalWide.Top = 300; + } } - if (!awacsWindowVisible) + if (!awacsWindowVisible) // --- removed by dabble { MessageBox.Show(this, "The SRS AWACS overlay is no longer visible likely due to a monitor reconfiguration.\n\nThe position will be reset to default to fix this issue", @@ -1277,15 +1480,42 @@ protected override void OnClosing(CancelEventArgs e) _audioPreview?.StopEncoding(); _audioPreview = null; + _radioOverlayWindowOneVertical?.Close(); + _radioOverlayWindowOneVertical = null; + _radioOverlayWindowTwoVertical?.Close(); _radioOverlayWindowTwoVertical = null; + _radioOverlayWindowThreeVertical?.Close(); + _radioOverlayWindowThreeVertical = null; + _radioOverlayWindowFiveVertical?.Close(); _radioOverlayWindowFiveVertical = null; + _radioOverlayWindowTenVertical?.Close(); + _radioOverlayWindowTenVertical = null; + + _radioOverlayWindowTenVerticalLong?.Close(); + _radioOverlayWindowTenVerticalLong = null; + + _radioOverlayWindowOneHorizontal?.Close(); + _radioOverlayWindowOneHorizontal = null; + + _radioOverlayWindowTwoHorizontal?.Close(); + _radioOverlayWindowTwoHorizontal = null; + + _radioOverlayWindowThreeHorizontal?.Close(); + _radioOverlayWindowThreeHorizontal = null; + + _radioOverlayWindowFiveHorizontal?.Close(); + _radioOverlayWindowFiveHorizontal = null; + _radioOverlayWindowTenHorizontal?.Close(); _radioOverlayWindowTenHorizontal = null; + _radioOverlayWindowTenHorizontalWide?.Close(); + _radioOverlayWindowTenHorizontalWide = null; + _dcsAutoConnectListener?.Stop(); _dcsAutoConnectListener = null; } @@ -1726,27 +1956,151 @@ private async void HandleAutoConnectMismatch(string currentConnection, string ad private void ResetRadioWindow_Click(object sender, RoutedEventArgs e) { //close overlay + _radioOverlayWindowOneVertical?.Close(); + _radioOverlayWindowOneVertical = null; + _radioOverlayWindowTwoVertical?.Close(); _radioOverlayWindowTwoVertical = null; + _radioOverlayWindowThreeVertical?.Close(); + _radioOverlayWindowThreeVertical = null; + _radioOverlayWindowFiveVertical?.Close(); _radioOverlayWindowFiveVertical = null; + _radioOverlayWindowTenVertical?.Close(); + _radioOverlayWindowTenVertical = null; + + _radioOverlayWindowTenVerticalLong?.Close(); + _radioOverlayWindowTenVerticalLong = null; + + _radioOverlayWindowOneHorizontal?.Close(); + _radioOverlayWindowOneHorizontal = null; + + _radioOverlayWindowTwoHorizontal?.Close(); + _radioOverlayWindowTwoHorizontal = null; + + _radioOverlayWindowThreeHorizontal?.Close(); + _radioOverlayWindowThreeHorizontal = null; + + _radioOverlayWindowFiveHorizontal?.Close(); + _radioOverlayWindowFiveHorizontal = null; + + _radioOverlayWindowTenHorizontal?.Close(); + _radioOverlayWindowTenHorizontal = null; + + _radioOverlayWindowTenHorizontalWide?.Close(); + _radioOverlayWindowTenHorizontalWide = null; + + //Reset Panel Settings + // 1 Vertical + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneVerticalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneVerticalY, 300); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneVerticalWidth, 170); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneVerticalHeight, 175); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneVerticalOpacity, 1.0); + + // 2 Vertical _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalX, 300); _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalY, 300); - _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalWidth, 122); - _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalHeight, 270); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalWidth, 170); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalHeight, 265); _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoVerticalOpacity, 1.0); + // 3 Vertical + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioThreeVerticalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioThreeVerticalY, 300); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioThreeVerticalWidth, 170); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioThreeVerticalHeight, 355); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioThreeVerticalOpacity, 1.0); + + // 5 Vertical _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioFiveX, 300); _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioFiveY, 300); - _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioFiveWidth, 122); - _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioFiveHeight, 270); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioFiveWidth, 170); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioFiveHeight, 494); _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioFiveOpacity, 1.0); + + // 10 Vertical + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenVerticalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenVerticalY, 300); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenVerticalWidth, 340); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenVerticalHeight, 500); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenVerticalOpacity, 1.0); + + // 10 Vertical Long + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalY, 300); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalWidth, 170); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalHeight, 905); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenLongVerticalOpacity, 1.0); + + // 1 Horizontal + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalY, 300); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalWidth, 340); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalHeight, 100); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalOpacity, 1.0); + + // 2 Horizontal + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalY, 300); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalWidth, 340); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalHeight, 160); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalOpacity, 1.0); + + // 3 Horizontal + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioThreeHorizontalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioThreeHorizontalY, 300); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioThreeHorizontalWidth, 510); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioThreeHorizontalHeight, 160); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioThreeHorizontalOpacity, 1.0); + + // 5 Horizontal + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioFiveHorizontalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioFiveHorizontalY, 300); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioFiveHorizontalWidth, 805); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioFiveHorizontalHeight, 140); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioFiveHorizontalOpacity, 1.0); + + // 10 Horizontal + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenHorizontalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenHorizontalY, 300); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenHorizontalWidth, 805); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenHorizontalHeight, 220); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenHorizontalOpacity, 1.0); + + // 10 Horizontal Wide + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenWideHorizontalX, 300); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenWideHorizontalY, 300); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenWideHorizontalWidth, 1650); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioTenWideHorizontalHeight, 127); + + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioThreeHorizontalOpacity, 1.0); + } private void ToggleServerSettings_OnClick(object sender, RoutedEventArgs e) @@ -2160,19 +2514,7 @@ private void PushToTalkStartDelay_ValueChanged(object sender, RoutedPropertyChan if (PTTStartDelay.IsEnabled) _globalSettings.ProfileSettingsStore.SetClientSettingFloat(ProfileSettingsKeys.PTTStartDelay, (float)e.NewValue); } - - private void Donate_OnClick(object sender, RoutedEventArgs e) - { - try - { - Process.Start( - "https://www.patreon.com/ciribob"); - } - catch (Exception) - { - } - } - + private void BackgroundRadioNoiseToggle_OnClick(object sender, RoutedEventArgs e) { _globalSettings.ProfileSettingsStore.SetClientSettingBool(ProfileSettingsKeys.RadioBackgroundNoiseEffect, (bool)BackgroundRadioNoiseToggle.IsChecked); diff --git a/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayFiveVertical.xaml b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayFiveVertical.xaml index 59fc572d..66860592 100644 --- a/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayFiveVertical.xaml +++ b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayFiveVertical.xaml @@ -98,6 +98,7 @@ + public partial class RadioOverlayWindowOneHorizontal : Window { - private readonly double _aspectRatio; + private double _aspectRatio; //originally readonly - dabble removed to match 1V panel private readonly Logger Logger = LogManager.GetCurrentClassLogger(); private readonly RadioControlGroup[] radioControlGroup = new RadioControlGroup[1]; private readonly DispatcherTimer _updateTimer; - private long _lastUnitId; - private readonly ClientStateSingleton _clientStateSingleton = ClientStateSingleton.Instance; - private GlobalSettingsStore _globalSettings = GlobalSettingsStore.Instance; + private readonly GlobalSettingsStore _globalSettings = GlobalSettingsStore.Instance; + + private readonly double _originalMinHeight; + private readonly double _radioHeight; + + private long _lastUnitId; + + public RadioOverlayWindowOneHorizontal() { + //load opacity before the intialising as the slider changed + //method fires after initialisation InitializeComponent(); this.WindowStartupLocation = WindowStartupLocation.Manual; _aspectRatio = MinWidth / MinHeight; + _originalMinHeight = MinHeight; + _radioHeight = radio1.Height; + WindowInteropHelper windowInteropHelper = new WindowInteropHelper(MainWindow.GetWindow(this)); + Screen screen = System.Windows.Forms.Screen.FromHandle(windowInteropHelper.Handle); + MaxHeight = screen.Bounds.Height; + AllowsTransparency = true; Opacity = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalOpacity).DoubleValue; windowOpacitySlider.Value = Opacity; + + radioControlGroup[0] = radio1; + + + //allows click and drag anywhere on the window + containerPanel.MouseLeftButtonDown += WrapPanel_MouseLeftButtonDown; Left = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalX).DoubleValue; Top = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalY).DoubleValue; Width = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalWidth).DoubleValue; Height = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalHeight).DoubleValue; - - radioControlGroup[0] = radio1; - //allows click and drag anywhere on the window - containerPanel.MouseLeftButtonDown += WrapPanel_MouseLeftButtonDown; - CalculateScale(); LocationChanged += Location_Changed; @@ -123,8 +145,58 @@ private void RadioRefresh(object sender, EventArgs eventArgs) } else { + ResetHeight(); ControlText.Text = "1 Horizontal (Disconnected)"; } + + FocusDCS(); + } + + private void ResetHeight() + { + + if (MinHeight != _originalMinHeight) + { + MinHeight = _originalMinHeight; + Recalculate(); + } + } + + private void Recalculate() + { + _aspectRatio = MinWidth / MinHeight; + containerPanel_SizeChanged(null, null); + Height = Height+1; + } + + private long _lastFocus; + private RadioCapabilities _radioCapabilitiesWindow; + + private void FocusDCS() + { + if (_globalSettings.GetClientSettingBool(GlobalSettingsKeys.RefocusDCS)) + { + var overlayWindow = new WindowInteropHelper(this).Handle; + + //focus DCS if needed + var foreGround = WindowHelper.GetForegroundWindow(); + + Process[] localByName = Process.GetProcessesByName("dcs"); + + if (localByName != null && localByName.Length > 0) + { + //either DCS is in focus OR Overlay window is not in focus + if (foreGround == localByName[0].MainWindowHandle || overlayWindow != foreGround || + this.IsMouseOver) + { + _lastFocus = DateTime.Now.Ticks; + } + else if (DateTime.Now.Ticks > _lastFocus + 20000000 && overlayWindow == foreGround) + { + WindowHelper.BringProcessToFront(localByName[0]); + } + } + } } private void WrapPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) @@ -134,12 +206,11 @@ private void WrapPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e protected override void OnClosing(CancelEventArgs e) { - _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalX, Left); - _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalY, Top); _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalWidth, Width); _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalHeight, Height); _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalOpacity, Opacity); - + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalX, Left); + _globalSettings.SetPositionSetting(GlobalSettingsKeys.RadioOneHorizontalY, Top); base.OnClosing(e); _updateTimer.Stop(); @@ -179,13 +250,12 @@ private void containerPanel_SizeChanged(object sender, SizeChangedEventArgs e) WindowState = WindowState.Normal; } -// -// + private void CalculateScale() { var yScale = ActualHeight / RadioOverlayWin.MinHeight; var xScale = ActualWidth / RadioOverlayWin.MinWidth; - var value = Math.Max(xScale, yScale); + var value = Math.Min(xScale, yScale); ScaleValue = (double) OnCoerceScaleValue(RadioOverlayWin, value); } diff --git a/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenVerticalLong.xaml b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenVerticalLong.xaml index f874c49d..3606a9cc 100644 --- a/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenVerticalLong.xaml +++ b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTenVerticalLong.xaml @@ -5,9 +5,9 @@ xmlns:awacsOverlayWindow="clr-namespace:Ciribob.DCS.SimpleRadio.Standalone.Client.UI.AwacsRadioOverlayWindow" Name="RadioOverlayWin" Title="DCS-SimpleRadio" - Width="174" + Width="170" Height="905" - MinWidth="174" + MinWidth="170" MinHeight="905" AllowsTransparency="True" Background="#444" @@ -19,7 +19,7 @@ + Style="{x:Null}" Margin="0,0,0,0"> Date: Sun, 26 Nov 2023 07:12:23 -0800 Subject: [PATCH 5/7] Added logger functions to 1H panel opening sequence --- DCS-SR-Client/UI/ClientWindow/MainWindow.xaml.cs | 2 ++ .../RadioOverlayWindow/RadioOverlayOneHorizontal.xaml.cs | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml.cs b/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml.cs index 648f9228..7479d17d 100644 --- a/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml.cs +++ b/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml.cs @@ -1671,6 +1671,7 @@ private void ShowOverlayOneVertical_OnClick(object sender, RoutedEventArgs e) private void ShowOverlayOneHorizontal_OnClick(object sender, RoutedEventArgs e) { ToggleOverlay(true, 9); + Logger.Info("1H Panel Button Clicked"); } private void ShowOverlayTenVerticalLong_OnClick(object sender, RoutedEventArgs e) { @@ -1744,6 +1745,7 @@ private void ToggleOverlay(bool uiButton, int switchTo) break; case 9: windows[switchTo] = new RadioOverlayWindowOneHorizontal(); + Logger.Info($"Overlay switched to Case {switchTo}"); break; case 10: windows[switchTo] = new RadioOverlayWindowTenVerticalLong(); diff --git a/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneHorizontal.xaml.cs b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneHorizontal.xaml.cs index 11c4baa3..448bc663 100644 --- a/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneHorizontal.xaml.cs +++ b/DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneHorizontal.xaml.cs @@ -27,6 +27,7 @@ namespace Ciribob.DCS.SimpleRadio.Standalone.Overlay public partial class RadioOverlayWindowOneHorizontal : Window { private double _aspectRatio; //originally readonly - dabble removed to match 1V panel + private readonly Logger Logger = LogManager.GetCurrentClassLogger(); private readonly RadioControlGroup[] radioControlGroup = new RadioControlGroup[1]; @@ -43,6 +44,7 @@ public partial class RadioOverlayWindowOneHorizontal : Window private long _lastUnitId; + public RadioOverlayWindowOneHorizontal() { @@ -223,10 +225,12 @@ private void Button_Minimise(object sender, RoutedEventArgs e) if (_globalSettings.GetClientSettingBool(GlobalSettingsKeys.RadioOverlayTaskbarHide)) { Close(); + Logger.Info("1H Panel Closed due RadioOverlayTaskbar Hide setting"); } else { WindowState = WindowState.Minimized; + Logger.Info("1H Panel Minimized"); } } @@ -234,12 +238,14 @@ private void Button_Minimise(object sender, RoutedEventArgs e) private void Button_Close(object sender, RoutedEventArgs e) { Close(); + Logger.Info("1H Panel Closed"); } private void windowOpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) { Opacity = e.NewValue; //AppConfiguration.Instance.RadioOpacity = Opacity; + Logger.Info($"1H Panel Opacity Set - {Opacity}"); } private void containerPanel_SizeChanged(object sender, SizeChangedEventArgs e) @@ -257,6 +263,7 @@ private void CalculateScale() var xScale = ActualWidth / RadioOverlayWin.MinWidth; var value = Math.Min(xScale, yScale); ScaleValue = (double) OnCoerceScaleValue(RadioOverlayWin, value); + Logger.Info($"1H Panel Scale Set - Value= {value}"); } protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) From 6fffc04b5a98ea5825bc840315ed6487f7ecb849 Mon Sep 17 00:00:00 2001 From: FPG Schiba Date: Sun, 26 Nov 2023 17:22:12 +0100 Subject: [PATCH 6/7] Fixed Client Project Compile Settings --- DCS-SR-Client/DCS-SR-Client.csproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/DCS-SR-Client/DCS-SR-Client.csproj b/DCS-SR-Client/DCS-SR-Client.csproj index ac134525..92c98191 100644 --- a/DCS-SR-Client/DCS-SR-Client.csproj +++ b/DCS-SR-Client/DCS-SR-Client.csproj @@ -349,6 +349,7 @@ RadioOverlayOneVertical.xaml + IntercomControlGroup2Horizontal.xaml @@ -454,6 +455,9 @@ Designer + MSBuild:Compile + Designer + MSBuild:Compile Designer From 6532953e469c24be285e03878010730ddb3da77a Mon Sep 17 00:00:00 2001 From: FPG Schiba Date: Sun, 26 Nov 2023 17:34:43 +0100 Subject: [PATCH 7/7] Added default Settings and ToDos * Added all default settings for new Radio Panels * Added H/V Switch ToDo's on MainWindow --- DCS-SR-Client/Settings/GlobalSettingsStore.cs | 35 ++++++++++++++++++- .../UI/ClientWindow/MainWindow.xaml.cs | 11 ++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/DCS-SR-Client/Settings/GlobalSettingsStore.cs b/DCS-SR-Client/Settings/GlobalSettingsStore.cs index 23605fb6..37cefdb8 100644 --- a/DCS-SR-Client/Settings/GlobalSettingsStore.cs +++ b/DCS-SR-Client/Settings/GlobalSettingsStore.cs @@ -500,6 +500,14 @@ public void SetClientSetting(GlobalSettingsKeys key, string[] strArray) #region Radio Panel settings + // Raio 1V + {GlobalSettingsKeys.RadioOneVerticalX.ToString(), "300"}, + {GlobalSettingsKeys.RadioOneVerticalY.ToString(), "300"}, + {GlobalSettingsKeys.RadioOneVerticalSize.ToString(), "1.0"}, + {GlobalSettingsKeys.RadioOneVerticalOpacity.ToString(), "1.0"}, + {GlobalSettingsKeys.RadioOneVerticalWidth.ToString(), "122"}, + {GlobalSettingsKeys.RadioOneVerticalHeight.ToString(), "270"}, + // Radio 2V {GlobalSettingsKeys.RadioTwoVerticalX.ToString(), "300"}, {GlobalSettingsKeys.RadioTwoVerticalY.ToString(), "300"}, @@ -531,6 +539,22 @@ public void SetClientSetting(GlobalSettingsKeys key, string[] strArray) {GlobalSettingsKeys.RadioTenVerticalOpacity.ToString(), "1.0"}, {GlobalSettingsKeys.RadioTenVerticalWidth.ToString(), "122"}, {GlobalSettingsKeys.RadioTenVerticalHeight.ToString(), "270"}, + + // Radio 10VL + {GlobalSettingsKeys.RadioTenLongVerticalX.ToString(), "300"}, + {GlobalSettingsKeys.RadioTenLongVerticalY.ToString(), "300"}, + {GlobalSettingsKeys.RadioTenLongVerticalSize.ToString(), "1.0"}, + {GlobalSettingsKeys.RadioTenLongVerticalOpacity.ToString(), "1.0"}, + {GlobalSettingsKeys.RadioTenLongVerticalWidth.ToString(), "122"}, + {GlobalSettingsKeys.RadioTenLongVerticalHeight.ToString(), "270"}, + + // Radio 1H + {GlobalSettingsKeys.RadioOneHorizontalX.ToString(), "300"}, + {GlobalSettingsKeys.RadioOneHorizontalY.ToString(), "300"}, + {GlobalSettingsKeys.RadioOneHorizontalSize.ToString(), "1.0"}, + {GlobalSettingsKeys.RadioOneHorizontalOpacity.ToString(), "1.0"}, + {GlobalSettingsKeys.RadioOneHorizontalWidth.ToString(), "122"}, + {GlobalSettingsKeys.RadioOneHorizontalHeight.ToString(), "270"}, // Radio 2H {GlobalSettingsKeys.RadioTwoHorizontalX.ToString(), "300"}, @@ -563,7 +587,16 @@ public void SetClientSetting(GlobalSettingsKeys key, string[] strArray) {GlobalSettingsKeys.RadioTenHorizontalOpacity.ToString(), "1.0"}, {GlobalSettingsKeys.RadioTenHorizontalWidth.ToString(), "122"}, {GlobalSettingsKeys.RadioTenHorizontalHeight.ToString(), "270"}, - + + // Radio 10HW + {GlobalSettingsKeys.RadioTenWideHorizontalX.ToString(), "300"}, + {GlobalSettingsKeys.RadioTenWideHorizontalY.ToString(), "300"}, + {GlobalSettingsKeys.RadioTenWideHorizontalSize.ToString(), "1.0"}, + {GlobalSettingsKeys.RadioTenWideHorizontalOpacity.ToString(), "1.0"}, + {GlobalSettingsKeys.RadioTenWideHorizontalWidth.ToString(), "122"}, + {GlobalSettingsKeys.RadioTenWideHorizontalHeight.ToString(), "270"}, + + // Client Window {GlobalSettingsKeys.ClientX.ToString(), "200"}, {GlobalSettingsKeys.ClientY.ToString(), "200"}, diff --git a/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml.cs b/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml.cs index 625b7a8c..757a9e7a 100644 --- a/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml.cs +++ b/DCS-SR-Client/UI/ClientWindow/MainWindow.xaml.cs @@ -1664,25 +1664,27 @@ private void ShowOverlayTenHorizontal_OnClick(object sender, RoutedEventArgs e) { ToggleOverlay(true, 7); } + private void ShowOverlayOneVertical_OnClick(object sender, RoutedEventArgs e) { ToggleOverlay(true, 8); } + private void ShowOverlayOneHorizontal_OnClick(object sender, RoutedEventArgs e) { ToggleOverlay(true, 9); - Logger.Info("1H Panel Button Clicked"); } + private void ShowOverlayTenVerticalLong_OnClick(object sender, RoutedEventArgs e) { ToggleOverlay(true, 10); } + private void ShowOverlayTenHorizontalWide_OnClick(object sender, RoutedEventArgs e) { ToggleOverlay(true, 11); } - private void ToggleOverlay(bool uiButton, int switchTo) { //debounce show hide (1 tick = 100ns, 6000000 ticks = 600ms debounce) @@ -1741,16 +1743,19 @@ private void ToggleOverlay(bool uiButton, int switchTo) windows[switchTo] = new RadioOverlayWindowTenHorizontal(ToggleOverlay); break; case 8: + // TODO: Add Toggle Overlay for Horizontal Swap windows[switchTo] = new RadioOverlayWindowOneVertical(); break; case 9: + // TODO: Add Toggle Overlay for Horizontal Swap windows[switchTo] = new RadioOverlayWindowOneHorizontal(); - Logger.Info($"Overlay switched to Case {switchTo}"); break; case 10: + // TODO: Add Toggle Overlay for Horizontal Swap windows[switchTo] = new RadioOverlayWindowTenVerticalLong(); break; case 11: + // TODO: Add Toggle Overlay for Horizontal Swap windows[switchTo] = new RadioOverlayWindowTenHorizontalWide(); break; }