Skip to content

Commit

Permalink
Improved error messages for local server samples (#805)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZackAllen authored Jun 26, 2020
1 parent 5bcb4d0 commit a514a60
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
using Esri.ArcGISRuntime.LocalServices;
using Esri.ArcGISRuntime.Mapping;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Windows;

namespace ArcGISRuntime.WPF.Samples.LocalServerFeatureLayer
Expand All @@ -23,7 +25,7 @@ namespace ArcGISRuntime.WPF.Samples.LocalServerFeatureLayer
description: "Start a local feature service and display its features in a map.",
instructions: "A Local Server and Local Feature Service will automatically be started. Once started then a `FeatureLayer` will be created and added to the map.",
tags: new[] { "feature service", "local", "offline", "server", "service" })]
[ArcGISRuntime.Samples.Shared.Attributes.OfflineData("4e94fec734434d1288e6ebe36c3c461f")]
[ArcGISRuntime.Samples.Shared.Attributes.OfflineData("4e94fec734434d1288e6ebe36c3c461f")]
public partial class LocalServerFeatureLayer
{
// Hold a reference to the local feature service; the ServiceFeatureTable will be loaded from this service
Expand Down Expand Up @@ -62,7 +64,10 @@ private async void Initialize()
}
catch (Exception ex)
{
MessageBox.Show(String.Format("Please ensure that local server is installed prior to using the sample. See instructions in readme.md. Message: {0}", ex.Message), "Local Server failed to start");
var localServerTypeInfo = typeof(LocalMapService).GetTypeInfo();
var localServerVersion = FileVersionInfo.GetVersionInfo(localServerTypeInfo.Assembly.Location);

MessageBox.Show($"Please ensure that local server {localServerVersion.FileVersion} is installed prior to using the sample. The download link is in the description. Message: {ex.Message}", "Local Server failed to start");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ This sample downloads the following items from ArcGIS Online automatically:

## Additional information

Local Server can be downloaded for Windows and Linux platforms. Local Server is not supported on macOS.
Local Server can be downloaded for Windows and Linux platforms from the [developers website](https://developers.arcgis.com/downloads/apis-and-sdks?product=local-server#arcgis-runtime-local-server). Local Server is not supported on macOS.

## Tags

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
using Esri.ArcGISRuntime.Tasks;
using Esri.ArcGISRuntime.Tasks.Geoprocessing;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;

Expand All @@ -25,7 +27,7 @@ namespace ArcGISRuntime.WPF.Samples.LocalServerGeoprocessing
description: "Create contour lines from local raster data using a local geoprocessing package `.gpk` and the contour geoprocessing tool.",
instructions: "Contour Line Controls (Top Left):",
tags: new[] { "geoprocessing", "local", "offline", "parameters", "processing", "service" })]
[ArcGISRuntime.Samples.Shared.Attributes.OfflineData("f7c7b4a30fb9415896ba0d1921fe014b", "da9e565a52ca41c1937cff1a01017068")]
[ArcGISRuntime.Samples.Shared.Attributes.OfflineData("f7c7b4a30fb9415896ba0d1921fe014b", "da9e565a52ca41c1937cff1a01017068")]
public partial class LocalServerGeoprocessing
{
// Hold a reference to the local geoprocessing service
Expand Down Expand Up @@ -98,7 +100,10 @@ private async void Initialize()
}
catch (Exception ex)
{
MessageBox.Show(String.Format("Please ensure that local server is installed prior to using the sample. See instructions in readme.md. Message: {0}", ex.Message), "Local Server failed to start");
var localServerTypeInfo = typeof(LocalMapService).GetTypeInfo();
var localServerVersion = FileVersionInfo.GetVersionInfo(localServerTypeInfo.Assembly.Location);

MessageBox.Show($"Please ensure that local server {localServerVersion.FileVersion} is installed prior to using the sample. The download link is in the description. Message: {ex.Message}", "Local Server failed to start");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ This sample downloads the following items from ArcGIS Online automatically:

## Additional information

Local Server can be downloaded for Windows and Linux platforms. Local Server is not supported on macOS.
Local Server can be downloaded for Windows and Linux platforms from the [developers website](https://developers.arcgis.com/downloads/apis-and-sdks?product=local-server#arcgis-runtime-local-server). Local Server is not supported on macOS.

## Tags

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
using Esri.ArcGISRuntime.LocalServices;
using Esri.ArcGISRuntime.Mapping;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Windows;

namespace ArcGISRuntime.WPF.Samples.LocalServerMapImageLayer
Expand All @@ -22,7 +24,7 @@ namespace ArcGISRuntime.WPF.Samples.LocalServerMapImageLayer
description: "Start the Local Server and Local Map Service, create an ArcGIS Map Image Layer from the Local Map Service, and add it to a map.",
instructions: "The Local Server and local map service will automatically be started and, once running, a map image layer will be created and added to the map.",
tags: new[] { "image", "layer", "local", "offline", "server" })]
[ArcGISRuntime.Samples.Shared.Attributes.OfflineData("dee5d8060a6048a4b063484199a9546b")]
[ArcGISRuntime.Samples.Shared.Attributes.OfflineData("dee5d8060a6048a4b063484199a9546b")]
public partial class LocalServerMapImageLayer
{
// Hold a reference to the local map service
Expand Down Expand Up @@ -85,7 +87,10 @@ private async void Initialize()
}
catch (Exception ex)
{
MessageBox.Show(string.Format("Please ensure that local server is installed prior to using the sample. See instructions in readme.md. Message: {0}", ex.Message), "Local Server failed to start");
var localServerTypeInfo = typeof(LocalMapService).GetTypeInfo();
var localServerVersion = FileVersionInfo.GetVersionInfo(localServerTypeInfo.Assembly.Location);

MessageBox.Show($"Please ensure that local server {localServerVersion.FileVersion} is installed prior to using the sample. The download link is in the description. Message: {ex.Message}", "Local Server failed to start");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ This sample downloads the following items from ArcGIS Online automatically:

## Additional information

Local Server can be downloaded for Windows and Linux platforms. Local Server is not supported on macOS.
Local Server can be downloaded for Windows and Linux platforms from the [developers website](https://developers.arcgis.com/downloads/apis-and-sdks?product=local-server#arcgis-runtime-local-server). Local Server is not supported on macOS.

## Tags

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
using ArcGISRuntime.Samples.Managers;
using Esri.ArcGISRuntime.LocalServices;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;

Expand All @@ -23,7 +25,7 @@ namespace ArcGISRuntime.WPF.Samples.LocalServerServices
description: "Demonstrates how to start and stop the Local Server and start and stop a local map, feature, and geoprocessing service running on the Local Server.",
instructions: "Click `Start Local Server` to start the Local Server. Click `Stop Local Server` to stop the Local Server.",
tags: new[] { "feature", "geoprocessing", "local services", "map", "server", "service" })]
[ArcGISRuntime.Samples.Shared.Attributes.OfflineData("dee5d8060a6048a4b063484199a9546b", "4e94fec734434d1288e6ebe36c3c461f", "da9e565a52ca41c1937cff1a01017068")]
[ArcGISRuntime.Samples.Shared.Attributes.OfflineData("dee5d8060a6048a4b063484199a9546b", "4e94fec734434d1288e6ebe36c3c461f", "da9e565a52ca41c1937cff1a01017068")]
public partial class LocalServerServices
{
// Hold references to the individual services
Expand Down Expand Up @@ -54,7 +56,10 @@ private void Initialize()
}
catch (Exception ex)
{
MessageBox.Show(String.Format("Please ensure that local server is installed prior to using the sample. See instructions in readme.md. Message: {0}", ex.Message), "Local Server failed to start");
var localServerTypeInfo = typeof(LocalMapService).GetTypeInfo();
var localServerVersion = FileVersionInfo.GetVersionInfo(localServerTypeInfo.Assembly.Location);

MessageBox.Show($"Please ensure that local server {localServerVersion.FileVersion} is installed prior to using the sample. The download link is in the description. Message: {ex.Message}", "Local Server failed to start");
}
}

Expand Down Expand Up @@ -213,7 +218,7 @@ private async void StartServerButtonClicked(object sender, RoutedEventArgs e)
string tempDataPath = Path.Combine(tempDataPathRoot, "EsriSamples", "AppData");
Directory.CreateDirectory(tempDataPath); // CreateDirectory won't overwrite if it already exists.
LocalServer.Instance.AppDataPath = tempDataPath;

// Start the server
await LocalServer.Instance.StartAsync();

Expand All @@ -222,7 +227,10 @@ private async void StartServerButtonClicked(object sender, RoutedEventArgs e)
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Local Server Failed to start");
var localServerTypeInfo = typeof(LocalMapService).GetTypeInfo();
var localServerVersion = FileVersionInfo.GetVersionInfo(localServerTypeInfo.Assembly.Location);

MessageBox.Show($"Please ensure that local server {localServerVersion.FileVersion} is installed prior to using the sample. The download link is in the description. Message: {ex.Message}", "Local Server failed to start");
}

// Update the UI
Expand Down Expand Up @@ -264,12 +272,12 @@ private void NavigateButtonClicked(object sender, RoutedEventArgs e)
string serviceUri = strFullName.Split(splitChars, 2)[1].Trim();

// Navigate to the service
System.Diagnostics.Process.Start(serviceUri);
Process.Start(serviceUri);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Couldn't navigate to service");
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ To start a `LocalServer` and attach a `LocalService`:

## Additional information

Local Server can be downloaded for Windows and Linux platforms. Local Server is not supported on macOS.
Local Server can be downloaded for Windows and Linux platforms from the [developers website](https://developers.arcgis.com/downloads/apis-and-sdks?product=local-server#arcgis-runtime-local-server). Local Server is not supported on macOS.

## Tags

Expand Down

0 comments on commit a514a60

Please sign in to comment.