Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
carl-andersson-at-westermo committed Dec 2, 2024
1 parent cf47448 commit 7c029d1
Show file tree
Hide file tree
Showing 45 changed files with 369 additions and 528 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void Compute(CancellationToken cancellationToken)

public IDictionary<TVertex, Point> VertexPositions { get; set; }

private readonly Dictionary<TEdge, Point[]> _edgeRoutes = new();
private readonly Dictionary<TEdge, Point[]> _edgeRoutes = [];
public IDictionary<TEdge, Point[]> EdgeRoutes => _edgeRoutes;

public Point[] ComputeSingle(TEdge edge) { return null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,6 @@ internal static void SetGlowInfo(Window window, GlowInfo info)

internal class GlowInfo
{
public readonly Collection<GlowWindow> glows = new();
public readonly Collection<GlowWindow> glows = [];
}
}
8 changes: 5 additions & 3 deletions Examples/ShowcaseApp.WPF/Models/ShadowChrome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ private static void CreateBrushes()
var shadowColor = Color.FromArgb(128, 0, 0, 0);
var transparentColor = Color.FromArgb(16, 0, 0, 0);
// Create a GradientStopCollection from these
var gradient = new GradientStopCollection(2);
gradient.Add(new GradientStop(shadowColor, 0.5));
gradient.Add(new GradientStop(transparentColor, 1.0));
var gradient = new GradientStopCollection(2)
{
new GradientStop(shadowColor, 0.5),
new GradientStop(transparentColor, 1.0)
};
gradient.Freeze();
// Create the background brush
backgroundBrush = new SolidColorBrush(shadowColor);
Expand Down
2 changes: 1 addition & 1 deletion Examples/ShowcaseApp.WPF/Pages/Debug/DebugGraph.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public DebugGraph()
butVCP.Click += butVCP_Click;
butEdgeLabels.Click += butEdgeLabels_Click;
butGroupedGraph.Click += butGroupedGraph_Click;
cbDebugMode.ItemsSource = Enum.GetValues(typeof(DebugModeEnum)).Cast<DebugModeEnum>();
cbDebugMode.ItemsSource = Enum.GetValues<DebugModeEnum>().Cast<DebugModeEnum>();
cbDebugMode.SelectionChanged += cbDebugMode_SelectionChanged;
dg_zoomctrl.PropertyChanged += dg_zoomctrl_PropertyChanged;
CreateNewArea();
Expand Down
6 changes: 3 additions & 3 deletions Examples/ShowcaseApp.WPF/Pages/EdgeRoutingGraph.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,17 @@ public EdgeRoutingGraph()
(PathFinderEdgeRoutingParameters)_logicCore.AlgorithmFactory.CreateEdgeRoutingParameters(
EdgeRoutingAlgorithmTypeEnum.PathFinder);

erg_pfprm_formula.ItemsSource = Enum.GetValues(typeof(PathFindAlgorithm)).Cast<PathFindAlgorithm>();
erg_pfprm_formula.ItemsSource = Enum.GetValues<PathFindAlgorithm>().Cast<PathFindAlgorithm>();
erg_pfprm_formula.SelectedIndex = 0;

erg_but_randomgraph.Click += erg_but_randomgraph_Click;
erg_but_relayout.Click += erg_but_relayout_Click;
erg_useExternalERAlgo.Checked += erg_useExternalERAlgo_Checked;
erg_useExternalERAlgo.Unchecked += erg_useExternalERAlgo_Checked;
erg_dashstyle.ItemsSource = Enum.GetValues(typeof(EdgeDashStyle)).Cast<EdgeDashStyle>();
erg_dashstyle.ItemsSource = Enum.GetValues<EdgeDashStyle>().Cast<EdgeDashStyle>();
erg_dashstyle.SelectedIndex = 0;
erg_dashstyle.SelectionChanged += erg_dashstyle_SelectionChanged;
erg_eralgo.ItemsSource = Enum.GetValues(typeof(EdgeRoutingAlgorithmTypeEnum))
erg_eralgo.ItemsSource = Enum.GetValues<EdgeRoutingAlgorithmTypeEnum>()
.Cast<EdgeRoutingAlgorithmTypeEnum>();
erg_eralgo.SelectedIndex = 0;
erg_eralgo.SelectionChanged += erg_eralgo_SelectionChanged;
Expand Down
6 changes: 3 additions & 3 deletions Examples/ShowcaseApp.WPF/Pages/GeneralGraph.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ public GeneralGraph()
gg_oralgo.SelectionChanged += gg_oralgo_SelectionChanged;
gg_eralgo.SelectionChanged += gg_eralgo_SelectionChanged;

gg_layalgo.ItemsSource = Enum.GetValues(typeof(LayoutAlgorithmTypeEnum)).Cast<LayoutAlgorithmTypeEnum>();
gg_layalgo.ItemsSource = Enum.GetValues<LayoutAlgorithmTypeEnum>().Cast<LayoutAlgorithmTypeEnum>();
gg_layalgo.SelectedItem = LayoutAlgorithmTypeEnum.KK;

gg_oralgo.ItemsSource = Enum.GetValues(typeof(OverlapRemovalAlgorithmTypeEnum))
gg_oralgo.ItemsSource = Enum.GetValues<OverlapRemovalAlgorithmTypeEnum>()
.Cast<OverlapRemovalAlgorithmTypeEnum>();
gg_oralgo.SelectedIndex = 0;

gg_eralgo.ItemsSource = Enum.GetValues(typeof(EdgeRoutingAlgorithmTypeEnum))
gg_eralgo.ItemsSource = Enum.GetValues<EdgeRoutingAlgorithmTypeEnum>()
.Cast<EdgeRoutingAlgorithmTypeEnum>();
gg_eralgo.SelectedItem = EdgeRoutingAlgorithmTypeEnum.SimpleER;

Expand Down
2 changes: 1 addition & 1 deletion Examples/ShowcaseApp.WPF/Pages/NNGraph.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public partial class NNGraph : IDisposable
/// <summary>
/// tmp collection to speedup selected vertices search
/// </summary>
private readonly List<VertexControl> _selectedVertices = new();
private readonly List<VertexControl> _selectedVertices = [];

private EditorOperationMode _opMode = EditorOperationMode.Select;
private VertexControl _ecFrom;
Expand Down
24 changes: 12 additions & 12 deletions Examples/ShowcaseApp.WPF/Pages/ThemedGraph.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@

<DockPanel Grid.Column="2" Grid.Row="0" Grid.RowSpan="2">
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top" HorizontalAlignment="Center">
<Button Height="50" Margin="3" Name="tg_but_randomgraph" Click="tg_but_randomgraph_Click"
<Button Height="50" Margin="3" Name="tg_but_randomgraph" Click="ButRandomGraphClick"
DockPanel.Dock="Top" UseLayoutRounding="True"
BorderBrush="{DynamicResource ModernButtonBorder}">
<Image Width="44" Height="41.1667" Source="/Assets/dice.png" Stretch="Uniform" />
Expand All @@ -97,47 +97,47 @@
<Expander IsExpanded="True" Header="Edge options">
<DockPanel LastChildFill="False" HorizontalAlignment="Stretch">
<TextBlock DockPanel.Dock="Top" Text="Edge display mode" HorizontalAlignment="Center" />
<ComboBox x:Name="tg_edgeMode" Margin="3" SelectionChanged="tg_edgeMode_SelectionChanged"
<ComboBox x:Name="tg_edgeMode" Margin="3" SelectionChanged="EdgeModeSelectionChanged"
DockPanel.Dock="Top" IsReadOnly="True" />
<TextBlock DockPanel.Dock="Top" Text="Edge display type" HorizontalAlignment="Center" />
<ComboBox x:Name="tg_edgeType" Margin="3" SelectionChanged="tg_edgeType_SelectionChanged"
<ComboBox x:Name="tg_edgeType" Margin="3" SelectionChanged="EdgeTypeSelectionChanged"
DockPanel.Dock="Top" IsReadOnly="True" />
</DockPanel>
</Expander>
<Expander Header="Behaviours">
<DockPanel LastChildFill="False" HorizontalAlignment="Stretch">
<CheckBox Name="tg_dragEnabled" Content="Vertex drag enabled" Margin="3"
DockPanel.Dock="Top" Checked="tg_dragEnabled_Checked"
Unchecked="tg_dragEnabled_Checked" />
DockPanel.Dock="Top" Checked="DragEnabledChanged"
Unchecked="DragEnabledChanged" />
<CheckBox Name="tg_dragMoveEdges" Content="Update edges on move" Margin="3"
DockPanel.Dock="Top" />

<CheckBox Name="tg_highlightEnabled" Content="Highlight enabled" Margin="3"
DockPanel.Dock="Top" Checked="tg_highlightEnabled_Checked"
Unchecked="tg_highlightEnabled_Checked" />
DockPanel.Dock="Top" Checked="HighlightEnabledSelectionChanged"
Unchecked="HighlightEnabledSelectionChanged" />
<TextBlock DockPanel.Dock="Top" Text="Affected control type" HorizontalAlignment="Center" />
<ComboBox x:Name="tg_highlightType" Margin="3"
SelectionChanged="tg_highlightType_SelectionChanged" DockPanel.Dock="Top"
SelectionChanged="HighlightTypeSelectionChanged" DockPanel.Dock="Top"
IsReadOnly="True" />
<TextBlock DockPanel.Dock="Top" Text="Edge directions" HorizontalAlignment="Center" />
<ComboBox x:Name="tg_highlightEdgeType" Margin="3"
SelectionChanged="tg_highlightEdgeType_SelectionChanged" DockPanel.Dock="Top"
SelectionChanged="HighlightEdgeTypeSelectionChanged" DockPanel.Dock="Top"
IsReadOnly="True" />
</DockPanel>
</Expander>
<Expander Header="Animation">
<DockPanel LastChildFill="False" HorizontalAlignment="Stretch">
<TextBlock DockPanel.Dock="Top" Text="Move animation" HorizontalAlignment="Center" />
<ComboBox x:Name="tg_moveAnimation" Margin="3"
SelectionChanged="tg_moveAnimation_SelectionChanged" DockPanel.Dock="Top"
SelectionChanged="MoveAnimationSelectionChanged" DockPanel.Dock="Top"
IsReadOnly="True" />
<TextBlock DockPanel.Dock="Top" Text="Delete animation" HorizontalAlignment="Center" />
<ComboBox x:Name="tg_deleteAnimation" Margin="3"
SelectionChanged="tg_deleteAnimation_SelectionChanged" DockPanel.Dock="Top"
SelectionChanged="DeleteAnimationSelectionChanged" DockPanel.Dock="Top"
IsReadOnly="True" />
<TextBlock DockPanel.Dock="Top" Text="MouseOver animation" HorizontalAlignment="Center" />
<ComboBox x:Name="tg_mouseoverAnimation" Margin="3"
SelectionChanged="tg_mouseoverAnimation_SelectionChanged" DockPanel.Dock="Top"
SelectionChanged="MouseOverAnimationSelectionChanged" DockPanel.Dock="Top"
IsReadOnly="True" />
</DockPanel>
</Expander>
Expand Down
Loading

0 comments on commit 7c029d1

Please sign in to comment.