Skip to content

Commit

Permalink
Improved the map for closing connections (no uses the same color code…
Browse files Browse the repository at this point in the history
… / fade out as the list).

Fixed a bug where connections were not removed from both the bandwidth graph and map. After second thoughts... Removing from the bandwidth graph doesn't make sense. Will fix that tomorrow or tonight, no time for this as of now.
  • Loading branch information
wokhan committed Dec 8, 2020
1 parent ab94ea2 commit d1a07de
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: .NET Core

on:
push:
branches: master
branches:
- master
#schedule: # to be enabled to have real nightlies
#- cron: 0 0 * * *

Expand Down
10 changes: 9 additions & 1 deletion Console/UI/Controls/BandwidthGraph.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void UpdateGraph()
Model.DefaultXAxis.Minimum = Start;
Model.DefaultXAxis.Maximum = End;

var localConnections = Dispatcher.Invoke(() => Connections.GroupBy(connection => connection.GroupKey).ToList());
var localConnections = Dispatcher.Invoke(() => Connections.GroupBy(connection => connection.GroupKey));
foreach (var connectionGroup in localConnections)
{
ObservableCollection<DataPoint> seriesInValues;
Expand Down Expand Up @@ -92,6 +92,14 @@ public void UpdateGraph()
}
}

//TODO: there has to be a better way
allSeriesIn.Where(series => !localConnections.Any(group => group.Key == series.Key))
.ToList()
.ForEach(series => allSeriesIn.TryRemove(series));
allSeriesOut.Where(series => !localConnections.Any(group => group.Key == series.Key))
.ToList()
.ForEach(series => allSeriesIn.TryRemove(series));

Model.InvalidatePlot(true);
}
}
Expand Down
25 changes: 24 additions & 1 deletion Console/UI/Controls/Map.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,25 @@
<Setter Property="Stroke" Value="Gray" />
<Style.Triggers>
<Trigger Property="Selector.IsSelected" Value="True">
<Setter Property="StrokeThickness" Value="4" />
<Setter Property="Stroke" Value="Blue" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Stroke" Value="SteelBlue" />
<Setter Property="StrokeThickness" Value="4" />
</Trigger>
<DataTrigger Binding="{Binding Connection.IsNew}" Value="True">
<Setter Property="Stroke" Value="LightBlue" />
</DataTrigger>
<DataTrigger Binding="{Binding Connection.IsDying}" Value="True">
<Setter Property="Stroke" Value="Orange" />
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="0:0:5" From="1" To="0" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
</maps:MapPolyline.Resources>
Expand Down Expand Up @@ -81,6 +95,15 @@
<Setter Property="Stroke" Value="{DynamicResource AccentColorBrush}" />
<Setter Property="StrokeThickness" Value="5" />
</Trigger>
<DataTrigger Binding="{Binding Connection.IsDying}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="0:0:5" From="1" To="0" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
Expand Down
5 changes: 5 additions & 0 deletions Console/UI/Controls/Map.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ public void UpdateMap()
AddOrUpdateConnection(c);
}

//TODO: there has to be a better way
ConnectionsRoutes.Where(route => !Connections.Contains(route.Connection))
.ToList()
.ForEach(route => ConnectionsRoutes.Remove(route));

CurrentMap.UpdateLayout();
});
}
Expand Down

0 comments on commit d1a07de

Please sign in to comment.