diff --git a/CBSVisualizer/CBSVisualizer.Common/CBSVisualizer.Common.csproj b/CBSVisualizer/CBSVisualizer.Common/CBSVisualizer.Common.csproj new file mode 100644 index 0000000000000000000000000000000000000000..0a54f5c125fcbddf06297b66416c5f9e64c0eefc --- /dev/null +++ b/CBSVisualizer/CBSVisualizer.Common/CBSVisualizer.Common.csproj @@ -0,0 +1,11 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>net5.0</TargetFramework> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="Prism.Core" Version="7.2.0.1422" /> + </ItemGroup> + +</Project> diff --git a/CBSVisualizer/CBSVisualizer.Common/ValueContainer.cs b/CBSVisualizer/CBSVisualizer.Common/ValueContainer.cs new file mode 100644 index 0000000000000000000000000000000000000000..107917b7f84df802ccb8f165a5826d7b407d4599 --- /dev/null +++ b/CBSVisualizer/CBSVisualizer.Common/ValueContainer.cs @@ -0,0 +1,28 @@ +using Prism.Mvvm; +using System; + +namespace CBSVisualizer.Common +{ + public class ValueContainer<T> : BindableBase where T : struct + { + + private T val; + public T Value + { + get + { + return val; + } + + set + { + SetProperty(ref val, value); + } + } + + public ValueContainer(T defaultValue) + { + Value = defaultValue; + } + } +} diff --git a/CBSVisualizer/CBSVisualizer.Core/RegionNames.cs b/CBSVisualizer/CBSVisualizer.Core/RegionNames.cs index 955549cfa30e0d7bcb414b7db2caa81350993014..4c12cfccee4734569196cc0fd19d5d59113dba12 100644 --- a/CBSVisualizer/CBSVisualizer.Core/RegionNames.cs +++ b/CBSVisualizer/CBSVisualizer.Core/RegionNames.cs @@ -3,7 +3,6 @@ public static class RegionNames { public const string MenuBarRegion = "MenuBar"; - public const string LoadGeneratorRegion = "LoadGenerator"; public const string QueueGroupRegion = "QueueGroup"; public const string LinkRegion = "Link"; } diff --git a/CBSVisualizer/CBSVisualizer.LoadGenerator/CBSVisualizer.Modules.LoadGenerator.csproj b/CBSVisualizer/CBSVisualizer.LoadGenerator/CBSVisualizer.Modules.LoadGenerator.csproj deleted file mode 100644 index 48267d31341f7bdf1c38ef8a8864b67043ef78db..0000000000000000000000000000000000000000 --- a/CBSVisualizer/CBSVisualizer.LoadGenerator/CBSVisualizer.Modules.LoadGenerator.csproj +++ /dev/null @@ -1,15 +0,0 @@ -<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> - <PropertyGroup> - <TargetFramework>net5.0</TargetFramework> - <UseWPF>true</UseWPF> - <AssemblyName>CBSVisualizer.LoadGenerator</AssemblyName> - </PropertyGroup> - <ItemGroup> - <PackageReference Include="Prism.Wpf" Version="7.2.0.1422" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\CBSVisualizer.Core\CBSVisualizer.Core.csproj" /> - <ProjectReference Include="..\CBSVisualizer.MessagingCore\CBSVisualizer.Messaging.csproj" /> - <ProjectReference Include="..\CBSVisualizer\CBSVisualizer.Core\CBSVisualizer.Core.csproj" /> - </ItemGroup> -</Project> \ No newline at end of file diff --git a/CBSVisualizer/CBSVisualizer.LoadGenerator/LoadGeneratorModule.cs b/CBSVisualizer/CBSVisualizer.LoadGenerator/LoadGeneratorModule.cs deleted file mode 100644 index 624c42c8ba42b9a1eb9c5e4007c59b80691d4ed1..0000000000000000000000000000000000000000 --- a/CBSVisualizer/CBSVisualizer.LoadGenerator/LoadGeneratorModule.cs +++ /dev/null @@ -1,28 +0,0 @@ -using CBSVisualizer.Core; -using Prism.Ioc; -using Prism.Modularity; -using Prism.Regions; - -namespace CBSVisualizer.LoadGenerator -{ - public class LoadGeneratorModule : IModule - { - IRegionManager regionManager; - - public LoadGeneratorModule(IRegionManager regionManager) - { - this.regionManager = regionManager; - } - - public void OnInitialized(IContainerProvider containerProvider) - { - regionManager.RequestNavigate(RegionNames.LoadGeneratorRegion, "LoadGenerator"); - - } - - public void RegisterTypes(IContainerRegistry containerRegistry) - { - containerRegistry.RegisterForNavigation<Views.LoadGenerator>(); - } - } -} \ No newline at end of file diff --git a/CBSVisualizer/CBSVisualizer.LoadGenerator/Views/LoadGenerator.xaml b/CBSVisualizer/CBSVisualizer.LoadGenerator/Views/LoadGenerator.xaml deleted file mode 100644 index 13b1e9d283b4bbd0b2125418f8cb25a55479dd1f..0000000000000000000000000000000000000000 --- a/CBSVisualizer/CBSVisualizer.LoadGenerator/Views/LoadGenerator.xaml +++ /dev/null @@ -1,27 +0,0 @@ -<UserControl x:Class="CBSVisualizer.LoadGenerator.Views.LoadGenerator" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:local="clr-namespace:CBSVisualizer.LoadGenerator.Views" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300" - xmlns:prism="http://prismlibrary.com/" - prism:ViewModelLocator.AutoWireViewModel="True" > - <Grid> - <Grid.RowDefinitions> - <RowDefinition Height="Auto"/> - <RowDefinition Height="*"/> - <RowDefinition Height="*"/> - </Grid.RowDefinitions> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="*"/> - </Grid.ColumnDefinitions> - <GroupBox Grid.Row="0" Grid.Column="0" Header="Packet Inter-Arrival Time [ms]"> - <TextBox Text="{Binding GenerationSleepTime}" TextAlignment="Center" VerticalAlignment="Center"/> - </GroupBox> - <Button Grid.Row="1" Content="Start Load Generation" Command="{Binding StartLoadGeneration}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/> - <Button Grid.Row="2" Content="Stop Load Generation" Command="{Binding StopLoadGeneration}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/> - - </Grid> -</UserControl> diff --git a/CBSVisualizer/CBSVisualizer.LoadGenerator/Views/LoadGenerator.xaml.cs b/CBSVisualizer/CBSVisualizer.LoadGenerator/Views/LoadGenerator.xaml.cs deleted file mode 100644 index dcabaefa45dedbb2c8246b729d922a134f1ee65a..0000000000000000000000000000000000000000 --- a/CBSVisualizer/CBSVisualizer.LoadGenerator/Views/LoadGenerator.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace CBSVisualizer.LoadGenerator.Views -{ - /// <summary> - /// Interaction logic for ViewA.xaml - /// </summary> - public partial class LoadGenerator : UserControl - { - public LoadGenerator() - { - InitializeComponent(); - } - } -} diff --git a/CBSVisualizer/CBSVisualizer.MessagingCore/Events/GateClosedEvent.cs b/CBSVisualizer/CBSVisualizer.MessagingCore/Events/GateClosedEvent.cs deleted file mode 100644 index e132c1125c86ef12139936e294912271459573a7..0000000000000000000000000000000000000000 --- a/CBSVisualizer/CBSVisualizer.MessagingCore/Events/GateClosedEvent.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Prism.Events; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CBSVisualizer.Messaging.Events -{ - public class GateClosedEvent : PubSubEvent - { - } -} diff --git a/CBSVisualizer/CBSVisualizer.MessagingCore/Events/GateOpenedEvent.cs b/CBSVisualizer/CBSVisualizer.MessagingCore/Events/GateOpenedEvent.cs index 1cdd306b9958164f6f3ae6546c3456c37dfce081..ea1eb9caad572c450e945fa2a3c7aa585d25df84 100644 --- a/CBSVisualizer/CBSVisualizer.MessagingCore/Events/GateOpenedEvent.cs +++ b/CBSVisualizer/CBSVisualizer.MessagingCore/Events/GateOpenedEvent.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace CBSVisualizer.Messaging.Events { - public class GateOpenedEvent : PubSubEvent + public class GateOpenedEvent : PubSubEvent<(int OpenedTime, ISet<int> OpenedGates)> { } } diff --git a/CBSVisualizer/CBSVisualizer.MessagingCore/Events/RegisterLinkCallbackEvent.cs b/CBSVisualizer/CBSVisualizer.MessagingCore/Events/RegisterLinkCallbackEvent.cs index 4685ffb7600c929f89075a8775b69745ee5b01c3..d564aeff17a96421cfee4930e1176b290863aa6d 100644 --- a/CBSVisualizer/CBSVisualizer.MessagingCore/Events/RegisterLinkCallbackEvent.cs +++ b/CBSVisualizer/CBSVisualizer.MessagingCore/Events/RegisterLinkCallbackEvent.cs @@ -64,8 +64,7 @@ namespace CBSVisualizer.Messaging.Events /// <summary> /// Called when the transmission of the last packet has been completed. /// </summary> - /// <param name="trySubmitNextPacket">Callback that can be used to send another packet.</param> - Task TransmissionCompleted(Func<PriorityPacket, PacketSubmitResult> trySubmitNextPacket); + Task TransmissionCompleted(); } /// <summary> diff --git a/CBSVisualizer/CBSVisualizer.MessagingCore/Models/PriorityPacket.cs b/CBSVisualizer/CBSVisualizer.MessagingCore/Models/PriorityPacket.cs index a25eb03e4674b4ec30e34515d87be36067fc3131..00be8928b070a3d86a160b8b25a52ac46c5a4082 100644 --- a/CBSVisualizer/CBSVisualizer.MessagingCore/Models/PriorityPacket.cs +++ b/CBSVisualizer/CBSVisualizer.MessagingCore/Models/PriorityPacket.cs @@ -34,6 +34,14 @@ namespace CBSVisualizer.Messaging */ public int TrailerBytes { get; private set; } + public int Size + { + get + { + return PayloadBytes + HeaderBytes + TrailerBytes; + } + } + /// <summary> /// Constructs a new PriorityPacket. /// </summary> @@ -62,11 +70,6 @@ namespace CBSVisualizer.Messaging TrailerBytes = PREEMPTION_TRAILER_SIZE_BYTES; } - public int GetSize() - { - return PayloadBytes + HeaderBytes + TrailerBytes; - } - public override string ToString() { return $"Priority: {Priority}, Header Size: {HeaderBytes}, Payload Bytes: {PayloadBytes}, Trailer Bytes: {TrailerBytes}"; diff --git a/CBSVisualizer/CBSVisualizer.Modules.Link/CBSVisualizer.Modules.Link.csproj b/CBSVisualizer/CBSVisualizer.Modules.Link/CBSVisualizer.Modules.Link.csproj index 01fd42a832439a296420bce55e0433dfd9cf3599..b2c95d52a51c534748ffa16108063907b32f1d6b 100644 --- a/CBSVisualizer/CBSVisualizer.Modules.Link/CBSVisualizer.Modules.Link.csproj +++ b/CBSVisualizer/CBSVisualizer.Modules.Link/CBSVisualizer.Modules.Link.csproj @@ -9,6 +9,7 @@ <PackageReference Include="Prism.Wpf" Version="7.2.0.1422" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\CBSVisualizer.Common\CBSVisualizer.Common.csproj" /> <ProjectReference Include="..\CBSVisualizer.Core\CBSVisualizer.Core.csproj" /> <ProjectReference Include="..\CBSVisualizer.MessagingCore\CBSVisualizer.Messaging.csproj" /> <ProjectReference Include="..\CBSVisualizer.Services.SchedulingService\CBSVisualizer.Services.SchedulingService.csproj" /> diff --git a/CBSVisualizer/CBSVisualizer.Modules.Link/ViewModels/LinkViewModel.cs b/CBSVisualizer/CBSVisualizer.Modules.Link/ViewModels/LinkViewModel.cs index aa5245cf68fffa80b9414185e985855db09be5ff..d2902db2d12e5060f8f2854538ae566e225ce449 100644 --- a/CBSVisualizer/CBSVisualizer.Modules.Link/ViewModels/LinkViewModel.cs +++ b/CBSVisualizer/CBSVisualizer.Modules.Link/ViewModels/LinkViewModel.cs @@ -1,30 +1,61 @@ -using CBSVisualizer.Core.Mvvm; +using CBSVisualizer.Common; +using CBSVisualizer.Core.Mvvm; +using CBSVisualizer.Messaging; using CBSVisualizer.Messaging.Events; using CBSVisualizer.Services.SchedulingService; +using CBSVisualizer.Services.SettingsService.Service; using log4net; using Prism.Events; using Prism.Regions; -using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; namespace CBSVisualizer.Modules.Link.ViewModels { public class LinkViewModel : RegionViewModelBase { - private ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private const int REFRESH_TIME_MS = 20; - public ObservableConcurrentDictionary<int, bool> GateStatusDictionary { get; } = new ObservableConcurrentDictionary<int, bool>(); + private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + + public ObservableConcurrentDictionary<int, ValueContainer<bool>> GateStatusDictionary { get; } = new ObservableConcurrentDictionary<int, ValueContainer<bool>>(); private IDictionary<int, ILinkCallback> linkCallbacks = new Dictionary<int, ILinkCallback>(); private ISchedulingService scheduler; - public LinkViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, ISchedulingService schedulingService) + private SettingService settingService; + + private CancellationTokenSource tokenSource; + + private Task packetTransmissionTask; + + /// <summary> + /// The queue that is currently sending. + /// </summary> + private int activeQueue; + + /// <summary> + /// The packet that is currently being sent. + /// </summary> + private PriorityPacket packetInTransit = PriorityPacket.NoPacket; + + /// <summary> + /// The bytes that have been transmitted from the packet in transit. + /// </summary> + private int transmittedBytes; + + + public LinkViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, ISchedulingService schedulingService, SettingService setting) : base(regionManager) { scheduler = schedulingService; + settingService = setting; + InitializeDictionary(); eventAggregator.GetEvent<RegisterLinkCallbackEvent>().Subscribe(callback => @@ -48,36 +79,182 @@ namespace CBSVisualizer.Modules.Link.ViewModels eventAggregator.GetEvent<SimulationStoppedEvent>().Subscribe(async () => { + // Stop the scheduler await scheduler.StopScheduling(); + // Stop packet sending. + tokenSource?.Cancel(); + if (packetTransmissionTask != null) + { + try + { + await packetTransmissionTask; + } catch (TaskCanceledException) { } + + } + + // Reset all gate status lamps. + SetStatusLamps(new HashSet<int>()); + log.Info("Simulation stopped"); }); - eventAggregator.GetEvent<GateOpenedEvent>().Subscribe(HandleGateOpened); - eventAggregator.GetEvent<GateClosedEvent>().Subscribe(HandleGateClosed); + eventAggregator.GetEvent<GateOpenedEvent>().Subscribe(async (tuple) => + { + log.Info($"The gates [{string.Join(", ", tuple.OpenedGates)}] have been opened for {tuple.OpenedTime} ms."); + + try + { + await HandleGateOpened(tuple); + } catch (TaskCanceledException) + { + // TODO: Think about what to do here. + } + }); } - private void HandleGateClosed() + private async Task HandleGateOpened((int OpenedTime, ISet<int> OpenedGates) infoTuple) { - // TODO: IMPLEMENT. + // Cancel old sending task. + tokenSource?.Cancel(); + if (packetTransmissionTask != null) + { + try + { + await packetTransmissionTask; + } + catch (TaskCanceledException) { } + + } + + packetInTransit = PriorityPacket.NoPacket; + + // Set the status lamps accordingly. + SetStatusLamps(infoTuple.OpenedGates); + + // Close all un-opened gates. + CloseInactiveGates(infoTuple.OpenedGates); + + // Handle transmission. + tokenSource = new CancellationTokenSource(); + packetTransmissionTask = TransmitPackets(infoTuple); + } + + /// <summary> + /// Transmit packets, notify queues about successful transmissions and get the next packet. + /// </summary> + private async Task TransmitPackets((int OpenedTime, ISet<int> OpenedGates) infoTuple) + { + await Task.Run(async () => + { + while (!tokenSource.IsCancellationRequested) + { + // Scan the callbacks for the highest-prio queue that wants to send a packet. + foreach (var queue in infoTuple.OpenedGates.OrderByDescending(gate => gate)) + { + await linkCallbacks[queue].GateOpened(packet => + { + if (packetInTransit == PriorityPacket.NoPacket) + { + if (CanSendInTime(infoTuple.OpenedTime, packet)) + { + activeQueue = queue; + packetInTransit = packet; + return PacketSubmitResult.Accepted; + } + else + { + return PacketSubmitResult.DeniedPreClosing; + } + } + else + { + return PacketSubmitResult.DeniedHigherPrio; + } + }); + } + + // Skip the loop if no packet was submitted. + if (packetInTransit == PriorityPacket.NoPacket) + { + continue; + } + + log.Info($"Packet {packetInTransit} of queue {activeQueue} has been scheduled for transit."); + + // Once a packet was selected for transmission, we send it. + transmittedBytes = 0; + var bitrate = settingService.GetSettingValue<int>("bitrate"); + + await linkCallbacks[activeQueue].TransmissionStarted(bitrate); + while (!tokenSource.IsCancellationRequested && transmittedBytes < packetInTransit.Size) + { + await Task.Delay(REFRESH_TIME_MS, tokenSource.Token); + transmittedBytes += REFRESH_TIME_MS * (bitrate / 1000); + log.Info($"Transmitted {transmittedBytes} of {packetInTransit.Size} bytes of packet {packetInTransit}."); + } + + if (transmittedBytes >= packetInTransit.Size) + { + await linkCallbacks[activeQueue].TransmissionCompleted(); + log.Info($"{packetInTransit} of queue {activeQueue} has been sent successfully."); + } + + // Reset the "Packet in transit" pointer. + packetInTransit = PriorityPacket.NoPacket; + } + }, tokenSource.Token); } - private void HandleGateOpened() + private bool CanSendInTime(int openedTime, PriorityPacket packet) { - // TODO: IMPLEMENT. + // Bitrate * time = bits we can send in that time. + // if the packet is larger than that, we have to deny it due to pre-closing. + return packet.Size <= openedTime * (settingService.GetSettingValue<int>("bitrate") / 1000); + } + + private void CloseInactiveGates(ISet<int> openedGates) + { + ISet<int> gatesToClose = new HashSet<int>(linkCallbacks.Keys); + gatesToClose.ExceptWith(openedGates); + + // Notify the queues that were opened before that they are closed now. + foreach (var gate in gatesToClose) + { + linkCallbacks[gate].GateClosed(); + } + } + + /// <summary> + /// Sets the status lamps according to the set. + /// </summary> + /// <param name="openedGates">the set containing the opened gates</param> + private void SetStatusLamps(ISet<int> openedGates) + { + foreach (var key in GateStatusDictionary.Keys) + { + if (openedGates.Contains(key)) + { + GateStatusDictionary[key].Value = true; + } + else + { + GateStatusDictionary[key].Value = false; + } + } } private void InitializeDictionary() { - GateStatusDictionary.Add(0, false); - GateStatusDictionary.Add(1, false); - GateStatusDictionary.Add(2, false); - GateStatusDictionary.Add(3, false); - GateStatusDictionary.Add(4, false); - GateStatusDictionary.Add(5, false); - GateStatusDictionary.Add(6, false); - GateStatusDictionary.Add(7, false); + GateStatusDictionary.Add(0, new ValueContainer<bool>(false)); + GateStatusDictionary.Add(1, new ValueContainer<bool>(false)); + GateStatusDictionary.Add(2, new ValueContainer<bool>(false)); + GateStatusDictionary.Add(3, new ValueContainer<bool>(false)); + GateStatusDictionary.Add(4, new ValueContainer<bool>(false)); + GateStatusDictionary.Add(5, new ValueContainer<bool>(false)); + GateStatusDictionary.Add(6, new ValueContainer<bool>(false)); + GateStatusDictionary.Add(7, new ValueContainer<bool>(false)); } } } \ No newline at end of file diff --git a/CBSVisualizer/CBSVisualizer.Modules.Link/Views/Link.xaml b/CBSVisualizer/CBSVisualizer.Modules.Link/Views/Link.xaml index 8ce63b481520356d3e014a4c589d98448ce040bd..055371c4049cbbef3f6fe27cdd7a5a199ac1dbe8 100644 --- a/CBSVisualizer/CBSVisualizer.Modules.Link/Views/Link.xaml +++ b/CBSVisualizer/CBSVisualizer.Modules.Link/Views/Link.xaml @@ -25,13 +25,13 @@ <RowDefinition Height="*"/> </Grid.RowDefinitions> <TextBlock Text="Gate Status" Grid.Row="0" TextAlignment="Center"/> - <Image Grid.Row="1" HorizontalAlignment="Center" Source="{Binding GateStatusDictionary[0], Converter={StaticResource BoolToImageConv}}"/> - <Image Grid.Row="2" HorizontalAlignment="Center" Source="{Binding GateStatusDictionary[1], Converter={StaticResource BoolToImageConv}}"/> - <Image Grid.Row="3" HorizontalAlignment="Center" Source="{Binding GateStatusDictionary[2], Converter={StaticResource BoolToImageConv}}"/> - <Image Grid.Row="4" HorizontalAlignment="Center" Source="{Binding GateStatusDictionary[3], Converter={StaticResource BoolToImageConv}}"/> - <Image Grid.Row="5" HorizontalAlignment="Center" Source="{Binding GateStatusDictionary[4], Converter={StaticResource BoolToImageConv}}"/> - <Image Grid.Row="6" HorizontalAlignment="Center" Source="{Binding GateStatusDictionary[5], Converter={StaticResource BoolToImageConv}}"/> - <Image Grid.Row="7" HorizontalAlignment="Center" Source="{Binding GateStatusDictionary[6], Converter={StaticResource BoolToImageConv}}"/> - <Image Grid.Row="8" HorizontalAlignment="Center" Source="{Binding GateStatusDictionary[7], Converter={StaticResource BoolToImageConv}}"/> + <Image Grid.Row="1" HorizontalAlignment="Center" Source="{Binding GateStatusDictionary[7].Value, Converter={StaticResource BoolToImageConv}}"/> + <Image Grid.Row="2" HorizontalAlignment="Center" Source="{Binding GateStatusDictionary[6].Value, Converter={StaticResource BoolToImageConv}}"/> + <Image Grid.Row="3" HorizontalAlignment="Center" Source="{Binding GateStatusDictionary[5].Value, Converter={StaticResource BoolToImageConv}}"/> + <Image Grid.Row="4" HorizontalAlignment="Center" Source="{Binding GateStatusDictionary[4].Value, Converter={StaticResource BoolToImageConv}}"/> + <Image Grid.Row="5" HorizontalAlignment="Center" Source="{Binding GateStatusDictionary[3].Value, Converter={StaticResource BoolToImageConv}}"/> + <Image Grid.Row="6" HorizontalAlignment="Center" Source="{Binding GateStatusDictionary[2].Value, Converter={StaticResource BoolToImageConv}}"/> + <Image Grid.Row="7" HorizontalAlignment="Center" Source="{Binding GateStatusDictionary[1].Value, Converter={StaticResource BoolToImageConv}}"/> + <Image Grid.Row="8" HorizontalAlignment="Center" Source="{Binding GateStatusDictionary[0].Value, Converter={StaticResource BoolToImageConv}}"/> </Grid> </UserControl> diff --git a/CBSVisualizer/CBSVisualizer.Modules.MenuBar/CBSVisualizer.Modules.MenuBar.csproj b/CBSVisualizer/CBSVisualizer.Modules.MenuBar/CBSVisualizer.Modules.MenuBar.csproj index f50274e7dbe0b478036e3f1a10c93cd701626481..39e03638e215fb849b25f178cc4bebe984ad3f6c 100644 --- a/CBSVisualizer/CBSVisualizer.Modules.MenuBar/CBSVisualizer.Modules.MenuBar.csproj +++ b/CBSVisualizer/CBSVisualizer.Modules.MenuBar/CBSVisualizer.Modules.MenuBar.csproj @@ -10,6 +10,7 @@ <ItemGroup> <ProjectReference Include="..\CBSVisualizer.Core\CBSVisualizer.Core.csproj" /> <ProjectReference Include="..\CBSVisualizer.MessagingCore\CBSVisualizer.Messaging.csproj" /> + <ProjectReference Include="..\CBSVisualizer.Services.SettingsService\CBSVisualizer.Services.SettingService.csproj" /> <ProjectReference Include="..\CBSVisualizer\CBSVisualizer.Core\CBSVisualizer.Core.csproj" /> </ItemGroup> </Project> \ No newline at end of file diff --git a/CBSVisualizer/CBSVisualizer.LoadGenerator/ViewModels/LoadGeneratorViewModel.cs b/CBSVisualizer/CBSVisualizer.Modules.MenuBar/ViewModels/MenuBarViewModel.LoadGeneration.cs similarity index 63% rename from CBSVisualizer/CBSVisualizer.LoadGenerator/ViewModels/LoadGeneratorViewModel.cs rename to CBSVisualizer/CBSVisualizer.Modules.MenuBar/ViewModels/MenuBarViewModel.LoadGeneration.cs index c84d414213787cd8cc3b119302a3541433a64839..8e09473b30c099ab94b1006e232a723ce6ab7385 100644 --- a/CBSVisualizer/CBSVisualizer.LoadGenerator/ViewModels/LoadGeneratorViewModel.cs +++ b/CBSVisualizer/CBSVisualizer.Modules.MenuBar/ViewModels/MenuBarViewModel.LoadGeneration.cs @@ -1,26 +1,19 @@ -using CBSVisualizer.Core.Mvvm; -using CBSVisualizer.Messaging; +using CBSVisualizer.Messaging; using CBSVisualizer.Messaging.Events; using log4net; using Prism.Commands; -using Prism.Events; -using Prism.Logging; -using Prism.Mvvm; -using Prism.Regions; using System; -using System.CodeDom; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; -namespace CBSVisualizer.LoadGenerator.ViewModels +namespace CBSVisualizer.Modules.MenuBar.ViewModels { - public class LoadGeneratorViewModel : RegionViewModelBase + public partial class MenuBarViewModel { - private ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public DelegateCommand StartLoadGeneration { get; private set; } @@ -40,30 +33,14 @@ namespace CBSVisualizer.LoadGenerator.ViewModels } } - /// <summary> - /// The sleep time between the generation of two packets. - /// </summary> - public int GenerationSleepTime { get; set; } = 500; - private const int HEADER_BYTES = 100; private const int TRAILER_BYTES = 100; private CancellationTokenSource tokenSource = new CancellationTokenSource(); - private readonly IEventAggregator eventAggregator; - private readonly Random random = new Random(); - public LoadGeneratorViewModel(IRegionManager regionManager, IEventAggregator eventAggr) - : base(regionManager) - { - eventAggregator = eventAggr; - - StartLoadGeneration = new DelegateCommand(async () => await StartLoadThread(), CanStartLoadGeneration).ObservesProperty(() => LoadGenerationInProgress); - StopLoadGeneration = new DelegateCommand(StopLoadThread, CanStopLoadGeneration).ObservesProperty(() => LoadGenerationInProgress); - } - private bool CanStartLoadGeneration() { return !LoadGenerationInProgress; @@ -89,7 +66,7 @@ namespace CBSVisualizer.LoadGenerator.ViewModels while (!tokenSource.IsCancellationRequested) { eventAggregator.GetEvent<PacketArrivedEvent>().Publish(GenerateRandomPacket()); - await Task.Delay(GenerationSleepTime); + await Task.Delay(settings.GetSettingValue<int>("interarrival_time")); log.Info($"I've generated {++packetCount} packets"); } diff --git a/CBSVisualizer/CBSVisualizer.Modules.MenuBar/ViewModels/MenuBarViewModel.cs b/CBSVisualizer/CBSVisualizer.Modules.MenuBar/ViewModels/MenuBarViewModel.cs index e40057e999fe242263d2b2e041efdbe585d36928..eb681718a4caff2132775f090e0eb2f2ef0574bd 100644 --- a/CBSVisualizer/CBSVisualizer.Modules.MenuBar/ViewModels/MenuBarViewModel.cs +++ b/CBSVisualizer/CBSVisualizer.Modules.MenuBar/ViewModels/MenuBarViewModel.cs @@ -1,5 +1,6 @@ using CBSVisualizer.Core.Mvvm; using CBSVisualizer.Messaging.Events; +using CBSVisualizer.Services.SettingsService.Service; using Prism.Commands; using Prism.Events; using Prism.Mvvm; @@ -13,7 +14,7 @@ using System.Threading.Tasks; namespace CBSVisualizer.Modules.MenuBar.ViewModels { - public class MenuBarViewModel : RegionViewModelBase + public partial class MenuBarViewModel : RegionViewModelBase { private bool simulationRunning = false; private bool SimulationRunning @@ -37,13 +38,21 @@ namespace CBSVisualizer.Modules.MenuBar.ViewModels private readonly IEventAggregator eventAggregator; - public MenuBarViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, IDialogService dialogService) + private readonly SettingService settings; + + + public MenuBarViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, IDialogService dialogService, SettingService settingService) : base(regionManager) { this.eventAggregator = eventAggregator; + settings = settingService; + StartSimulationCommand = new DelegateCommand(SignalSimulationStart, () => !SimulationRunning).ObservesProperty(() => SimulationRunning); StopSimulationCommand = new DelegateCommand(SignalSimulationStop).ObservesCanExecute(() => SimulationRunning); OpenSettingsCommand = new DelegateCommand(() => dialogService.Show("SettingsDialog", new DialogParameters(), result => { })); + + StartLoadGeneration = new DelegateCommand(async () => await StartLoadThread(), CanStartLoadGeneration).ObservesProperty(() => LoadGenerationInProgress); + StopLoadGeneration = new DelegateCommand(StopLoadThread, CanStopLoadGeneration).ObservesProperty(() => LoadGenerationInProgress); } private void SignalSimulationStart() { diff --git a/CBSVisualizer/CBSVisualizer.Modules.MenuBar/Views/MenuBar.xaml b/CBSVisualizer/CBSVisualizer.Modules.MenuBar/Views/MenuBar.xaml index 1565fd9b860048bc1f28ea9e3e8d414a02acd236..0a0c6062cd70e671e137b892b12a8977e29b27a3 100644 --- a/CBSVisualizer/CBSVisualizer.Modules.MenuBar/Views/MenuBar.xaml +++ b/CBSVisualizer/CBSVisualizer.Modules.MenuBar/Views/MenuBar.xaml @@ -13,7 +13,10 @@ <MenuItem Header="_Start" Command="{Binding StartSimulationCommand}"/> <MenuItem Header="_Terminate" Command="{Binding StopSimulationCommand}"/> </MenuItem> - <MenuItem Header="_Settings" Command="{Binding OpenSettingsCommand}"> + <MenuItem Header="_Settings" Command="{Binding OpenSettingsCommand}"/> + <MenuItem Header="_Load Generation"> + <MenuItem Header="_Start Load Generation" Command="{Binding StartLoadGeneration}"/> + <MenuItem Header="_Terminate Load Generation" Command="{Binding StopLoadGeneration}"/> </MenuItem> </Menu> </UserControl> diff --git a/CBSVisualizer/CBSVisualizer.Modules.Queue.QueueGroup/Views/QueueGroup.xaml.cs b/CBSVisualizer/CBSVisualizer.Modules.Queue.QueueGroup/Views/QueueGroup.xaml.cs index ee561228f179b0243a7992d2553957c02fcf26e8..310039936710875663a3eddf4bb5e33ed2075989 100644 --- a/CBSVisualizer/CBSVisualizer.Modules.Queue.QueueGroup/Views/QueueGroup.xaml.cs +++ b/CBSVisualizer/CBSVisualizer.Modules.Queue.QueueGroup/Views/QueueGroup.xaml.cs @@ -30,7 +30,7 @@ namespace CBSVisualizer.Modules.Queue.QueueGroup.Views for (int prio = 1; prio < 9; prio++) { Queue.Views.Queue newQueue = new Queue.Views.Queue(new QueueViewModel(regionManager, eventAggregator, prio - 1)); - Grid.SetRow(newQueue, prio); + Grid.SetRow(newQueue, 9 - prio); Grid.SetColumnSpan(newQueue, 4); Grid.Children.Add(newQueue); } diff --git a/CBSVisualizer/CBSVisualizer.Modules.Queue/ViewModels/QueueViewModel.LinkCallbacks.cs b/CBSVisualizer/CBSVisualizer.Modules.Queue/ViewModels/QueueViewModel.LinkCallbacks.cs index 4adc7eb58753bf207944f1311dcd20c5f5fbed25..5658c4ba2bff5887aad816957b50a531bf2528c4 100644 --- a/CBSVisualizer/CBSVisualizer.Modules.Queue/ViewModels/QueueViewModel.LinkCallbacks.cs +++ b/CBSVisualizer/CBSVisualizer.Modules.Queue/ViewModels/QueueViewModel.LinkCallbacks.cs @@ -1,10 +1,8 @@ using CBSVisualizer.Messaging; using CBSVisualizer.Messaging.Events; using System; -using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using System.Text; using System.Threading.Tasks; namespace CBSVisualizer.Modules.Queue.ViewModels @@ -50,7 +48,7 @@ namespace CBSVisualizer.Modules.Queue.ViewModels public abstract Task PacketPreempted(PriorityPacket preemptedPacket, int leftoverBytes); - public abstract Task TransmissionCompleted(Func<PriorityPacket, PacketSubmitResult> trySubmitNextPacket); + public abstract Task TransmissionCompleted(); public abstract Task TransmissionStarted(double bytesPerSecondRate); } @@ -102,10 +100,8 @@ namespace CBSVisualizer.Modules.Queue.ViewModels } } - public override Task TransmissionCompleted(Func<PriorityPacket, PacketSubmitResult> trySubmitNextPacket) + public override Task TransmissionCompleted() { - // If the transmission completed, just do the same as when the gate has opened. - GateOpened(trySubmitNextPacket); return Task.CompletedTask; } @@ -158,7 +154,7 @@ namespace CBSVisualizer.Modules.Queue.ViewModels // If my packet was denied due to pre-closing, freeze my credit. } else if (submitResult == PacketSubmitResult.DeniedPreClosing) { - parent.StopCreditThread(); + _ = parent.StopCreditThread(); } } @@ -177,14 +173,11 @@ namespace CBSVisualizer.Modules.Queue.ViewModels return Task.CompletedTask; } - public override async Task TransmissionCompleted(Func<PriorityPacket, PacketSubmitResult> trySubmitNextPacket) + public override async Task TransmissionCompleted() { // Stop and restart the credit thread. await parent.StopCreditThread(); await parent.StartCreditThread(parent.IdleSlope); - - // Try to submit another packet. - await GateOpened(trySubmitNextPacket); } public override async Task TransmissionStarted(double bytesPerSecondRate) @@ -246,11 +239,10 @@ namespace CBSVisualizer.Modules.Queue.ViewModels return Task.CompletedTask; } - public override async Task TransmissionCompleted(Func<PriorityPacket, PacketSubmitResult> trySubmitNextPacket) + public override async Task TransmissionCompleted() { await parent.StopCreditThread(); await parent.StartCreditThread(parent.IdleSlope); - await GateOpened(trySubmitNextPacket); } public override async Task TransmissionStarted(double bytesPerSecondRate) @@ -296,8 +288,8 @@ namespace CBSVisualizer.Modules.Queue.ViewModels parent.Queue.Remove(firstPacket); } else if (submitResult == PacketSubmitResult.DeniedPreClosing) // In the pre-closing case, we signal the thread to increase our credit to zero. { - parent.StopCreditThread(); - parent.StartCreditThread(parent.IdleSlope, 0); + _ = parent.StopCreditThread(); + _ = parent.StartCreditThread(parent.IdleSlope, 0); } } @@ -314,11 +306,10 @@ namespace CBSVisualizer.Modules.Queue.ViewModels return Task.CompletedTask; } - public override async Task TransmissionCompleted(Func<PriorityPacket, PacketSubmitResult> trySubmitNextPacket) + public override async Task TransmissionCompleted() { await parent.StopCreditThread(); await parent.StartCreditThread(parent.IdleSlope); - await GateOpened(trySubmitNextPacket); } public override async Task TransmissionStarted(double bytesPerSecondRate) diff --git a/CBSVisualizer/CBSVisualizer.Modules.Queue/ViewModels/QueueViewModel.cs b/CBSVisualizer/CBSVisualizer.Modules.Queue/ViewModels/QueueViewModel.cs index 3e1073a7fb19ee63feb5679232c62892546e7333..1b2a34ee0ef6ce916cf727d6dbb027a74e6f2e27 100644 --- a/CBSVisualizer/CBSVisualizer.Modules.Queue/ViewModels/QueueViewModel.cs +++ b/CBSVisualizer/CBSVisualizer.Modules.Queue/ViewModels/QueueViewModel.cs @@ -146,7 +146,11 @@ namespace CBSVisualizer.Modules.Queue.ViewModels creditGrowthCancellationSource?.Cancel(); try { - await creditUpdateTask; + if (creditUpdateTask != null) + { + await creditUpdateTask; + } + } catch (TaskCanceledException) { // Do nothing. diff --git a/CBSVisualizer/CBSVisualizer.Services.SchedulingService/Implementation/RandomSchedulingService.cs b/CBSVisualizer/CBSVisualizer.Services.SchedulingService/Implementation/RandomSchedulingService.cs index f2d16e12d65e5c1ed219b9e51062c9ee4fa78484..8bee7e81f281b40eeb78172141cbac64235c5ddd 100644 --- a/CBSVisualizer/CBSVisualizer.Services.SchedulingService/Implementation/RandomSchedulingService.cs +++ b/CBSVisualizer/CBSVisualizer.Services.SchedulingService/Implementation/RandomSchedulingService.cs @@ -3,6 +3,7 @@ using CBSVisualizer.Services.SettingsService.Service; using log4net; using Prism.Events; using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -31,19 +32,25 @@ namespace CBSVisualizer.Services.SchedulingService.Implementation while (!tokenSource.IsCancellationRequested) { - // Wait some time. - await Task.Delay(GetRandomWaitingTime(), tokenSource.Token); + // Get the opening time for the high prio. + int highPrioOpenedTime = GetRandomWaitingTime(); - // Publish GateOpenedEvent. - eventAggregator.GetEvent<GateOpenedEvent>().Publish(); - log.Info("Published GateOpenedEvent."); + // Publish GateOpenedEvent for the high prio queue. + eventAggregator.GetEvent<GateOpenedEvent>().Publish((OpenedTime: highPrioOpenedTime, OpenedGates: new HashSet<int> { 7 })); + log.Info("Published GateOpenedEvent [High Prio]"); - // Wait some time again. - await Task.Delay(GetRandomWaitingTime(), tokenSource.Token); + // Wait for the specified time. + await Task.Delay(highPrioOpenedTime, tokenSource.Token); - // Publish GateClosedEvent. - eventAggregator.GetEvent<GateClosedEvent>().Publish(); - log.Info("Published GateClosedEvent."); + // Get the opening time for the low prio. + int lowPrioOpenedTime = GetRandomWaitingTime(); + + // Publish another GateOpenedEvent for the other queues. + eventAggregator.GetEvent<GateOpenedEvent>().Publish((OpenedTime: lowPrioOpenedTime, OpenedGates: new HashSet<int> { 0, 1, 2, 3, 4, 5, 6 })); + log.Info("Published GateOpenedEvent [Lower Prio]"); + + // Wait for the specified time again. + await Task.Delay(lowPrioOpenedTime, tokenSource.Token); } } diff --git a/CBSVisualizer/CBSVisualizer.Services.SettingsService/Service/SettingService.cs b/CBSVisualizer/CBSVisualizer.Services.SettingsService/Service/SettingService.cs index d5854c7b50712e0785b4a95e5eb62dba2e869a45..72e94580eee6179b003b41b6143bac25a54b3f4e 100644 --- a/CBSVisualizer/CBSVisualizer.Services.SettingsService/Service/SettingService.cs +++ b/CBSVisualizer/CBSVisualizer.Services.SettingsService/Service/SettingService.cs @@ -24,6 +24,17 @@ namespace CBSVisualizer.Services.SettingsService.Service { InitializeCommonGroup(); InitializeSchedulersGroup(); + InitializeLoadGenerationGroup(); + } + + private void InitializeLoadGenerationGroup() + { + var loadGenerationGroupMembers = new ObservableCollection<Setting>(); + + // Packet interarrival time. + loadGenerationGroupMembers.Add(new StringSetting("interarrival_time", "Packet Inter-Arrival Time [ms]", "500")); + + settingGroups.Add(new SettingGroup("Load Generation", loadGenerationGroupMembers)); } private void InitializeSchedulersGroup() diff --git a/CBSVisualizer/CBSVisualizer.sln b/CBSVisualizer/CBSVisualizer.sln index 9aa428df88305bc773a915e304f19c14170f1720..bc1718619ca5600eb84b7f8d561cbcc446da364e 100644 --- a/CBSVisualizer/CBSVisualizer.sln +++ b/CBSVisualizer/CBSVisualizer.sln @@ -11,8 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CBSVisualizer.Modules.Queue EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Messaging", "Messaging", "{A8B5ED15-36EF-45E2-9050-FC508A973437}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CBSVisualizer.Modules.LoadGenerator", "CBSVisualizer.LoadGenerator\CBSVisualizer.Modules.LoadGenerator.csproj", "{52404FB0-224E-4E74-B46B-0427500C5CAB}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CBSVisualizer.Modules.QueueGroup", "CBSVisualizer.Modules.Queue.QueueGroup\CBSVisualizer.Modules.QueueGroup.csproj", "{DFF756DE-E1E5-4E55-A0EC-3E3EC815D668}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9A7E4340-135A-466D-A6A8-05B365BB38F2}" @@ -36,6 +34,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CBSVisualizer", "CBSVisuali EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CBSVisualizer.Core", "CBSVisualizer.Core\CBSVisualizer.Core.csproj", "{9B695A72-95CE-4E44-BEFB-9AC591A96902}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CBSVisualizer.Common", "CBSVisualizer.Common\CBSVisualizer.Common.csproj", "{9B1B603C-601C-4F31-ADD9-D0962C0011AF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -46,10 +46,6 @@ Global {E40161D2-116D-481F-857C-22F1CA7AC8A2}.Debug|Any CPU.Build.0 = Debug|Any CPU {E40161D2-116D-481F-857C-22F1CA7AC8A2}.Release|Any CPU.ActiveCfg = Release|Any CPU {E40161D2-116D-481F-857C-22F1CA7AC8A2}.Release|Any CPU.Build.0 = Release|Any CPU - {52404FB0-224E-4E74-B46B-0427500C5CAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {52404FB0-224E-4E74-B46B-0427500C5CAB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {52404FB0-224E-4E74-B46B-0427500C5CAB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {52404FB0-224E-4E74-B46B-0427500C5CAB}.Release|Any CPU.Build.0 = Release|Any CPU {DFF756DE-E1E5-4E55-A0EC-3E3EC815D668}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DFF756DE-E1E5-4E55-A0EC-3E3EC815D668}.Debug|Any CPU.Build.0 = Debug|Any CPU {DFF756DE-E1E5-4E55-A0EC-3E3EC815D668}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -86,13 +82,16 @@ Global {9B695A72-95CE-4E44-BEFB-9AC591A96902}.Debug|Any CPU.Build.0 = Debug|Any CPU {9B695A72-95CE-4E44-BEFB-9AC591A96902}.Release|Any CPU.ActiveCfg = Release|Any CPU {9B695A72-95CE-4E44-BEFB-9AC591A96902}.Release|Any CPU.Build.0 = Release|Any CPU + {9B1B603C-601C-4F31-ADD9-D0962C0011AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B1B603C-601C-4F31-ADD9-D0962C0011AF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B1B603C-601C-4F31-ADD9-D0962C0011AF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9B1B603C-601C-4F31-ADD9-D0962C0011AF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {E40161D2-116D-481F-857C-22F1CA7AC8A2} = {6D2194E0-E17B-44D6-AD8C-F3699549D259} - {52404FB0-224E-4E74-B46B-0427500C5CAB} = {6D2194E0-E17B-44D6-AD8C-F3699549D259} {DFF756DE-E1E5-4E55-A0EC-3E3EC815D668} = {6D2194E0-E17B-44D6-AD8C-F3699549D259} {FA26101C-4CE6-4079-A60F-97C749032720} = {A8B5ED15-36EF-45E2-9050-FC508A973437} {7E35744E-1C78-45FC-929E-39299C76BBB7} = {6D2194E0-E17B-44D6-AD8C-F3699549D259} diff --git a/CBSVisualizer/CBSVisualizer/App.xaml.cs b/CBSVisualizer/CBSVisualizer/App.xaml.cs index 04a50afc883dc20bbc6224acddf383b5869fc82f..8fd0e5986c5483f700e6744539d5681c55749b6b 100644 --- a/CBSVisualizer/CBSVisualizer/App.xaml.cs +++ b/CBSVisualizer/CBSVisualizer/App.xaml.cs @@ -6,7 +6,6 @@ using CBSVisualizer.Services.SettingsService.Service; using CBSVisualizer.Services.SchedulingService.Implementation; using CBSVisualizer.Modules.Queue.QueueGroup; using CBSVisualizer.Services.SchedulingService; -using CBSVisualizer.LoadGenerator; using CBSVisualizer.Modules.Link; using CBSVisualizer.Modules.SettingsDialog; using CBSVisualizer.Modules.MenuBar; @@ -38,7 +37,6 @@ namespace CBSVisualizer moduleCatalog.AddModule<SettingsDialogModule>(); moduleCatalog.AddModule<LinkModule>(); moduleCatalog.AddModule<QueueGroupModule>(); - moduleCatalog.AddModule<LoadGeneratorModule>(); moduleCatalog.AddModule<MenuBarModule>(); } } diff --git a/CBSVisualizer/CBSVisualizer/CBSVisualizer.csproj b/CBSVisualizer/CBSVisualizer/CBSVisualizer.csproj index ca1f8a0b97ac218194820e3c2553b6f780a096d0..5e2cc6eca791a993061789dce9149398867f5f55 100644 --- a/CBSVisualizer/CBSVisualizer/CBSVisualizer.csproj +++ b/CBSVisualizer/CBSVisualizer/CBSVisualizer.csproj @@ -11,7 +11,6 @@ <PackageReference Include="Prism.DryIoc" Version="7.2.0.1422" /> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\CBSVisualizer.LoadGenerator\CBSVisualizer.Modules.LoadGenerator.csproj" /> <ProjectReference Include="..\CBSVisualizer.Modules.Link\CBSVisualizer.Modules.Link.csproj" /> <ProjectReference Include="..\CBSVisualizer.Modules.MenuBar\CBSVisualizer.Modules.MenuBar.csproj" /> <ProjectReference Include="..\CBSVisualizer.Modules.Queue.QueueGroup\CBSVisualizer.Modules.QueueGroup.csproj" /> diff --git a/CBSVisualizer/CBSVisualizer/Views/MainWindow.xaml b/CBSVisualizer/CBSVisualizer/Views/MainWindow.xaml index c6280fb6a6233a2578de8134420d2a7702a2af6c..4be8a18cca5e4f84e516671f2b4bb5a861407a9b 100644 --- a/CBSVisualizer/CBSVisualizer/Views/MainWindow.xaml +++ b/CBSVisualizer/CBSVisualizer/Views/MainWindow.xaml @@ -11,13 +11,11 @@ <RowDefinition Height="*"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> - <ColumnDefinition Width="0.5*"/> <ColumnDefinition Width="*"/> - <ColumnDefinition Width="0.5*"/> + <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> - <ContentControl prism:RegionManager.RegionName="{x:Static core:RegionNames.MenuBarRegion}" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3"/> - <ContentControl prism:RegionManager.RegionName="{x:Static core:RegionNames.LoadGeneratorRegion}" Grid.Column="0" Grid.Row="1"/> - <ContentControl prism:RegionManager.RegionName="{x:Static core:RegionNames.QueueGroupRegion}" Grid.Column="1" Grid.Row="1"/> - <ContentControl prism:RegionManager.RegionName="{x:Static core:RegionNames.LinkRegion}" Grid.Column="2" Grid.Row="1"/> + <ContentControl prism:RegionManager.RegionName="{x:Static core:RegionNames.MenuBarRegion}" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"/> + <ContentControl prism:RegionManager.RegionName="{x:Static core:RegionNames.QueueGroupRegion}" Grid.Column="0" Grid.Row="1"/> + <ContentControl prism:RegionManager.RegionName="{x:Static core:RegionNames.LinkRegion}" Grid.Column="1" Grid.Row="1" Margin="0, 0, 5, 0"/> </Grid> </Window>