Giter VIP home page Giter VIP logo

data-collection-dotnet's Introduction

Data Collection .NET


Data Collection for .NET shows how a robust application can be built with the ArcGIS Platform using the ArcGIS Runtime SDK for .NET, WPF, and UWP. It demonstrates best practices around some simple but key functionality of the ArcGIS Runtime. Using your organization's web maps, you can use Data Collection as-is, or extend it to meet your specific needs.

Screenshot of the data collection app for WPF, showing the Portland Tree Survey dataset with an identified feature popup

Features

  • Take your web map and data offline
  • Edit your data both offline and online
  • Synchronize offline edits
  • View and edit your data with Popups
  • Work with Features, Popups, Attachments, and PopupManager
  • Edit and query Feature Tables
  • Work with related records
  • Identify map features
  • Authenticate with Portal using OAuth
  • Use the World Geocoder service
  • Use Popup configuration to drive app behavior
  • Navigate to bookmarks defined in the web map
  • Show and hide layers with a table of contents
  • View symbology for layers in the map with a legend

Best practices

The project also demonstrates some patterns for building real-world apps around the ArcGIS Runtime SDK.

  • Map-centric UI design
  • ArcGIS asynchronous service pattern
  • Cross-platform application design
  • Model-View-ViewModel pattern

Detailed Documentation

Read the docs for a detailed explanation of the application, including its architecture and how it leverages the ArcGIS platform, as well as how you can begin using the app right away.

Get started

You will need Visual Studio 2017 or later (2019 or later is recommended).

Fork the repo

Fork the Data Collection repo.

Clone the repo

Once you have forked the repo, you can make a clone and open DataCollection.sln in Visual Studio.

Command line Git

  1. Clone Data Collection
  2. cd into into the cloned repository's directory
  3. Make your changes and create a pull request

Configuring a Remote for a Fork

If you make changes in the fork and would like to sync those changes with the upstream repository, you must first configure the remote. This will be required when you have created local branches and would like to make a pull request to your upstream branch.

  1. In the Terminal (for Mac users) or command prompt (for Windows and Linux users) type git remote -v to list the current configured remote repo for your fork.
  2. git remote add upstream https://github.com/Esri/data-collection-dotnet.git to specify new remote upstream repository that will be synced with the fork. You can type git remote -v to verify the new upstream.

If there are changes made in the original repository, you can sync the fork to keep it updated with upstream repository.

  1. In the terminal, change the current working directory to your local project
  2. Type git fetch upstream to fetch the commits from the upstream repository
  3. git checkout master to checkout your fork's local master branch.
  4. git merge upstream/master to sync your local master branch with upstream/master. Note: Your local changes will be retained and your fork's master branch will be in sync with the upstream repository.

Configure the app

The app can be run as-is, but it's recommended you do some configuration to set up OAuth to be relevant to your users. At minimum, the app should not be deployed without these changes:

  1. Register an ArcGIS Portal Application.
  2. Configure Data Collection project to reference that application.
  3. License the app to remove the Developer Mode watermark and for deployment.

1. Register an application

For OAuth configuration, create a new Application in your ArcGIS Portal to obtain a Client ID and configure a Redirect URL. The Client ID configures the ArcGIS Runtime to show your users, during the login process, that the application was built by you and can be trusted. The Redirect URL configures the OAuth process to then return to your app once authentication is complete.

  1. Log in to https://developers.arcgis.com with either your ArcGIS Organizational Account or an ArcGIS Developer Account.
  2. Register a new Application, following the instructions in Register your applications.
  3. Note the Client ID and add a Redirect URL, e.g. data-collection://auth. You will use these values in the Configuring the project section below.

2. Configure the project

  1. Open the solution in Visual Studio and browse to the file named Configuration.xml located in the Properties directory of the DataCollection.Shared project.
  2. (Optionally) configure the WebmapURL to match your organization's webmap.
  3. Configure the OAuth Redirect URL.
    • Set the RedirectURL property to match the Redirect URL you have set up when you registered your application (see section above).
  4. Configure the Client ID.
    • Set the ClientID property with the Client ID generated when you registered your application (see section above).

Learn more

Learn more about Esri Open Source Apps here.

Requirements

  • Visual Studio 2017 or later
    • Visual Studio 2019 is required if you want to use the .NET Core version of the WPF app.
  • ArcGIS Runtime SDK for .NET
  • To edit records or take a web map offline you will need an ArcGIS Online Organizational account, an ArcGIS Online Developer account, or an ArcGIS Online account authenticated using a social login.
  • To consume your own web map you will need an ArcGIS Online Organizational account.

Contribute

Anyone and everyone is welcome to contribute. We do accept pull requests.

  1. Get involved
  2. Report issues
  3. Contribute code
  4. Improve documentation

MDTOC

Generating table of contents for documents in this repository was performed using the MDTOC package for Atom.

License

Copyright 2021 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's LICENSE file.

For information about licensing your deployed app, see License your app.

3rd-party component licensing

This project uses the following 3rd-party components:

data-collection-dotnet's People

Contributors

codergrl avatar dotmorten avatar esreli avatar mikewilburn avatar nathancastle avatar ncastle1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

data-collection-dotnet's Issues

Show app & runtime metadata alongside portal info

Currently the iOS and Android apps support displaying App & Runtime metadata, It appears the .Net app does not. Can we get this metadata added to the Profile view? In iOS, this information is derived by looking up information stored in the app's Bundle (not hardcoded).

I'm thinking this information would convey well just beneath the Sign In/ Sign Out button of the login pane.

Again, this request is inconsequential WRT this PR, if you find it more appropriate to do so we can move this request to a new issue.

Screen Shot 2020-09-15 at 2 34 50 PM

UWP: logging a new tree point doesn't persist Species related record information

When capturing a new tree point, I've run into several cases where selecting a related tree species does not save this information so that it's viewable outside of the edit session.

The same is also true of ArcGIS Online - the tree record doesn't appear to have a related Species record.

Here's a GIF showing the process of specifying a species, but which isn't available once the edit the saved:
missing-species

Peculiar behaviors when deleting the offline map

On WPF:

If you delete the currently-stored offline map, the application will throw an I/O exception like this one:

image

Clicking 'OK' successfully restarts the app and reveals the offline map is indeed deleted.

However, attempting to take offline a new section of map throws this same exception. The behavior loops and I haven't figured out how to work offline yet because of it.

On UWP:

If you delete the offline map, the application will crash right away.

The application can be re-launched just fine and reveals the offline map is indeed deleted, but on a few occasions, I've been re-prompted to sign in. Seems the crash may also force signing out the user?

'Invalid parameters' error when attaching new file

After attaching a new image, saving the edits consistently throws the message:

image

Tapping 'OK' to acknowledge this error and then 'X' to cancel committing the edits still persists the would-be attachment in the list of attachments view.

Tapping 'X' in the upper right of the popup view dialog to dismiss it, and then re-querying the point still reveals the attachment until the application is closed and reopened.

Unsupported file type allowed to be attached to a record

This was discovered while writing test case 11.2 in the test design.

Repro steps:

  • Try to attach an .exe (unsupported attachment type) to a record
  • Though the file may not appear in the directory (since unsupported file types are filtered out), you can manually type in the name of the file and open it this way
  • Click the save icon to complete attaching the file

Result:

  • the file looks like it has been attached, although exploring the attachments of that record from the online map viewer confirms it has not been
  • image
  • This is handled differently in the AGOL map viewer with an explicit message stating this cannot be done:
  • image

UWP CalendarDatePicker control doesn't show placeholder when date is null

The current CalendarDatePicker control in UWP does not show placeholder text if the date is null. Instead it shows the current date minus 100 years. This isn't ideal for the current app. This requires further investigation.
Potential ways to show Placeholder text:

  • change the binding to an x:Bind which does not seem to work due to the Two Way mode
  • create a custom control
  • edit style of current control

Current workaround implemented:

        private void CalendarDatePicker_Loaded(object sender, RoutedEventArgs e)
        {
            var datePicker = sender as CalendarDatePicker;
            if (datePicker.Date == datePicker.MinDate)
                datePicker.Date = null;
        }

Add UWP

Current app is WPF only but is cross platform ready. Add UWP UI to better demonstrate cross platform capabilities

UWP: Add tooltips to buttons

The buttons that appear along the bottom of the feature detail bladeview could benefit from tooltips that appear when hovering the cursor over the button itself.

Until clicked once or twice and seeing the resulting behavior, it's not altogether clear what their intended action really is.

While in view mode:
image

While in edit mode:
image

UWP: Clicking 'X' to dismiss the sign-in dialog returns the error "Portal item type incorrect"

I noticed on the dev branch that when the app is configured to view a web map that is not public, and when dismissing the sign-in dialog that appears by default, the map fails to load (which is expected), but cites an inaccurate error message.

image

In this case, an incorrect 'Map failed to load' error is given:
image

Signing in with valid credentials has no problem launching the expected web map.

Attaching large file gives the appearance of unresponsive UI

When saving edits to a record which includes attaching a large file (I tested with a 16.7 MB panorama JPEG), clicking the 'Save Edits' icon does not immediately give feedback to indicate the transaction has been initiated.

Only once the synchronization with the server is complete does the UI update and the 'Save Edits' icon reverts back to the pencil 'Edit Record' icon.

Compared to the user experience when attaching regularly-sized images (in which this icon update is nearly instantaneous), this gives the impression of an unresponsive UI, which prompted me to click the save button multiple times, which eventually resulted in multiple uploads of the attachment.

It would be convenient to provide some sort of acknowledgment (modal dialog?) to indicate that saving is in progress and which could also prevent multiple, successive clicking of the save icon.

Attachments tab view does not implement a vertical scrollbar

Unlike the 'Details' tab for a record, the 'Attachments` tab does not have a vertical scrollbar.

If the list of attachments is lengthier than what the vertical dimension of the application will permit being viewed, attachments in the bottom of the list cannot be accessed:

image image

Use app-specific location to store settings file

Change app to use app-specific location inside the local data folder rather than the root of the roaming folder to store the settings file. This ensures settings and credentials aren't roamed between PCs, and location of data is following best practices wrt local data location

Extension-less files allowed to be attached to a record

Steps to reproduce:

  • Remove the extension of a local file by renaming it (I did this by removing the .jpeg of an image)

  • In the application, browse to a tree point and upload that extension-less image as an attachment to that feature

  • Save the edits to persist them to the server

  • Notice that the file exists, but it cannot be rendered because there is no extension.

Question:
Should we validate to ensure users aren't specifying file names not bearing an extension as a feature attachment?

UWP: downloading an offline map completes successfully but raises 'token required' error

Even while logged in, downloading an offline map can throw this error after the download completes. (I haven't seen this consistently, but have run into it twice. If and when I can reproduce it more consistently, I'll update with specific steps.)

image

Note that clicking 'OK' on this message returns to the offline map and everything proceeds as expected. That I can tell, nothing about the offline map is impacted.

WPF: Add Cancel button to login window

The new design of the login window no longer has a cancel button within. The web viewer displaying the login needs to change to include a close button that will cancel the login.

This should also take care if issue #1

UWP: Remove time component when saving date fields

On WPF, the calendar date picker control sets a date, with the time set to 12:00:00AM. The UWP version sets a date and uses the current system time as the time value.

UWP should be updated to match the WPF behavior - default rather than system time.

The ideal would be to set a date with an explicitly null time, but that is not currently an option.

No close button in social platform login

There is no close button when user logs in through Google login. It would be nice to have a close button or a back button which would get back the user to the start page.

Will add a generic close button for the window that is part of the login prompt.

Removing a feature attachment still persists it in current app session

In the Runtime app:

  1. identify a feature that has some number of attachments on it
  2. do not close the app

In a web browser:

  1. using the AGOL map viewer, view the same web map
  2. edit the feature in by removing one of the attachments

Back in the Runtime app:

  1. in the same app session as before, re-identify the feature
  2. browse to the feature's attachments and notice that the deleted attachment still exists

Note: closing and reopening the app restores the correct view of the attachment; the deleted attachment will not appear.

Map interact-ability isn't consistent while editing a feature

This occurs on both WPF and UWP.

Repro steps:

  • Click a map feature to select it
  • In the detail view, click the 'Edit Feature' or 'Add Attachment' button to begin an edit session
  • Notice that you can still interact with the map (both panning & zooming is permitted)
  • Notice that you cannot update the feature selection on the map:
    • Either click a different feature to attempt to select it, or
    • Click off the currently-selected feature to attempt to de-select it

While toggling a feature selection probably doesn't make sense while editing, it feels a little odd to permit some map interact-ability (pan & zoom), but not others (selection).
As well, while you're in the 'Edit Attachments' detail view, it's not overly obvious that you are actively editing other than the fact that the 'Edit' & 'Delete' buttons change to 'Save' & 'Cancel'.

AttachmentsViewModel: remove workaround for handling random file name

Currently the API generates a random file name and extension when an attachment is downloaded. A workaround is in place to create a copy of the file with the proper extension so it can be opened by Windows. This workaround should be removed once the API implements algorithm that doesn't change the file name.

UWP: application won't view extension-less files

On UWP, if a record has an attachment without a file extension, clicking the 'Open attachment' button does nothing.

By comparison, WPF launches the following dialog:
image

For files with unrecognized extensions, this "How do you want to open this file?" dialog is prompted on both WPF as well as UWP.

UWP: use field alias in field validation message instead

When an invalid value is entered for a field, a validation message appears which cites the name of the field. This provides useful context if the application gets extended/customized to support entry of field values outside of this dedicated UI.

Since these can be named completely independently and may not resemble each other at all, and because there could potentially be a large disparity between the name of a field and its alias, this would be more useful if the field alias was used in the message instead.

Here's an example:
image

In the default service used for this app, here's a list of field names & aliases that do not match:
image

Attaching file with long name truncates to 40 characters (and doesn't indicate so)

When attaching files whose filenames exceed 40 characters, the uploaded file is truncated to include just the first 40 characters of the filename. This is all well and good, however the .NET app continues to show the original, un-truncated version of the filename until the next app session is launched and the attachments are retrieved from the server.

Expectation: truncate the file name in the active app session to indicate this is the case.

UWP: Confusing time behavior when setting dates

It looks like dates are being set with a time component. Because 6/25/2019 at 7 PM pacific happens at 3 AM on 6/26/2019 UTC, the date value ends up being changed.

I'm not good enough with time to be confident in the specifics, but this gif shows the issue:

2019-06-25_18-41-04

NOTE: this will only repro after 6PM in Redlands.

Attachment doesn't appear if it's the first attachment to be added to a record

Repro steps:

  • Select a record which doesn't have any attachments
  • Add an attachment to that record

Notice that even before saving, the attached file, or any successively-attached files within the same edit session, do not appear for the record.

Note: once saving the attachments to the record, deselecting it, then re-selecting it, the saved attachments to that record will appear.

I've seen this on both WPF & UWP, both when working online and offline.

UWP: inconsistent field and field value display prominence

It looks like the display prominence of fields/field values is not consistent between the main record and its related records.

Notice that for the main tree record, field headings appear in boldface and carry the greater prominence whereas the opposite is true for related records - field values are in boldface.

image

Enable syncing offline map while still online

I'd like to see the Profile view resemble in form and in function (with modifications made for desktop) to that of the iOS application and as it is specified. The reason why this specified design is an improvement to what is here (IMO) is because a user might want to synchronize or delete an offline map when they are operating in online work mode. Currently, a user much switch into offline mode in order to sync or delete the offline map. This presents an undue UX hurdle.

What this means WRT the design spec is that this view incoroprate items 5-8 and they adhere to the same layout and operate similarly (identical?) to how they operate in the iOS app.

Working Online, No Offline Map Working Online, Has Offline Map Working Offline
Screen Shot 2020-09-15 at 1 47 55 PM Screen Shot 2020-09-15 at 2 15 06 PM Screen Shot 2020-09-15 at 2 30 52 PM

This feature in its current form is acceptable because it solves the problem but I think there's room for improvement here and an opportunity to increase parity from platform to platform. If you think it better, we can extract this requirement from this PR and place it into its own issue. Do let me know what you want to do here, I can go either way.

Move resx from shared project to WPF project to avoid nonsense build error

Currently the resx file is in the shared project, but also explicitly listed in the WPF project. UWP isn't compatible with resx files (using resw instead). As a result, there is a build error on UWP; this doesn't actually prevent building, but is presented as an error in the Visual Studio UI.

image

UWP: Logging into the app is prevented

I've stumbled across a case where I've become logged out of the app, but am prevented from logging back in. Attempting to do so automatically raises a 'Login unsuccessful' message:

uwp-unable-to-log-in

When and if I determine steps to reproduce this, I'll update this issue.

Deselect currently-selected point when clicking elsewhere on map

After you've clicked a map feature to select/identify it, the two available methods for deselecting that tree point are:

  • Clicking the 'X' to close the popup view dialog
  • Clicking to select a different feature

A suggestion for a third possible method to consider:

  • Clicking a spot on the map in which no features exist

In effect, clicking the map in an area that doesn't cause another feature to be selected could also deselect the feature and dismiss the popup view dialog. This is an intuitive behavior for most other mapping applications which permit a feature to be identified or selected on the map.

In essence, it feels a little odd that this behavior doesn't exist already, so logging this enhancement.

UWP: update icon configuration options to appear consistent with others

When pinning the UWP app to the Windows Start Menu, its icon presently takes up the entire tile and does not include a subtitle. Compared with how this is being handled by other apps, this looks a bit odd.

Here's a comparison with the Collector for ArcGIS app at each of the small, medium, wide, and large tile sizes:

image image

image image

image image

image image

Resolve minor UI inconsistencies between UWP and WPF

I overlooked these while logging #34 and #40.

Whereas WPF provides consistent hover emphasis and tooltips for all buttons, UWP lacks these for a few, namely the Add Related Record, Show Detail, Close [Dialog], and Collapse [Dialog] buttons:

WPF example

2019-06-26 11 08 12

UWP example

2019-06-26 11 15 03

It would be great to shore up these inconsistencies and add them to UWP as well.

Attachments with long filenames aren't entirely visible

This is very low priority, but an observation I came across while testing the apps. On both WPF and UWP, the view of attached files is truncated such that the entire filename cannot be read.

image image

If I recall correctly, the application used to support this by permitting the cell showing the attachment to wrap several lines in order to accommodate these longer filenames.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.