private async void btnRefresh_Click(object sender, RoutedEventArgs e) { // UserSession.ClientSideObject.Capabilities = await WMSProviderBase.WMSCapabilitiesRetrieve(UserSession.strWMSGeoserverUrl); string strWMSGeoserverUrl = ConfigurationManager.AppSettings["WMSGeoserver"]; if (string.IsNullOrEmpty(strWMSGeoserverUrl)) { return; } WMSCapabilities Capabilities = await WMSProviderBase.WMSCapabilitiesRetrieve(strWMSGeoserverUrl); //if (UserSession.ClientSideObject.Capabilities.Error != null) //{ // string Msg = "WMS Server:" + "\n"; // Msg = Msg + UserSession.ClientSideObject.Capabilities.Error; // ComponentsUtility.KGMsgBox.ShowCustomMsgOk(System.Windows.Application.Current.MainWindow, // Msg, 5000, true); //} //else //{ // SetData(); //} SetData(); }
public async void SetData() { string strWMSGeoserverUrl = ConfigurationManager.AppSettings["WMSGeoserver"]; if (string.IsNullOrEmpty(strWMSGeoserverUrl)) { return; } WMSCapabilities Capabilities = await WMSProviderBase.WMSCapabilitiesRetrieve(strWMSGeoserverUrl); List <WMSProviderSelectedMaps> HelperList = new List <WMSProviderSelectedMaps>(); if (Capabilities != null) { //List<GMap.NET.MapProviders.GMapProvider> Layers = null; // Layers = UserSession.ClientSideObject.GetGMapLayers(); UserMaps Layers = await SAGSignalR.GetUserMaps(VMMainViewModel.Instance.SimulationHubProxy, VMMainViewModel.Instance.UserName); int n = 1000; foreach (CustomImageInfo Info in Capabilities.Layers) { n++; WMSProviderSelectedMaps map = new WMSProviderSelectedMaps(); map.MapName = Info.MapName; map.isSelected = false; map.SeqNumber = n; map.UserMinZoom = 0; map.UserMaxZoom = 24; HelperList.Add(map); } if (Layers != null) { for (int i = 0; i < Layers.maps.Length; i++) { UserMapPreference layer = Layers.maps[i]; WMSProviderSelectedMaps map = HelperList.Where(l => l.MapName == layer.MapName).SingleOrDefault(); if (map != null) { map.SeqNumber = i; map.isSelected = true; map.UserMinZoom = layer.MinZoom; map.UserMaxZoom = (int)layer.MaxZoom; } } } HelperList.Sort(delegate(WMSProviderSelectedMaps Struct1, WMSProviderSelectedMaps Struct2) { int Compare = 0; if (Struct2.SeqNumber < Struct1.SeqNumber) { Compare = 1; } else if (Struct2.SeqNumber == Struct1.SeqNumber) { Compare = 0; } else { Compare = -1; } return(Compare); }); } dataGridLayerName.ItemsSource = null; dataGridLayerName.ItemsSource = HelperList; }