private void Application_Startup(object sender, StartupEventArgs e) { try { // Deployed applications must be licensed at the Lite level or greater. // See https://developers.arcgis.com/licensing for further details. // Pull license key listed in App.xaml var licenseKey = Application.Current.Resources["ArcGISRuntimeLicenseKey"] as string; if (!string.IsNullOrEmpty(licenseKey) && licenseKey != "INSERT_KEY_HERE") { ArcGISRuntimeEnvironment.SetLicense(licenseKey); } // Initialize the ArcGIS Runtime before any components are created. ArcGISRuntimeEnvironment.Initialize(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "ArcGIS Runtime initialization failed."); // Exit application this.Shutdown(); } }
public async void Initialize() { // ライセンスキーを登録して Lite ライセンスの認証を行う string licenseKey = "xxxx"; ArcGISRuntimeEnvironment.SetLicense(licenseKey); MobileMapPackage myMapPackage = await MobileMapPackage.OpenAsync(@"..\..\..\..\SampleData\sample_maps.mmpk"); // マップ ビューの持つ Map プロパティにモバイル マップ パッケージが持つマップを割り当てる MyMapView.Map = myMapPackage.Maps.First(); // 背景に ArcGIS Online の衛星画像サービスを表示する MyMapView.Map.Basemap = Basemap.CreateImagery(); // マップのレイヤーを取得してレイヤーの透過率を設定 MyMapView.Map.OperationalLayers[0].Opacity = 0.5; // マップのスケール範囲を設定 MyMapView.Map.MinScale = 5000000; MyMapView.Map.MaxScale = 5000; // マップに追加されているレイヤーの一覧取得 TreeViewMultipleTemplatesSample(); // マップ ビューのタップイベント MyMapView.GeoViewTapped += MyMapView_GeoViewTapped; }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { // Deployed applications must be licensed at the Lite level or greater. // See https://developers.arcgis.com/licensing for further details. if (LicenseKey == "ADD_LICENSE_KEY") { Debug.WriteLine(""); Debug.WriteLine("Please add the license on App.cs file"); Debug.WriteLine(""); } else #pragma warning disable 162 { // Initialize the ArcGIS Runtime before any components are created. ArcGISRuntimeEnvironment.SetLicense(LicenseKey, ExtensionLicenseKeys); } #pragma warning restore 162 ArcGISRuntimeEnvironment.Initialize(); UnhandledException += App_UnhandledException; InitializeComponent(); Suspending += OnSuspending; }
public App() { ArcGISRuntimeEnvironment.SetLicense("runtimelite,1000,rud1037892786,none,A3E60RFLTJKS6XCFK015"); InitializeComponent(); Initialize(); SetMainPage(); }
public App() { // Deployed applications must be licensed at the Lite level or greater. // See https://developers.arcgis.com/licensing for further details. // Initialize the ArcGIS Runtime before any components are created. ArcGISRuntimeEnvironment.SetLicense("runtimebasic,1000,rud000252796,none,MJJ47AZ7G349NERL1216"); ArcGISRuntimeEnvironment.Initialize(); Resources.Add("RouteServiceProxy", "https://utility.arcgis.com/usrsvcs/appservices/uoBbS3YqJ0gRi2Ab/rest/services/World/Route/NAServer/Route_World/solve"); // The root page of your application MainPage = new NavigationPage(new MapPage()); // (new OAuthPage()); }
protected override async void OnInitialized() { try { InitializeComponent(); ArcGISRuntimeEnvironment.SetLicense("runtimelite,1000,rud2450418794,none,2K0RJAY3FLBBP2ELJ051"); AppCenter.Start("android=9efaf29a-ff01-412f-abc1-0cdd26cdc592;ios=82ebcc8d-f204-4c29-87c1-8a106912da18", typeof(Crashes), typeof(Analytics)); base.Container.Resolve <ErrorManager>().IsEnabled = true; base.Container.Resolve <AnalyticsManager>().IsEnabled = true; await base.NavigationService.NavigateAsync("MainPage"); } catch (Exception) { } }
public MapViewModel() { ArcGISRuntimeEnvironment.Initialize(); var uri = new Uri("http://petr-divis.maps.arcgis.com/sharing/rest"); var portal = ArcGISPortal.CreateAsync(uri).Result; // once connected, get the license info from the portal for the current user var licenseInfo = portal.PortalInfo.LicenseInfo; // set the license using the static ArcGISRuntimeEnvironment class ArcGISRuntimeEnvironment.SetLicense(licenseInfo); var portalItem = PortalItem.CreateAsync(portal, "69fdcd8e40734712aaec34194d4b988c").Result; Map = new Map(portalItem); }
private async void Application_Startup(object sender, StartupEventArgs e) { log4net.Config.XmlConfigurator.Configure(); MaximoServiceLibrary.AppContext.maximoService.BASE_HOST = System.Configuration.ConfigurationManager.AppSettings["MaximoBaseUrl"]; MaximoServiceLibrary.AppContext.Log.Info($"BASE_HOST : { MaximoServiceLibrary.AppContext.maximoService.BASE_HOST}"); try { // Challenge the user for portal credentials (OAuth credential request for arcgis.com) try { //LicenseInfo.FromJson("{\"licenseString\":\"plv1qGVKC+Nq1nPxZhTCMc+I/bhdFqNX7Wkfszv6sjTcoiftoW0c8p0q/6JZ\"}"); var licenseKey = System.Configuration.ConfigurationManager.AppSettings["runtimeLicenseKey"]; ArcGISRuntimeEnvironment.SetLicense(licenseKey); } catch (Exception e2) { MaximoServiceLibrary.AppContext.Log.Error(e2.ToString()); } ArcGISRuntimeEnvironment.Initialize(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "ArcGIS Runtime initialization failed.", MessageBoxButton.OK); MaximoServiceLibrary.AppContext.Log.Error(ex.ToString()); // Exit application this.Shutdown(); } AppDomain currentDomain = default(AppDomain); currentDomain = AppDomain.CurrentDomain; // Handler for unhandled exceptions. currentDomain.UnhandledException += GlobalUnhandledExceptionHandler; // Handler for exceptions in threads behind forms. System.Windows.Forms.Application.ThreadException += GlobalThreadExceptionHandler; }
private void Application_Startup(object sender, StartupEventArgs e) { try { // Deployed applications must be licensed at the Lite level or greater. // See https://developers.arcgis.com/licensing for further details. var licenseKey = Environment.GetEnvironmentVariable(@"arcgisruntime.license.key"); if (!string.IsNullOrEmpty(licenseKey)) { ArcGISRuntimeEnvironment.SetLicense(licenseKey); } // Initialize the ArcGIS Runtime before any components are created. ArcGISRuntimeEnvironment.Initialize(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "ArcGIS Runtime initialization failed."); // Exit application this.Shutdown(); } }
public async void licence() { // Challenge the user for portal credentials (OAuth credential request for arcgis.com) CredentialRequestInfo loginInfo = new CredentialRequestInfo(); // Use the OAuth implicit grant flow loginInfo.GenerateTokenOptions = new GenerateTokenOptions { TokenAuthenticationType = TokenAuthenticationType.OAuthImplicit, }; // Indicate the url (portal) to authenticate with (ArcGIS Online) loginInfo.ServiceUri = new Uri("http://www.arcgis.com/sharing/rest"); try { // Call GetCredentialAsync on the AuthenticationManager to invoke the challenge handler Credential cred = await AuthenticationManager.Current.GetCredentialAsync(loginInfo, false); // Connect to the portal (ArcGIS Online) using the credential ArcGISPortal arcgisPortal = await ArcGISPortal.CreateAsync(loginInfo.ServiceUri, cred); // Get LicenseInfo from the portal LicenseInfo licenseInfo = await arcgisPortal.GetLicenseInfoAsync(); // ... code here to license the app immediately and/or save the license (JSON string) to take the app offline ... // License the app using the license info ArcGISRuntimeEnvironment.SetLicense(licenseInfo); } catch (Exception ex) { Console.WriteLine("Unable to initialize the ArcGIS Runtime with the client ID provided: " + ex.Message); // TODO: handle exceptions } }
public static void Initialize() { ArcGISRuntimeEnvironment.Initialize(); ArcGISRuntimeEnvironment.SetLicense(ARCGIS_LITE_LICENSE_KEY); }