POST
|
I am trying to edit data from an ObjectClass after getting the first set of problems worked out (see http://forums.arcgis.com/threads/58680-Updating-data-in-a-Table) I thought it would be really nice to use the FeatureDataGrid and FeatureDataForm as is mentioned in a previous thread. While this is not required there is certainly some nice functionality there I would like to take advantage of. Setup the FeatureDataGrid no problem but does not seem to me there is a way to integrate the two tools. I would have thought that I could simply get the SelectedItem and that would be a Graphic which I could then set as the GraphicSource. But it seems the SelectedItem is an ESRI.ArcGIS.Client.Toolkit.DataSource.TempType2138779241 (seriously?), which is pretty worthless to me. The SelectedGraphic is also not of any use because it is never populated, I am assuming this is because this is an ObjectClass not a FeatureClass as the source. Maybe I am missing something. I have written a working application using the standard Silverlight Toolkit, but I think these tools are really nice and I would like to use them. Cheers -Joe
... View more
05-29-2012
03:19 AM
|
0
|
2
|
406
|
POST
|
I have heard middle of June is planned for release, but you probably want to ask your distributor for a more accurate answer is to when/how you would obtain
... View more
05-29-2012
01:33 AM
|
0
|
0
|
223
|
POST
|
If you go to the Code Gallery on the main Silverlight API page and search for print the are a number of samples that come up. If you can hold off a bit I would wait for 10.1 to be released as this has native print support as part of AGS
... View more
05-28-2012
11:00 PM
|
0
|
0
|
223
|
POST
|
I have followed the path outlined in the thread on editing records http://forums.arcgis.com/threads/21714-Editing-Tables-in-Feature-Service-with-Silverlight-4 and while that works for adding new records it does not address editing of existing rows in a table which I have found quite difficult partially because of what I would consider a bug with the API. When I create a FeatureLayer object in code like shown in the thread on adding records and call initialize on the FeatureLayer, when the Initialized is returned the Graphics collection is empty even though there are objects in my table. I have played around with different approaches when creating the FeatureLayer, giving OIDs putting a Where clause of ???OBJECTID > 0,??? but in all cases the Graphics collection is empty and never populates. What I have also tried is to add the FeatureLayer to the map in code still no luck. However, when the FeatureLayer is added to the map in Xaml it does have a populated Graphics collection. Why is there is different behavior when adding through Xaml compared to adding in code? I would consider that a bug. Once my Graphics collection is populated I am able to update a record by finding the proper Graphic object and changing the attributes and calling Save. Something along the lines of; Graphic graphic = _featureLayer.Graphics.Where(g => (int)g.Attributes[OBJECTID] == ObjectId).FirstOrDefault(); graphic[NAME] = newValue; _feaureLayer.Save(); Adding the FeatureLayer in Xaml is not really an option in how my application is designed (well it is an option, one that defeats the entire point in having architected a modular MVVM application). To me something is wrong, you should not have to add a FeatureLayer in Xaml to make something work, creating the object in code and calling initialize should have the same behavior. Could someone look into this, perhaps I am missing something. Cheers
... View more
05-28-2012
10:54 PM
|
0
|
4
|
585
|
POST
|
I am not exactly clear on what you are describing with how the map is exposed in you view model. You descriptions sounds as though you have a Layers collection on the ViewModel that is bound to the map in Xaml. Something along these lines below.
<esri:Map x:Name="MyMap" WrapAround="True" Extent="-15000000,2000000,-7000000,8000000" Layers="{Binding MapLayers}">
I have found that it is pretty much impossible to really create an ESRI Silverlight API application without exposing the Map object to the ViewModel, there are just too many things that need the Map object. What I do is have my main page implement an interface that exposes the Map.
public interface IMapView
{
Map Map { get; }
}
I use Dependency Injection (I use MEF, Unity is another Microsoft option) to get my IMapView object into my ViewModels. I don't actually have a ViewModel attached to the MainPage, instead my MainPage is made of numerous views each with it's own ViewModel. From here I would have a View (some kind of toolbar in this case) with an attached ViewModel. For a good navigation tool you kind of need toggle buttons, in my opinion. I have made those as custom controls that inherit from RadioButton. RadioButton because it already includes the behavior of only one being selected at a time, compared to core ToggleButton. There are a few ways to wire the commands, the most straight forward is to have the ViewModel expose an ICommand for each button and a bool for the IsSelected property. Something similar to below
<Buttons:MyToggleButton Text="{Binding Path=LanguageResource.ButtonText, Source={StaticResource LocalizedStrings}}"
IsChecked="{Binding ZoomInIsChecked, Mode=TwoWay}"
Click="{Binding ZoomCommand}" CommandParameter="ZoomIn" GroupName="ZoomButtons"/>
[Import]
public IMapView MapView {get;set;}
private ICommand _zoomCommand;
public ICommand ZoomCommand
{
get { return _zoomCommand?? (_zoomCommand= new DelegateCommand<string>(ExecuteZoomCommand)); }
}
private void ExecuteZoomCommand(string zoomType)
{
//Here would be my zoom logic
}
Something along those lines ties the Command to the view model Hope that helps
... View more
05-26-2012
08:40 AM
|
0
|
0
|
384
|
POST
|
ESRI changed these to match with Google and Bing which use WebMercator. This way the tiling scheme is the same for all the primary base maps sources. I cannot see that they would ever change back to WGS as it would mean having to support two different sets of cached maps. I agree that WGS84 makes a lot more sense to use as a projection
... View more
05-26-2012
03:51 AM
|
0
|
0
|
532
|
POST
|
Yassine, Sorry about the variable name error, the sample was not actually meant to be used as is, it was intended to show the two possible ways to setup the code depending on if a user was allowed to select only one row, or select more than one row I do not think I am clear about what you are trying to zoom to. What I thought you wanted to do is select a number of points in your map using a spatial query. For example, you would draw a box around a number of points and those points would then show up in the selected points datagrid. Then when you select an item in the data grid it would zoom to that point. So every time you click an item in the grid it zooms to a location on the map. For the sample I changed the code to this:
private void QueryDetailsDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
foreach (Graphic g in e.AddedItems)
{
g.Select();
MyMap.ZoomTo(g.Geometry);
}
foreach (Graphic g in e.RemovedItems)
g.UnSelect();
}
Which will now zoom to the state that was selected when the user clicks on the item in the datagrid. Can you please try to clarify if this is what you are trying to do. I think that your goal is different from my understanding. Thanks -Joe
... View more
05-26-2012
12:33 AM
|
0
|
0
|
465
|
POST
|
You can create a value converter that returns the image URL depending on the field values. Then you can bind the image inside the maptip to the Url coming from this converter. Interesting idea, thanks.
... View more
05-25-2012
07:28 AM
|
0
|
0
|
180
|
POST
|
What you are showing does not have anything to do with binding or MVVM so am not sure why are discussing it in that context. In the first line of you code you assign a variable to the GraphicsSource property and so you now have two variables reference that same object. When you make changes to the _graphics variable it is reflected in the GraphicsSource because they both reference that object. When you set _graphics = new ... The _graphics variable now references a new object. The original object that GraphicsSource is referencing has not been affected, GraphicsSource still references the same object it has the entire time. What it seems like you want is to have an object bound to the GraphicsSource.
<esri:GraphicsLayer ID="GL" GraphicsSource="{Binding GraphicsSource, Mode=TwoWay}" />
If you have a class like below that is set as the DataContext for your the GraphicsLayer (e.g., through setting the DataContext on the View with the map in it)
public class MyViewModel : INotifyPropertyChanged
{
private ObservableCollection<Graphic> _graphicsSource;
public ObservableCollection<Graphic> GraphicsSource
{
get { return _graphicsSource; }
set
{
_graphicsSource = value;
PropertyChanged("GraphicsSource");
}
}
#region Implementation of INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
if ( PropertyChanged != null )
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
}
Now something like this would reset the graphics to those contained in someOtherGraphics and it would be reflected in the map
private void ExecuteNewGraphicsCollection()
{
GraphicsSource = new ObservableCollection<Graphic>(someOtherGraphics);
}
Hope that helps
... View more
05-25-2012
12:10 AM
|
0
|
0
|
354
|
POST
|
You might want to look at something like Prism (it is part of Microsoft Practices and on codeplex). That is what I have been using for Silverlight applications. It provides a modular framework and an event framework which sounds like what you want. It also provides the ability to use Dependency Injection with either MEF or Unity and a good commanding architecture to help with developing MVVM applications. As an example in my site I have an application that keeps a table of points for graphics that the user is adding to a map. I also have a couple applications that allow the users to draw graphics on a map. Every time the user adds a graphic in one of the drawing applications it sends off an event. The application that keeps the table is listening for that event and when it receives the event updates the table.
... View more
05-24-2012
08:25 PM
|
0
|
0
|
177
|
POST
|
In the code example from the sample you pointed to the SelectionChanged Event returns a Graphic collection (IList) as shown below e.AddedItems.
private void QueryDetailsDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
foreach (Graphic g in e.AddedItems)
g.Select();
foreach (Graphic g in e.RemovedItems)
g.UnSelect();
}
The Graphic object has a Geometry property and your case because you selected points this Geomtry would be a MapPoint object. Something like this below should get the MapPoint you need
private void QueryDetailsDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
//This would work with multiple points being selected
ESRI.ArcGIS.Client.Geometry.PointCollection points = new ESRI.ArcGIS.Client.Geometry.PointCollection();
foreach ( Graphic g in e.AddedItems )
{
MapPoint mapPoint = g.Geometry as MapPoint;
if (mapPoint != null )
{
points.Add(mapPoint);
}
}
MultiPoint multiPoint = new MultiPoint(points);
MyMap.ZoomTo(multiPoint.Extent);
//If you user was only allowed to select a single point it would be something like this
Graphic g = e.AddedItems[0] as Graphic;
MapPoint mapPoint = g.Geometry as MapPoint;
if (mapPoint != null )
{
MyMap.ZoomToResolution(MyMap.Resolution / MyMap.ZoomFactor, mapPoint); //As shown Above
}
foreach (Graphic g in e.RemovedItems)
g.UnSelect();
}
Hope that helps -Joe
... View more
05-22-2012
08:21 PM
|
0
|
0
|
465
|
POST
|
Well it seem it is something to do with when running from IIS you must treat the connection like an internet connection to the service catalog and not like a LAN connection. I changed my PropertySet from setting machine name to setting Url and not it is working Cheers
... View more
05-05-2012
10:49 PM
|
0
|
0
|
173
|
POST
|
I have a Rest service that needs to open an IAGSServerConnection. When I run this from the Visual Studio application server or run it in a unit test harness everything works fine. But if I try to run from IIS it will give me an error on the IAGSServerConnectionFactory::Open. Access Denied: Either the SOM service is not running or user is not a member fo the agsuser or agsadmin group.... For fun I tried adding user and password to the property set, but that has not impact. In IIS I have done all the things that I have read need to be done to run ArcObjects. Classic .NET AppPool is set to Integrated (I have tried both Classic and Integrated with same result) and I have Enable 32-bit applications set to true My folder is an Application not a virtual directory The application uses the Classic .NET AppPool Can someone please explain what needs to change for a service to run from IIS that is different from it running in Visual Studio Thanks -Joe
... View more
05-05-2012
10:37 PM
|
0
|
1
|
482
|
POST
|
Patrick, Thanks for the response, after I posted I guessed that might be the solution as it is a similiar approach for managing an AGS from another machine without a domain. Just had to convince the IT guys here that it was necessary so they would setup the account 🙂 Thanks again -Joe
... View more
03-27-2012
11:54 PM
|
0
|
0
|
199
|
POST
|
Your solution does work but it is still causing me a problem that I am not resolving. I moved some of my imagery over to the local disk and built the services from there and it all works. However, I am still having an issue when the imagery is stored on a network share. I have checked and the "Everyone" user has read permissions to this folder, but the issue still exists. Is there a special way that permissions need to be set on a network share so that the SOC will have the appropriate access? My SOC user is not a domain user only a local user on the AGS machine, I am not sure if I will need to make the user a domain user (that seems like an odd requirement to me). Is there something else I am missing? Thanks -joe
... View more
03-27-2012
12:35 AM
|
0
|
0
|
813
|
Title | Kudos | Posted |
---|---|---|
1 | 01-24-2024 10:00 AM | |
1 | 08-03-2023 04:14 AM | |
1 | 11-30-2023 10:39 AM | |
1 | 11-10-2023 12:40 PM | |
1 | 11-07-2023 01:16 PM |
Online Status |
Offline
|
Date Last Visited |
yesterday
|