public void TestDefaultCtor() { // set up var layerList = DataServiceHelper.GetInitialLayerList(); var page = new AddLayerPopupPage(layerList.First()); // check Assert.IsNotNull(page.Content, "page content must have been set"); }
/// <summary> /// Imports a layer file /// </summary> /// <param name="stream">stream to read from</param> /// <param name="filename">filename of file</param> /// <returns>task to wait on</returns> private static async Task ImportLayerFile(Stream stream, string filename) { string czml; using (var streamReader = new StreamReader(stream)) { czml = streamReader.ReadToEnd(); } if (!IsValidJson(czml)) { await App.Current.MainPage.DisplayAlert( Constants.AppTitle, "The file contained no valid CZML layer data", "OK"); return; } var layer = new Layer { Id = Guid.NewGuid().ToString("B"), Name = Path.GetFileNameWithoutExtension(filename), IsVisible = true, LayerType = LayerType.CzmlLayer, Data = czml }; layer = await AddLayerPopupPage.ShowAsync(layer); if (layer == null) { return; } var dataService = DependencyService.Get <IDataService>(); var layerList = await dataService.GetLayerListAsync(CancellationToken.None); layerList.Add(layer); await dataService.StoreLayerListAsync(layerList); await NavigationService.Instance.NavigateAsync(Constants.PageKeyMapPage, animated : true); App.AddMapLayer(layer); App.ZoomToLayer(layer); App.ShowToast("Layer was loaded."); }