diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 48e254cf..372361b8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,7 @@ jobs: uses: nuget/setup-nuget@v1 - name: Build & Package - run: ./build.bat ".\SRS-Radio-Presets" ${{ steps.version.outputs.version_tag }} + run: ./build.bat ${{ steps.version.outputs.version_tag }} - name: Setup VSTest uses: Malcolmnixon/Setup-VSTest@v3 @@ -50,6 +50,6 @@ jobs: tag: ${{ steps.version.outputs.version_tag }} name: Release ${{ steps.version.outputs.version_tag }} body: "Please update Release notes" - artifacts: "Vanguard-SRS-${{ steps.version.outputs.version_tag }}.zip" + artifacts: "VCS-SRS-${{ steps.version.outputs.version_tag }}.zip" token: ${{ secrets.GITHUB_TOKEN }} draft: true diff --git a/DCS-SR-Client/DCS-SR-Client.csproj b/DCS-SR-Client/DCS-SR-Client.csproj index 0cbaf465..87c3ed8e 100644 --- a/DCS-SR-Client/DCS-SR-Client.csproj +++ b/DCS-SR-Client/DCS-SR-Client.csproj @@ -380,8 +380,8 @@ LegacyPage.xaml - - MiscellaneousPage.xaml + + BalancingPage.xaml RadioEffectsPage.xaml @@ -564,7 +564,7 @@ - + @@ -893,9 +893,6 @@ Always - - - diff --git a/DCS-SR-Client/Input/InputDeviceManager.cs b/DCS-SR-Client/Input/InputDeviceManager.cs index 63275402..89e5f90a 100644 --- a/DCS-SR-Client/Input/InputDeviceManager.cs +++ b/DCS-SR-Client/Input/InputDeviceManager.cs @@ -7,6 +7,7 @@ using System.Windows; using System.Xml.Serialization; using System.Windows.Interop; +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; @@ -64,6 +65,7 @@ public class InputDeviceManager : IDisposable private readonly DirectInput _directInput; private readonly Dictionary _inputDevices = new Dictionary(); private readonly MainWindow.ToggleOverlayCallback _toggleOverlayCallback; + private readonly MainWindow.UpdateChannelCallback _updateChannelCallback; private volatile bool _detectPtt; @@ -74,7 +76,7 @@ public class InputDeviceManager : IDisposable private readonly Settings.GlobalSettingsStore _globalSettings = Settings.GlobalSettingsStore.Instance; - public InputDeviceManager(Window window, MainWindow.ToggleOverlayCallback _toggleOverlayCallback) + public InputDeviceManager(Window window, MainWindow.ToggleOverlayCallback _toggleOverlayCallback, MainWindow.UpdateChannelCallback _updateChannelCallback) { _directInput = new DirectInput(); @@ -83,6 +85,7 @@ public InputDeviceManager(Window window, MainWindow.ToggleOverlayCallback _toggl new WindowInteropHelper(window); this._toggleOverlayCallback = _toggleOverlayCallback; + this._updateChannelCallback = _updateChannelCallback; LoadWhiteList(); @@ -691,6 +694,8 @@ public void StartDetectPtt(DetectPttCallback callback) if (dcsPlayerRadioInfo != null && dcsPlayerRadioInfo.IsCurrent()) { + var currentChannel = GetCurrentChannel(); + var currentBalance = 0.0f; switch (bindState.MainDevice.InputBind) { case InputBinding.Up100: @@ -766,7 +771,6 @@ public void StartDetectPtt(DetectPttCallback callback) var radioId = dcsPlayerRadioInfo.selected; var freq = dcsPlayerRadioInfo.radios[dcsPlayerRadioInfo.selected].freq; var standbyFreq = dcsPlayerRadioInfo.radios[dcsPlayerRadioInfo.selected].standbyfreq ; - RadioHelper.UpdateStandbyRadioFrequency(freq, radioId, false, false); RadioHelper.UpdateRadioFrequency(standbyFreq, radioId, false, false); break; @@ -813,16 +817,25 @@ public void StartDetectPtt(DetectPttCallback callback) Application.Current.Dispatcher.Invoke(() => { _toggleOverlayCallback(false, MainWindow.SwitchIndex); }); break; case InputBinding.LeftBalance: - // TODO: Call back new UI for update - _globalSettings.ProfileSettingsStore.SetClientSettingFloat(GetCurrentChannel(), Math.Max(_globalSettings.ProfileSettingsStore.GetClientSettingFloat(GetCurrentChannel()) - 0.1f, -1.0f)); + currentChannel = GetCurrentChannel(); + currentBalance = Math.Max(_globalSettings.ProfileSettingsStore.GetClientSettingFloat(currentChannel) - 0.1f, -1.0f); + _globalSettings.ProfileSettingsStore.SetClientSettingFloat(currentChannel, currentBalance); + Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, + new ThreadStart(delegate { _updateChannelCallback(currentChannel, currentBalance); })); break; case InputBinding.RightBalance: - // TODO: Call back new UI for update - _globalSettings.ProfileSettingsStore.SetClientSettingFloat(GetCurrentChannel(), Math.Min(_globalSettings.ProfileSettingsStore.GetClientSettingFloat(GetCurrentChannel()) + 0.1f, 1.0f)); + currentChannel = GetCurrentChannel(); + currentBalance = Math.Min(_globalSettings.ProfileSettingsStore.GetClientSettingFloat(currentChannel) + 0.1f, 1.0f); + _globalSettings.ProfileSettingsStore.SetClientSettingFloat(currentChannel, currentBalance); + Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, + new ThreadStart(delegate { _updateChannelCallback(currentChannel, currentBalance); })); break; case InputBinding.CenterBalance: - // TODO: Call back new UI for update - _globalSettings.ProfileSettingsStore.SetClientSettingFloat(GetCurrentChannel(), 0f); + currentChannel = GetCurrentChannel(); + currentBalance = 0f; + _globalSettings.ProfileSettingsStore.SetClientSettingFloat(currentChannel, currentBalance); + Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, + new ThreadStart(delegate { _updateChannelCallback(currentChannel, currentBalance); })); break; case InputBinding.PanelNightMode: // TODO: Call back UI for update diff --git a/DCS-SR-Client/Network/DCS/DCSRadioSyncManager.cs b/DCS-SR-Client/Network/DCS/DCSRadioSyncManager.cs index 9d95fe15..f3088b3f 100644 --- a/DCS-SR-Client/Network/DCS/DCSRadioSyncManager.cs +++ b/DCS-SR-Client/Network/DCS/DCSRadioSyncManager.cs @@ -11,6 +11,7 @@ using Ciribob.DCS.SimpleRadio.Standalone.Common.Network; using Newtonsoft.Json; using NLog; +using Xamarin.Forms.Internals; /** Keeps radio information in Sync Between DCS and @@ -105,6 +106,10 @@ public void StartExternalAWACSModeLoop() { radioJson = File.ReadAllText(AWACS_RADIOS_FILE); awacsRadios = JsonConvert.DeserializeObject(radioJson); + foreach (var radio in awacsRadios) + { + Logger.Debug($"Loaded AWACS radio file: '{radio.name}': freq: {radio.freq}, stbyfreq: {radio.standbyfreq}"); + } } } catch (Exception ex) diff --git a/DCS-SR-Client/Network/SRSClientSyncHandler.cs b/DCS-SR-Client/Network/SRSClientSyncHandler.cs index bb239439..80433595 100644 --- a/DCS-SR-Client/Network/SRSClientSyncHandler.cs +++ b/DCS-SR-Client/Network/SRSClientSyncHandler.cs @@ -40,6 +40,8 @@ public class SRSClientSyncHandler private IPEndPoint _serverEndpoint; private TcpClient _tcpClient; + private DateTime _connectedAt; + private readonly ClientStateSingleton _clientStateSingleton = ClientStateSingleton.Instance; private readonly SyncedServerSettings _serverSettings = SyncedServerSettings.Instance; private readonly ConnectedClientsSingleton _clients = ConnectedClientsSingleton.Instance; @@ -159,7 +161,7 @@ private void Connect() _vaicomSync.Start(); _tcpClient.NoDelay = true; - + _connectedAt = DateTime.Now; CallOnMain(true); ClientSyncLoop(); } @@ -343,7 +345,6 @@ private void ClientSyncLoop() break; case NetworkMessage.MessageType.RADIO_UPDATE: case NetworkMessage.MessageType.UPDATE: - if (serverMessage.ServerSettings != null) { _serverSettings.Decode(serverMessage.ServerSettings); @@ -403,10 +404,13 @@ private void ClientSyncLoop() if (_clientStateSingleton.ExternalAWACSModelSelected && !_serverSettings.GetSettingAsBool(Common.Setting.ServerSettingsKeys.EXTERNAL_AWACS_MODE)) { - Logger.Debug("Closing AWACS Mode after Update message..."); - Logger.Debug($"Mode selected: {_clientStateSingleton.ExternalAWACSModelSelected}"); - Logger.Debug($"Server AWACS Settings: {_serverSettings.GetSettingAsBool(Common.Setting.ServerSettingsKeys.EXTERNAL_AWACS_MODE)}"); - DisconnectExternalAWACSMode(); + if (_connectedAt.AddSeconds(2) < DateTime.Now) + { + Logger.Debug("Closing AWACS Mode after Update message..."); + Logger.Debug($"Mode selected: {_clientStateSingleton.ExternalAWACSModelSelected}"); + Logger.Debug($"Server AWACS Settings: {_serverSettings.GetSettingAsBool(Common.Setting.ServerSettingsKeys.EXTERNAL_AWACS_MODE)}"); + DisconnectExternalAWACSMode(); + } } CallUpdateUIOnMain(); diff --git a/DCS-SR-Client/UI/AwacsRadioOverlayWindow/AwacsRadioControlGroup.xaml b/DCS-SR-Client/UI/AwacsRadioOverlayWindow/AwacsRadioControlGroup.xaml index 5267caae..dc29350a 100644 --- a/DCS-SR-Client/UI/AwacsRadioOverlayWindow/AwacsRadioControlGroup.xaml +++ b/DCS-SR-Client/UI/AwacsRadioOverlayWindow/AwacsRadioControlGroup.xaml @@ -235,7 +235,6 @@ + Width="15" > + + + + @@ -60,7 +73,6 @@ diff --git a/DCS-SR-Client/UI/ClientWindow/SettingPages/RadioEffectsPage.xaml.cs b/DCS-SR-Client/UI/ClientWindow/SettingPages/RadioEffectsPage.xaml.cs index 8ca59e2d..9fef8643 100644 --- a/DCS-SR-Client/UI/ClientWindow/SettingPages/RadioEffectsPage.xaml.cs +++ b/DCS-SR-Client/UI/ClientWindow/SettingPages/RadioEffectsPage.xaml.cs @@ -17,9 +17,13 @@ public RadioEffectsPage() InitializeComponent(); TxStart.Background = _globalSettings.ProfileSettingsStore.GetClientSettingBool(ProfileSettingsKeys.RadioTxEffects_Start) ? _enabledBrush : _disabledBrush; + TxStartText.Text = _globalSettings.ProfileSettingsStore.GetClientSettingBool(ProfileSettingsKeys.RadioTxEffects_Start) ? "On" : "Off"; TxEnd.Background = _globalSettings.ProfileSettingsStore.GetClientSettingBool(ProfileSettingsKeys.RadioTxEffects_End) ? _enabledBrush : _disabledBrush; + TxEndText.Text = _globalSettings.ProfileSettingsStore.GetClientSettingBool(ProfileSettingsKeys.RadioTxEffects_Start) ? "On" : "Off"; RxStart.Background = _globalSettings.ProfileSettingsStore.GetClientSettingBool(ProfileSettingsKeys.RadioRxEffects_Start) ? _enabledBrush : _disabledBrush; + RxStartText.Text = _globalSettings.ProfileSettingsStore.GetClientSettingBool(ProfileSettingsKeys.RadioTxEffects_Start) ? "On" : "Off"; RxEnd.Background = _globalSettings.ProfileSettingsStore.GetClientSettingBool(ProfileSettingsKeys.RadioRxEffects_End) ? _enabledBrush : _disabledBrush; + RxEndText.Text = _globalSettings.ProfileSettingsStore.GetClientSettingBool(ProfileSettingsKeys.RadioTxEffects_Start) ? "On" : "Off"; RadioEndTransmitEffect.IsEnabled = false; RadioEndTransmitEffect.ItemsSource = CachedAudioEffectProvider.Instance.RadioTransmissionEnd; @@ -49,6 +53,7 @@ private void TxEnd_OnClick(object sender, RoutedEventArgs e) var enabled = !_globalSettings.ProfileSettingsStore.GetClientSettingBool(ProfileSettingsKeys.RadioTxEffects_End); _globalSettings.ProfileSettingsStore.SetClientSettingBool(ProfileSettingsKeys.RadioTxEffects_End, enabled); TxEnd.Background = enabled ? _enabledBrush : _disabledBrush; + TxEndText.Text = enabled ? "On" : "Off"; } private void TxStart_OnClick(object sender, RoutedEventArgs e) @@ -56,6 +61,7 @@ private void TxStart_OnClick(object sender, RoutedEventArgs e) var enabled = !_globalSettings.ProfileSettingsStore.GetClientSettingBool(ProfileSettingsKeys.RadioTxEffects_Start); _globalSettings.ProfileSettingsStore.SetClientSettingBool(ProfileSettingsKeys.RadioTxEffects_Start, enabled); TxStart.Background = enabled ? _enabledBrush : _disabledBrush; + TxStartText.Text = enabled ? "On" : "Off"; } private void RxStart_OnClick(object sender, RoutedEventArgs e) @@ -63,6 +69,7 @@ private void RxStart_OnClick(object sender, RoutedEventArgs e) var enabled = !_globalSettings.ProfileSettingsStore.GetClientSettingBool(ProfileSettingsKeys.RadioRxEffects_Start); _globalSettings.ProfileSettingsStore.SetClientSettingBool(ProfileSettingsKeys.RadioRxEffects_Start, enabled); RxStart.Background = enabled ? _enabledBrush : _disabledBrush; + RxStartText.Text = enabled ? "On" : "Off"; } private void RxEnd_OnClick(object sender, RoutedEventArgs e) @@ -70,6 +77,7 @@ private void RxEnd_OnClick(object sender, RoutedEventArgs e) var enabled = !_globalSettings.ProfileSettingsStore.GetClientSettingBool(ProfileSettingsKeys.RadioRxEffects_End); _globalSettings.ProfileSettingsStore.SetClientSettingBool(ProfileSettingsKeys.RadioRxEffects_End, enabled); RxEnd.Background = enabled ? _enabledBrush : _disabledBrush; + RxEndText.Text = enabled ? "On" : "Off"; } } } \ No newline at end of file diff --git a/DCS-SR-Client/UI/ClientWindow/SettingPages/SettingsPage.xaml b/DCS-SR-Client/UI/ClientWindow/SettingPages/SettingsPage.xaml index e5934fcc..d804d6cc 100644 --- a/DCS-SR-Client/UI/ClientWindow/SettingPages/SettingsPage.xaml +++ b/DCS-SR-Client/UI/ClientWindow/SettingPages/SettingsPage.xaml @@ -41,6 +41,7 @@ HorizontalAlignment="Center" Margin="0,-10,0,0" /> + + +