From 0f9503a7b67859afa2d29c5469205a2dbd55e2af Mon Sep 17 00:00:00 2001 From: Jennifer Nery Date: Fri, 17 May 2024 17:56:10 -0700 Subject: [PATCH 1/3] utilnet: possible dup raised event UtilityNetworkTraceCompleted --- .../UtilityNetworkTraceTool/UtilityNetworkTraceTool.cs | 9 ++++++--- .../UtilityNetworkTraceTool.Windows.cs | 7 +++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Toolkit/Toolkit.Maui/UtilityNetworkTraceTool/UtilityNetworkTraceTool.cs b/src/Toolkit/Toolkit.Maui/UtilityNetworkTraceTool/UtilityNetworkTraceTool.cs index 2d588cd1f..2a10697ca 100644 --- a/src/Toolkit/Toolkit.Maui/UtilityNetworkTraceTool/UtilityNetworkTraceTool.cs +++ b/src/Toolkit/Toolkit.Maui/UtilityNetworkTraceTool/UtilityNetworkTraceTool.cs @@ -397,12 +397,15 @@ private void Results_CollectionChanged(object? sender, NotifyCollectionChangedEv _resultOverlays.Add(item.ResultOverlay); GeoView.GraphicsOverlays.Insert(0, item.ResultOverlay); } - - UtilityNetworkTraceCompleted?.Invoke(this, new UtilityNetworkTraceCompletedEventArgs(item.Parameters, item.RawResults)); - if (item?.Error != null) + + if (item.Error != null) { UtilityNetworkTraceCompleted?.Invoke(this, new UtilityNetworkTraceCompletedEventArgs(item.Parameters, item.Error)); } + else + { + UtilityNetworkTraceCompleted?.Invoke(this, new UtilityNetworkTraceCompletedEventArgs(item.Parameters, item.RawResults)); + } } } diff --git a/src/Toolkit/Toolkit.UI.Controls/UtilityNetworkTraceTool/UtilityNetworkTraceTool.Windows.cs b/src/Toolkit/Toolkit.UI.Controls/UtilityNetworkTraceTool/UtilityNetworkTraceTool.Windows.cs index 4e0bf2697..fe14f5789 100644 --- a/src/Toolkit/Toolkit.UI.Controls/UtilityNetworkTraceTool/UtilityNetworkTraceTool.Windows.cs +++ b/src/Toolkit/Toolkit.UI.Controls/UtilityNetworkTraceTool/UtilityNetworkTraceTool.Windows.cs @@ -155,11 +155,14 @@ private void Results_CollectionChanged(object? sender, NotifyCollectionChangedEv GeoView.GraphicsOverlays.Insert(0, item.ResultOverlay); } - UtilityNetworkTraceCompleted?.Invoke(this, new UtilityNetworkTraceCompletedEventArgs(item.Parameters, item.RawResults)); - if (item?.Error != null) + if (item.Error != null) { UtilityNetworkTraceCompleted?.Invoke(this, new UtilityNetworkTraceCompletedEventArgs(item.Parameters, item.Error)); } + else + { + UtilityNetworkTraceCompleted?.Invoke(this, new UtilityNetworkTraceCompletedEventArgs(item.Parameters, item.RawResults)); + } } } From 76d43450325c64fc89256b49565636edbb6abaf3 Mon Sep 17 00:00:00 2001 From: Jennifer Nery Date: Fri, 17 May 2024 17:56:57 -0700 Subject: [PATCH 2/3] utilnet: ensure UtilityNetworkChanged is raised when selection is cleared/changed (maui) --- .../UtilityNetworkTraceTool/UtilityNetworkTraceTool.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Toolkit/Toolkit.Maui/UtilityNetworkTraceTool/UtilityNetworkTraceTool.cs b/src/Toolkit/Toolkit.Maui/UtilityNetworkTraceTool/UtilityNetworkTraceTool.cs index 2a10697ca..bea9438dd 100644 --- a/src/Toolkit/Toolkit.Maui/UtilityNetworkTraceTool/UtilityNetworkTraceTool.cs +++ b/src/Toolkit/Toolkit.Maui/UtilityNetworkTraceTool/UtilityNetworkTraceTool.cs @@ -338,11 +338,9 @@ private void PART_RunTraceButton_Clicked(object? sender, EventArgs e) private void OnAddStartingPointClicked(object? sender, EventArgs e) => _controller.IsAddingStartingPoints = !_controller.IsAddingStartingPoints; private void PART_NetworksCollectionView_SelectionChanged(object? sender, EventArgs e) - { - if (PART_ListViewNetworks?.SelectedItem is UtilityNetwork newSelection) - { - _controller.SelectedUtilityNetwork = newSelection; - } + { + _controller.SelectedUtilityNetwork = PART_ListViewNetworks?.SelectedItem as UtilityNetwork; + UtilityNetworkChanged?.Invoke(this, new UtilityNetworkChangedEventArgs(_controller.SelectedUtilityNetwork)); } private void UtilityNetworks_CollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) From c10170fc46f44f8a0564d54fd6a7b02c8ed0e430 Mon Sep 17 00:00:00 2001 From: Jennifer Nery Date: Fri, 17 May 2024 17:59:19 -0700 Subject: [PATCH 3/3] utilnet: suppress disposable types error --- .../UtilityNetworkTraceTool.Appearance.cs | 4 +++- .../UtilityNetworkTraceTool.Appearance.cs | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Toolkit/Toolkit.Maui/UtilityNetworkTraceTool/UtilityNetworkTraceTool.Appearance.cs b/src/Toolkit/Toolkit.Maui/UtilityNetworkTraceTool/UtilityNetworkTraceTool.Appearance.cs index 94eb71c86..7556a9f3c 100644 --- a/src/Toolkit/Toolkit.Maui/UtilityNetworkTraceTool/UtilityNetworkTraceTool.Appearance.cs +++ b/src/Toolkit/Toolkit.Maui/UtilityNetworkTraceTool/UtilityNetworkTraceTool.Appearance.cs @@ -19,7 +19,9 @@ namespace Esri.ArcGISRuntime.Toolkit.Maui; -public partial class UtilityNetworkTraceTool +#pragma warning disable CA1001 +public partial class UtilityNetworkTraceTool +#pragma warning restore CA1001 { #pragma warning disable SA1310, SX1309, SA1306 // Navigation diff --git a/src/Toolkit/Toolkit.UI.Controls/UtilityNetworkTraceTool/UtilityNetworkTraceTool.Appearance.cs b/src/Toolkit/Toolkit.UI.Controls/UtilityNetworkTraceTool/UtilityNetworkTraceTool.Appearance.cs index 169fe477d..03078e1b4 100644 --- a/src/Toolkit/Toolkit.UI.Controls/UtilityNetworkTraceTool/UtilityNetworkTraceTool.Appearance.cs +++ b/src/Toolkit/Toolkit.UI.Controls/UtilityNetworkTraceTool/UtilityNetworkTraceTool.Appearance.cs @@ -64,7 +64,9 @@ namespace Esri.ArcGISRuntime.Toolkit.UI.Controls #else [TemplatePart(Name = "PART_TabsControl", Type = typeof(Pivot))] #endif +#pragma warning disable CA1001 public partial class UtilityNetworkTraceTool +#pragma warning restore CA1001 { private UIElement? _loadingScrim; private UIElement? _ineligibleScrim;