Skip to content

Commit

Permalink
# BugFix:
Browse files Browse the repository at this point in the history
Not trimmer friendly in .NET 8
   - Fixed namespace for `AttachmentViewModel`.
   - Fixed namespace and ClassName for `LoadStatus` property to refernce from `GeoModel` instead of `Map`.
   - Added warnings `IL2036` and `IL2037` to treat them as errors.
  • Loading branch information
prathameshnarkhede committed Feb 20, 2024
1 parent aaad3ef commit ebc78fd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<!-- Display name -->
<WarningsAsErrors>$(WarningsAsErrors);IL2036;IL2037</WarningsAsErrors>

<!-- Display name -->
<ApplicationTitle>Toolkit.SampleApp.Maui</ApplicationTitle>

<!-- App Identifier -->
Expand Down
2 changes: 1 addition & 1 deletion src/Toolkit/Toolkit.Maui/OverviewMap/OverviewMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class OverviewMap : TemplatedView
private MapView? _overviewMapView;


[DynamicDependency(nameof(Esri.ArcGISRuntime.Mapping.Map.LoadStatus), "Esri.ArcGISRuntime.Mapping.Map", "Esri.ArcGISRuntime")]
[DynamicDependency(nameof(Esri.ArcGISRuntime.Mapping.GeoModel.LoadStatus), "Esri.ArcGISRuntime.Mapping.GeoModel", "Esri.ArcGISRuntime")]
static OverviewMap()
{
DefaultControlTemplate = new ControlTemplate(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ private static object BuildDefaultTemplate()
}


[DynamicDependency(nameof(AttachmentViewModel.Thumbnail), "Esri.ArcGISRuntime.Toolkit.Maui.Primitives.AttachmentViewModel","Esri.ArcGISRuntime")]
[DynamicDependency(nameof(AttachmentViewModel.Name), "Esri.ArcGISRuntime.Toolkit.Maui.Primitives.AttachmentViewModel", "Esri.ArcGISRuntime")]
[DynamicDependency(nameof(AttachmentViewModel.Size), "Esri.ArcGISRuntime.Toolkit.Maui.Primitives.AttachmentViewModel", "Esri.ArcGISRuntime")]
[DynamicDependency(nameof(AttachmentViewModel.IsDownloadButtonVisible), "Esri.ArcGISRuntime.Toolkit.Maui.Primitives.AttachmentViewModel", "Esri.ArcGISRuntime")]
[DynamicDependency(nameof(AttachmentViewModel.IsDownloading), "Esri.ArcGISRuntime.Toolkit.Maui.Primitives.AttachmentViewModel", "Esri.ArcGISRuntime")]
[DynamicDependency(nameof(AttachmentViewModel.Thumbnail), "Esri.ArcGISRuntime.Toolkit.Maui.Primitives.AttachmentsPopupElementView.AttachmentViewModel", "Esri.ArcGISRuntime.Toolkit.Maui")]
[DynamicDependency(nameof(AttachmentViewModel.Name), "Esri.ArcGISRuntime.Toolkit.Maui.Primitives.AttachmentsPopupElementView.AttachmentViewModel", "Esri.ArcGISRuntime.Toolkit.Maui")]
[DynamicDependency(nameof(AttachmentViewModel.Size), "Esri.ArcGISRuntime.Toolkit.Maui.Primitives.AttachmentsPopupElementView.AttachmentViewModel", "Esri.ArcGISRuntime.Toolkit.Maui")]
[DynamicDependency(nameof(AttachmentViewModel.IsDownloadButtonVisible), "Esri.ArcGISRuntime.Toolkit.Maui.Primitives.AttachmentsPopupElementView.AttachmentViewModel", "Esri.ArcGISRuntime.Toolkit.Maui")]
[DynamicDependency(nameof(AttachmentViewModel.IsDownloading), "Esri.ArcGISRuntime.Toolkit.Maui.Primitives.AttachmentsPopupElementView.AttachmentViewModel", "Esri.ArcGISRuntime.Toolkit.Maui")]
private static object BuildDefaultItemTemplate()
{
Grid layout = new Grid();
Expand All @@ -95,7 +95,7 @@ private static object BuildDefaultItemTemplate()
layout.Add(image);
image.SetBinding(Image.SourceProperty, new Binding(nameof(AttachmentViewModel.Thumbnail)));
Grid.SetRowSpan(image, 2);

Label name = new Label() { VerticalOptions = LayoutOptions.End };
name.SetBinding(Label.TextProperty, nameof(AttachmentViewModel.Name));
Grid.SetColumn(name, 1);
Expand All @@ -113,7 +113,7 @@ private static object BuildDefaultItemTemplate()
Grid.SetColumn(image2, 2);
Grid.SetRowSpan(image2, 2);
layout.Add(image2);

ActivityIndicator indicator = new ActivityIndicator() { WidthRequest = 24, HeightRequest = 24, IsRunning = true };
indicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding(nameof(AttachmentViewModel.IsDownloading)));
Grid.SetColumn(indicator, 2);
Expand Down Expand Up @@ -210,7 +210,7 @@ public string Size
else
return $"{Math.Round(size / 1024d / 1024d, 1)} MB";
}
}
}

private void Attachment_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
Expand Down Expand Up @@ -241,9 +241,9 @@ public ImageSource? Thumbnail
return _thumbnail;
}
}

public bool IsDownloadButtonVisible => !Attachment.IsLocal && Attachment.LoadStatus != LoadStatus.Loaded && Attachment.LoadStatus != LoadStatus.Loading;

public bool IsDownloading => !Attachment.IsLocal && Attachment.LoadStatus == LoadStatus.Loading;

private void CreateThumbnail()
Expand Down

0 comments on commit ebc78fd

Please sign in to comment.