-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
9312624
commit d4ea16b
Showing
146 changed files
with
4,345 additions
and
1,344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/Samples/Toolkit.SampleApp.UWP/Samples/Forms/FeatureFormViewSample.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
129 changes: 129 additions & 0 deletions
129
src/Samples/Toolkit.SampleApp.UWP/Samples/Forms/FeatureFormViewSample.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.