Skip to content

Commit

Permalink
Trz to clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghislain1 committed Sep 2, 2023
1 parent a816dce commit eeedd33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions Ghis.Controls/Charts/ChartLines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ protected override void OnRender(DrawingContext drawingContext)

public static void OnVerticalAxisTickValuesChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
{
ChartLines obj = sender as ChartLines;
if (obj != null && obj.VerticalAxisTickPositions != null)
if (sender is ChartLines obj && obj.VerticalAxisTickPositions != null)
{
obj.InvalidateVisual();
obj.VerticalAxisTickPositions.CollectionChanged += new NotifyCollectionChangedEventHandler(obj.VerticalAxisTickPositions_CollectionChanged);
Expand Down
6 changes: 3 additions & 3 deletions Ghis.Controls/Charts/ValueExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ private static void OnItemsChanged(DependencyObject sender, DependencyPropertyCh
}
// ValueExtractor v = sender as ValueExtractor;
// ItemCollection oldItems = args.OldValue as ItemCollection;
ItemCollection newItems = args.NewValue as ItemCollection;
ItemCollection? newItems = args.NewValue as ItemCollection;
if (args.OldValue is INotifyCollectionChanged oldItems)
{
oldItems.CollectionChanged -= new NotifyCollectionChangedEventHandler(v.OnItemsCollectionChanged);
oldItems.CollectionChanged -= new NotifyCollectionChangedEventHandler(v.OnItemsCollectionChanged!);
}

if (v.Items is INotifyCollectionChanged vItems)
{
vItems.CollectionChanged += new NotifyCollectionChangedEventHandler(v.OnItemsCollectionChanged);
vItems.CollectionChanged += new NotifyCollectionChangedEventHandler(v.OnItemsCollectionChanged!);
if (v.ValuePath is not null)
{
v.GenerateValueList();
Expand Down

0 comments on commit eeedd33

Please sign in to comment.