diff --git a/WHMapper/Hubs/IWHMapperNotificationHub.cs b/WHMapper/Hubs/IWHMapperNotificationHub.cs index 77670d3f..774d8a03 100644 --- a/WHMapper/Hubs/IWHMapperNotificationHub.cs +++ b/WHMapper/Hubs/IWHMapperNotificationHub.cs @@ -16,7 +16,7 @@ public interface IWHMapperNotificationHub Task NotifyUsersPosition(IDictionary connectedUsersPosition); Task NotifyWormoleMoved(string userName, int mapId, int wormholeId,double posx,double posy); Task NotifyLinkChanged(string username,int mapId, int linkId, bool eol, SystemLinkSize size, SystemLinkMassStatus mass); - Task NotifyWormholeNameExtensionChanged(string username, int mapId, int wormholeId); + Task NotifyWormholeNameExtensionChanged(string username, int mapId, int wormholeId,bool increment); Task NotifyWormholeSignaturesChanged(string username, int mapId, int wormholeId); Task NotifyWormholeLockChanged(string username, int mapId, int wormholeId, bool locked); } diff --git a/WHMapper/Hubs/WHMapperNotificationHub.cs b/WHMapper/Hubs/WHMapperNotificationHub.cs index e9835a82..53383813 100644 --- a/WHMapper/Hubs/WHMapperNotificationHub.cs +++ b/WHMapper/Hubs/WHMapperNotificationHub.cs @@ -143,12 +143,12 @@ public async Task SendLinkChanged(int mapId, int linkId, bool eol, SystemLinkSiz } } - public async Task SendWormholeNameExtensionChanged(int mapId, int wowrmholeId) + public async Task SendWormholeNameExtensionChanged(int mapId, int wowrmholeId,bool increment) { string userName = CurrentUser(); if (!string.IsNullOrEmpty(userName)) { - await Clients.AllExcept(Context.ConnectionId).NotifyWormholeNameExtensionChanged(userName, mapId, wowrmholeId); + await Clients.AllExcept(Context.ConnectionId).NotifyWormholeNameExtensionChanged(userName, mapId, wowrmholeId,increment); } } diff --git a/WHMapper/Pages/Mapper/Overview.cs b/WHMapper/Pages/Mapper/Overview.cs index ddfcacab..2f5d9c9e 100644 --- a/WHMapper/Pages/Mapper/Overview.cs +++ b/WHMapper/Pages/Mapper/Overview.cs @@ -406,7 +406,7 @@ await Parallel.ForEachAsync(usersPosition, async (item, cancellationToken) => } }); - _hubConnection.On("NotifyWormholeNameExtensionChanged", async (user, mapId, wormholeId) => + _hubConnection.On("NotifyWormholeNameExtensionChanged", async (user, mapId, wormholeId,increment) => { try { @@ -415,7 +415,14 @@ await Parallel.ForEachAsync(usersPosition, async (item, cancellationToken) => _selectedWHMap = await DbWHMaps.GetById(mapId); EveSystemNodeModel systemToIncrementNameExtenstion = (EveSystemNodeModel)Diagram?.Nodes?.FirstOrDefault(x => ((EveSystemNodeModel)x).IdWH == wormholeId); if (systemToIncrementNameExtenstion != null) + { + if (increment) + systemToIncrementNameExtenstion.IncrementNameExtension(); + else + systemToIncrementNameExtenstion.DecrementNameExtension(); + systemToIncrementNameExtenstion.Refresh(); + } } } catch (Exception ex) @@ -538,11 +545,11 @@ private async Task NotifyLinkChanged(int mapId,int linkId, bool eol, SystemLinkS } } - private async Task NotifyWormholeNameExtensionChanged(int mapId, int wormholeId) + private async Task NotifyWormholeNameExtensionChanged(int mapId, int wormholeId,bool increment) { if (_hubConnection is not null) { - await _hubConnection.SendAsync("SendWormholeNameExtensionChanged", mapId, wormholeId); + await _hubConnection.SendAsync("SendWormholeNameExtensionChanged", mapId, wormholeId, increment); } } @@ -1065,7 +1072,7 @@ private async Task IncrementOrDecrementNodeExtensionNameOnMap(WHMap map, E if (wh != null) { - await NotifyWormholeNameExtensionChanged(map.Id, wh.Id); + await NotifyWormholeNameExtensionChanged(map.Id, wh.Id, increment); return true; } }