public void TestCtor() { // set up var viewModel = new LayerListViewModel(); // run bool result = viewModel.WaitForPropertyChange(nameof(viewModel.LayerList), TimeSpan.FromSeconds(10)); // check Assert.IsTrue(result, "LayerList property must have been changed"); Assert.IsTrue(viewModel.LayerList.Any(), "layer list must not be empty"); Assert.IsFalse(viewModel.IsListEmpty, "layer list must not be empty"); Assert.IsTrue(viewModel.IsClearLayerListEnabled, "layer list must not be empty"); Assert.IsNotNull(viewModel.ImportLayerCommand, "command must not be null"); Assert.IsNotNull(viewModel.DeleteLayerListCommand, "command must not be null"); }
private void EndOfLayerSelection(LayerListViewModel listViewModel) { if (listView.DialogResult.HasValue && listView.DialogResult.Value) { ArcGISMapLayer layer = listViewModel.LayerSelected; if (layer != null) { // Control layer is not on the map Layer mapLayer = gisOperations.GetMap().Layers.FirstOrDefault(l => l.ID.Equals(layer.Title)); if (mapLayer == null) gisOperations.AddNewDynamicLayer(layer.RESTURL, layer.VisibleInitial, layer.Title, gisOperations.GetLayerTocSelected(),layer.ServiceType); } } listView = null; }
private void GetListCompleted(object sender, CompleteEvent e) { listLayers.layersListCompleted -= GetListCompleted; if (e.LayerList != null) { if (e.LayerList.Count > 0) { // Show window with the possible layers listView = new LayerListView(); LayerListViewModel listViewModel = new LayerListViewModel(e.LayerList); modalDialogService.ShowDialog(listView, listViewModel, EndOfLayerSelection); } else { ShowMessagebox.Raise(new Notification { Content = Silverlight.UI.Esri.JTToolbarCommon.Resources.ToolbarCommon.NoLayersAvailable, Title = Silverlight.UI.Esri.JTToolbarCommon.Resources.ToolbarCommon.Warning }); } } else { // Error occurred ShowErrorMessagebox.Raise(new Notification { Content = String.Format("GetListCompleted-{0}[{1}]", e.ErrorMessage, ""), Title = "System error" }); } }
public void Setup() { _vm = new LayerListViewModel(); _route = new Mock <IPath>().Object; }