Skip to content

Commit

Permalink
v.next (#612)
Browse files Browse the repository at this point in the history
* Set up v.next branch

* Add FeatureForms for WinUI and UWP (#591)

* Minor UI tweaks to feature forms

* Switch cancelButton image to FontImageSource allowing for more flexible and scalable icon usage (#593)

* Switch cancelButton image to FontImageSource allowing for more flexible and scalable icon usage with support for Dark/Light mode fixes.

* Update cancelButton icon color to #6E6E6E
Removed unused resources.

* Localize the View hyperlink string

* FeatureForms: Adds TextFormElement support (#604)

* Initial work on TextFormElementView support

* Initial support of TextFormElement without Markdown rendering

* Set style on UWP

* Add missing line

* Remove extra

* Update src/Toolkit/Toolkit/UI/Controls/FeatureForm/FeatureFormElementTemplateSelector.cs

Co-authored-by: Matvei Stefarov <[email protected]>

---------

Co-authored-by: Morten Nielsen <[email protected]>
Co-authored-by: Matvei Stefarov <[email protected]>

* Add support for markdown (#605)

* Add support for markdown

* Fixes layout issues with search view in MAUI (#609)

* feat(localization): update pseudo translation (#608)

* Update pseudo translation - @mit10976 @Isa13169 @nia13404

* Update translation - @mit10976 @Isa13169 @nia13404

* Update translation - @mit10976 @Isa13169 @nia13404

* Fix toolkit warnings

* Deprecate PopupManager property

* Don't use PopupManager property that is deprecated

* Address build warnings from recent SDK updates

* Use fonticon instead of bitmap for basemap gallery

* Don't use deprecated overload

* Delete unused resources

* Remove use of image icons in MeasureToolbar and use FontIcon instead

This also avoids build warnings with packaging image content

* Fix nuget pack warnins caused by duplicate analyzer includes

* Fix tetformelements not rendering inside groups

* Mark WinRT classes partial for better AoT support

* Fix font references in UWP and WinUI (#611)

* Remove unused attribute that also generates app build errors

---------

Co-authored-by: Morten Nielsen <[email protected]>
Co-authored-by: Prathamesh Narkhede <[email protected]>
Co-authored-by: Prathamesh Narkhede <[email protected]>
Co-authored-by: Matvei Stefarov <[email protected]>
Co-authored-by: Jonathan Turpin <[email protected]>
  • Loading branch information
6 people authored Nov 25, 2024
1 parent 9312624 commit d4ea16b
Show file tree
Hide file tree
Showing 146 changed files with 4,345 additions and 1,344 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<DisableAGSRuntimeTFMCheck>true</DisableAGSRuntimeTFMCheck>
<SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences>
</PropertyGroup>

<ItemGroup>
Expand Down
8 changes: 6 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project>

<PropertyGroup>
<ArcGISRuntimeToolkitPackageVersion Condition="'$(ArcGISRuntimeToolkitPackageVersion)'==''">200.5.0</ArcGISRuntimeToolkitPackageVersion>
<ArcGISRuntimePackageVersion Condition="'$(ArcGISRuntimePackageVersion)'==''">200.5.0</ArcGISRuntimePackageVersion>
<ArcGISRuntimeToolkitPackageVersion Condition="'$(ArcGISRuntimeToolkitPackageVersion)'==''">200.6.0</ArcGISRuntimeToolkitPackageVersion>
<ArcGISRuntimePackageVersion Condition="'$(ArcGISRuntimePackageVersion)'==''">200.6.0</ArcGISRuntimePackageVersion>

<!--Common package properties-->
<Authors>Esri Inc.</Authors>
Expand Down Expand Up @@ -94,6 +94,10 @@
<Link>icon.png</Link>
<Visible>false</Visible>
</None>
<None Include="$(MSBuildThisFileDirectory)\THIRD-PARTY-NOTICES.TXT" Pack="true" PackagePath="\">
<Link>THIRD-PARTY-NOTICES.TXT</Link>
<Visible>false</Visible>
</None>
</ItemGroup>

<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<Grid RowSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="32" />
<RowDefinition Height="{OnPlatform WinUI=400, Default=Auto}" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<esri:MapView x:Name="MyMapView" Grid.Row="1" Grid.RowSpan="2" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<Page
x:Class="Esri.ArcGISRuntime.Toolkit.SampleApp.Samples.Forms.FeatureFormViewSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:esri="using:Esri.ArcGISRuntime.UI.Controls"
xmlns:toolkit="using:Esri.ArcGISRuntime.Toolkit.UI.Controls"
mc:Ignorable="d">

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<esri:MapView x:Name="mapView"
Map="{x:Bind Map}"
GeoViewTapped="mapView_GeoViewTapped"/>

<Grid HorizontalAlignment="Center" VerticalAlignment="Top" Margin="10" BorderThickness="1" BorderBrush="{ThemeResource ApplicationForegroundThemeBrush}">
<Border Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Opacity=".8" />
<TextBlock Text="Click a feature to open its FeatureFormView" FontSize="18" Margin="5" />
</Grid>

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Visibility="Collapsed" x:Name="SidePanel" Grid.Column="1">
<Border BorderBrush="{ThemeResource ApplicationForegroundThemeBrush}" BorderThickness="1,0,0,0" HorizontalAlignment="Center" Width="300" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<toolkit:FeatureFormView x:Name="formViewer" Margin="5,5,5,0" VerticalScrollBarVisibility="Hidden" Grid.ColumnSpan="3" />
<Border BorderThickness="0,1,0,0" BorderBrush="{ThemeResource ApplicationForegroundThemeBrush}" Background="#eeeeee" Grid.Row="1" Grid.ColumnSpan="3" Padding="5">
<Grid>
<Grid.ColumnDefinitions >
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button Content="Close" Background="#007AC2" Foreground="White" Padding="5" Click="CloseButton_Click" Grid.Column="0" HorizontalAlignment="Stretch" />
<Button Content="Reset" Margin="5,0" Background="#D83020" Foreground="White" Padding="5" Click="DiscardButton_Click" Grid.Column="1" HorizontalAlignment="Stretch" />
<Button Content="Apply" Background="#35AC46" Foreground="White" Padding="5" Click="UpdateButton_Click" Grid.Column="2" HorizontalAlignment="Stretch" />
</Grid>
</Border>
</Grid>
</Border>
</Grid>
</Grid>
</Page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
using Esri.ArcGISRuntime.Data;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Mapping.FeatureForms;
using Esri.ArcGISRuntime.Mapping.Popups;
using Esri.ArcGISRuntime.UI;
using Esri.ArcGISRuntime.UI.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using Windows.UI.Popups;

namespace Esri.ArcGISRuntime.Toolkit.SampleApp.Samples.Forms
{
public sealed partial class FeatureFormViewSample : Page
{
public FeatureFormViewSample()
{
this.InitializeComponent();
}

// Webmap configured with feature forms
public Map Map { get; } = new Map(new Uri("https://www.arcgis.com/home/item.html?id=f72207ac170a40d8992b7a3507b44fad"));
private async void mapView_GeoViewTapped(object sender, GeoViewInputEventArgs e)
{
try
{
var result = await mapView.IdentifyLayersAsync(e.Position, 3, false);

// Retrieves feature from IdentifyLayerResult with a form definition
var feature = GetFeature(result, out var def);
if (feature != null)
{
formViewer.FeatureForm = new FeatureForm(feature);
SidePanel.Visibility = Visibility.Visible;
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("Error: " + ex.Message);
}
}

private ArcGISFeature GetFeature(IEnumerable<IdentifyLayerResult> results, out FeatureFormDefinition def)
{
def = null;
if (results == null)
return null;
foreach (var result in results.Where(r => r.LayerContent is FeatureLayer layer && (layer.FeatureFormDefinition is not null || (layer.FeatureTable as ArcGISFeatureTable)?.FeatureFormDefinition is not null)))
{
var feature = result.GeoElements?.OfType<ArcGISFeature>()?.FirstOrDefault();
def = (result.LayerContent as FeatureLayer)?.FeatureFormDefinition ?? ((result.LayerContent as FeatureLayer)?.FeatureTable as ArcGISFeatureTable)?.FeatureFormDefinition;
if (feature != null && def != null)
{
return feature;
}
}

return null;
}

private async void DiscardButton_Click(object sender, RoutedEventArgs e)
{
ContentDialog dialog = new ContentDialog
{
Title = "Discard edits?",
Content = "Are you sure you want to discard edits?",
PrimaryButtonText = "Yes",
CloseButtonText = "No",
#if !WINDOWS_UWP
XamlRoot = this.XamlRoot
#endif
};
var result = await dialog.ShowAsync();
if (result == ContentDialogResult.Primary)
{
((Button)sender).IsEnabled = false;
try
{
await formViewer.DiscardEditsAsync();
}
catch { }
((Button)sender).IsEnabled = true;
}
}

private void CloseButton_Click(object sender, RoutedEventArgs e)
{
formViewer.FeatureForm = null;
SidePanel.Visibility = Visibility.Collapsed;
}

private async void UpdateButton_Click(object sender, RoutedEventArgs e)
{
if (!formViewer.IsValid)
{
var errorsMessages = formViewer.FeatureForm.Elements.OfType<FieldFormElement>().Where(e => e.ValidationErrors.Any()).Select(s => s.FieldName + ": " + string.Join(",", s.ValidationErrors.Select(e => e.Message)));
if (errorsMessages.Any())
{
await new ContentDialog
{
Title = "Can't apply",
Content = "Form has errors:\n" + string.Join("\n", errorsMessages),
PrimaryButtonText = "OK",
#if !WINDOWS_UWP
XamlRoot = this.XamlRoot
#endif
}.ShowAsync();
return;
}
}
try
{
await formViewer.FinishEditingAsync();
}
catch (Exception ex)
{
await new ContentDialog
{
Title = "Error",
Content = "Failed to apply edits:\n" + ex.Message,
PrimaryButtonText = "OK",
#if !WINDOWS_UWP
XamlRoot = this.XamlRoot
#endif
}.ShowAsync();
}
}
}
}
9 changes: 8 additions & 1 deletion src/Samples/Toolkit.SampleApp.UWP/Toolkit.Samples.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@
<Compile Include="Samples\FloorFilter\FloorFilterSample.xaml.cs">
<DependentUpon>FloorFilterSample.xaml</DependentUpon>
</Compile>
<Compile Include="Samples\Forms\FeatureFormViewSample.xaml.cs">
<DependentUpon>FeatureFormViewSample.xaml</DependentUpon>
</Compile>
<Compile Include="Samples\GeoViewController\GeoViewControllerSample.xaml.cs">
<DependentUpon>GeoViewControllerSample.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -231,6 +234,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Samples\Forms\FeatureFormViewSample.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Samples\GeoViewController\GeoViewControllerSample.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -351,4 +358,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
31 changes: 31 additions & 0 deletions src/THIRD-PARTY-NOTICES.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
The ArcGIS Maps SDK for .NET Toolkit uses third-party libraries or other resources that
may be distributed under licenses different than the ArcGIS Maps SDK software.

The attached notices are provided for information only.

License notice for Markdig v0.31
=========================================

Copyright (c) 2018-2019, Alexandre Mutel
All rights reserved.

Redistribution and use in source and binary forms, with or without modification
, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16 changes: 5 additions & 11 deletions src/Toolkit/Toolkit.Maui/Esri.ArcGISRuntime.Toolkit.Maui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,19 @@
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible($(TargetFramework), 'net8.0'))">
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
<PackageReference Include="Markdig" Version="0.31.0" />
</ItemGroup>

<Import Project="..\..\CommonProperties.targets" />
<Import Project="..\Toolkit\Esri.ArcGISRuntime.Toolkit.Shared.projitems" Label="Shared" />
<Import Project="$(SolutionDir)toolkit.props" Condition="Exists('$(SolutionDir)toolkit.props')" />

<!-- Analyzers -->
<PropertyGroup>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);_AddAnalyzersToOutput</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Analyzers\Toolkit.Maui.Analyzers.CodeFixes\Esri.ArcGISRuntime.Toolkit.Maui.Analyzers.CodeFixes.csproj" PrivateAssets="all" />
<ProjectReference Include="..\..\Analyzers\Toolkit.Maui.Analyzers\Esri.ArcGISRuntime.Toolkit.Maui.Analyzers.csproj" PrivateAssets="all" />
<ProjectReference Include="..\..\Analyzers\Toolkit.Maui.Analyzers.CodeFixes\Esri.ArcGISRuntime.Toolkit.Maui.Analyzers.CodeFixes.csproj" PrivateAssets="all" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\..\Analyzers\Toolkit.Maui.Analyzers\Esri.ArcGISRuntime.Toolkit.Maui.Analyzers.csproj" PrivateAssets="all" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<None Include="..\..\Analyzers\Toolkit.Maui.Analyzers\bin\$(Configuration)\netstandard2.0\Esri.ArcGISRuntime.Toolkit.Maui.Analyzers.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Link="analyzers\dotnet\cs\Esri.ArcGISRuntime.Toolkit.Maui.Analyzers.dll" />
<None Include="..\..\Analyzers\Toolkit.Maui.Analyzers.CodeFixes\bin\$(Configuration)\netstandard2.0\Esri.ArcGISRuntime.Toolkit.Maui.Analyzers.CodeFixes.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Link="analyzers\dotnet\cs\Esri.ArcGISRuntime.Toolkit.Maui.Analyzers.CodeFixes.dll" />
<None Include="tools\*.ps1" CopyToOutputDirectory="PreserveNewest" Pack="true" PackagePath="tools" />
</ItemGroup>
<Target Name="_AddAnalyzersToOutput">
<ItemGroup>
<TfmSpecificPackageFile Include="$(OutputPath)\Esri.ArcGISRuntime.Toolkit.Maui.Analyzers.dll" PackagePath="analyzers/dotnet/cs" />
<TfmSpecificPackageFile Include="$(OutputPath)\Esri.ArcGISRuntime.Toolkit.Maui.Analyzers.CodeFixes.dll" PackagePath="analyzers/dotnet/cs" />
</ItemGroup>
</Target>
</Project>
Loading

0 comments on commit d4ea16b

Please sign in to comment.