POST
|
Hi, I adapted your suggestion but I'm still not getting a second edit action.
private void EditorWidget_EditCompleted(object sender, Editor.EditEventArgs e)
{
FeatureLayer horizontalWellCap = TabletMap.Layers["2"] as FeatureLayer;
FeatureLayer horizontalwellLateral = TabletMap.Layers["5"] as FeatureLayer;
if (e.Action == Editor.EditAction.Add)
{
foreach (Editor.Change change in e.Edits)
{
if (change.Layer != null && change.Layer
== horizontalWellCap && change.Graphic != null)
{
Editor editor = new Editor();
editor.GeometryServiceUrl =
"http://10.100.100.9:6080/arcgis/rest/services/Utilities/Geometry/GeometryServer";
editor.Map = TabletMap;
string[] layerIDs = { "5" };
editor.LayerIDs = layerIDs;
if (editor.Select.CanExecute("new"))
editor.Select.Execute("new");
}
}
}
}
... View more
08-03-2012
07:00 AM
|
0
|
0
|
295
|
POST
|
I assume from your code that you're trying to make the field in your sql where clause variable. I had this problem last week and my solution was to add a few variables to the string itself instead of rebuilding the string for each instance. Something like this.
searchURL = /*"your_service_url"*/;
searchField = /*"your_search_field"*/;
searchOutFields = /*"list_of,outfields,you_want,returned"*/;
ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query()
{
ReturnGeometry = true,
OutSpatialReference = TabletMap.SpatialReference,
Where = string.Format("{0} LIKE '%{1}%'", searchField , FindText.Text),
OrderByFields = new List<OrderByField>()
{ new OrderByField(searchField , SortOrder.Ascending) }
};
query.OutFields.Add(searchOutFields);
QueryTask queryTask = new QueryTask(searchURL);
... View more
07-31-2012
05:38 AM
|
0
|
0
|
787
|
POST
|
Problem was coming from from complicated graphics. I simplified everything to soliccolors and no storyboard and it worked.
... View more
07-30-2012
05:28 AM
|
0
|
0
|
390
|
POST
|
Hi, I pretty much copied and pasted the print example, with a couple drawing options w/a graphicslayer. However, when I go to print, it only shows up in black and white. Is there something I'm missing or is this just the way it is with the print tool for now?
... View more
07-27-2012
11:05 AM
|
0
|
6
|
806
|
POST
|
I found this when I was looking for this answer a few days ago. Hope it helps. http://forums.arcgis.com/threads/25004-FeatureLayer-editing-Add-feature
... View more
07-25-2012
06:10 AM
|
0
|
0
|
180
|
POST
|
Hi, I'm trying to try and have an edit from the template picker lead into a second edit of a different type (well cap at surface into it's lateral). But I'm having trouble with the syntax and available methods. Can anyone help me on this? My code so far reads as follows.
private void EditorWidget_EditCompleted(object sender, Editor.EditEventArgs e)
{
FeatureLayer horizontalWellCap = TabletMap.Layers["1"] as FeatureLayer;
FeatureLayer horizontalwellLateral = TabletMap.Layers["2"] as FeatureLayer;
if (e.Action == Editor.EditAction.Add)
{
foreach (Editor.Change change in e.Edits)
{
if (change.Layer != null && change.Layer == horizontalWellCap && change.Graphic != null)
{
}
}
}
}
... View more
07-25-2012
06:07 AM
|
0
|
4
|
670
|
POST
|
Does anyone have an update on this? I'm on API 3.0 and there still doesn't appear to be that link from featuredatagrid to graphicslayer - for the mouseover / highlight coloring - I still have to use the 'select' method, but then it is replacing my current selection I make from clicking on the graphicslayer. it should work the same both ways the same? I just wrote this the other day (with a considerable amount of help on this forum), but have you considered bypassing the select() as your true select function? I'm modifying the Spatial Query sample from the API, It has almost everything your looking for i think. All you need to do from there is add a few things. Something like this...
//change your select/unselect method to only effect the graphic
private void QueryDetailsDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
foreach (Graphic g in e.AddedItems)
g.Select();
foreach (Graphic g in e.RemovedItems)
g.UnSelect();
}
//change your Loadingrow command to include a mousebuttonup
private void QueryDetailsDataGrid_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.MouseEnter += Row_MouseEnter;
e.Row.MouseLeave += Row_MouseLeave;
e.Row.MouseLeftButtonUp += Row_MouseLeftButtonUp;
}
//add a method for mouseleftbuttonup, i made this one clear the graphicslayer and zoom to the selected
void Row_MouseLeftButtonUp(object sender, MouseEventArgs e)
{
Graphic g = ((System.Windows.FrameworkElement)(sender)).DataContext as Graphic;
g.Select();
TabletMap.ZoomTo(g.Geometry);
ClearAllGraphics();
}
This is how I ended up using it in my app, it ends up working almost exactly as you said you wanted yours. I'm adding it because i don't really remember what all else i did 🙂 But if you run a find and replace and change out "bookmarksdatagrid" with your featuredatagrid's name, i think you'll be quite pleased with the results.
private static Graphic GetGraphicSibling(object item)
{
if (item != null)
{
MethodInfo mi = item.GetType().GetMethod("GetGraphicSibling");
if (mi != null)
return mi.Invoke(item, null) as Graphic;
}
return null;
}
private void GraphicsLayer_MouseEnter(object sender, GraphicMouseEventArgs args)
{
BookmarksDataGrid.Focus();
BookmarksDataGrid.SelectedItem = args.Graphic;
BookmarksDataGrid.CurrentColumn = BookmarksDataGrid.Columns[0];
BookmarksDataGrid.ScrollIntoView(BookmarksDataGrid.SelectedItem, BookmarksDataGrid.Columns[0]);
args.Graphic.Select();
}
private void GraphicsLayer_MouseLeave(object sender, GraphicMouseEventArgs args)
{
BookmarksDataGrid.Focus();
BookmarksDataGrid.SelectedItem = null;
args.Graphic.UnSelect();
}
private void GraphicsLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs args)
{
BookmarksDataGrid.Focus();
BookmarksDataGrid.SelectedItem = args.Graphic;
TabletMap.ZoomTo(args.Graphic.Geometry);
renameButtonsDataSet();
enableBMButtons();
BookmarksDataGrid.Visibility = Visibility.Collapsed;
ClearAllGraphics();
}
private void BookmarksDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
foreach (var item in e.AddedItems)
{
var g = GetGraphicSibling(item);
g.Select();
}
foreach (var item in e.RemovedItems)
{
var g = GetGraphicSibling(item);
g.UnSelect();
}
}
private void BookmarksDataGrid_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.MouseEnter += Row_MouseEnter;
e.Row.MouseLeave += Row_MouseLeave;
e.Row.MouseLeftButtonUp += Row_MouseLeftButtonUp;
}
void Row_MouseEnter(object sender, MouseEventArgs e)
{
Object obj = (((System.Windows.FrameworkElement)(sender)).DataContext as Object);
var g = GetGraphicSibling(obj);
g.Select();
}
void Row_MouseLeave(object sender, MouseEventArgs e)
{
Object obj = (((System.Windows.FrameworkElement)(sender)).DataContext as Object);
var g = GetGraphicSibling(obj);
g.UnSelect();
}
void Row_MouseLeftButtonUp(object sender, MouseEventArgs e)
{
Object obj = (((System.Windows.FrameworkElement)(sender)).DataContext as Object);
var g = GetGraphicSibling(obj);
TabletMap.ZoomTo(g.Geometry);
BookmarksDataGrid.Visibility = Visibility.Collapsed;
renameButtonsDataSet();
enableBMButtons();
ClearAllGraphics();
}
... View more
07-18-2012
10:59 AM
|
0
|
0
|
352
|
POST
|
Hi, I'm wanting to apply a template to the child window that is used to apply and edit attributes from any editing done with the editor widget. How would I go about targeting this?
... View more
07-18-2012
05:01 AM
|
0
|
1
|
975
|
POST
|
AFAIK, the Bookmark control can't be customized to store bookmarks at server side. But likely you could get the sources and tweak them for your need. Thanks for letting me know Dominique.
... View more
07-17-2012
09:28 AM
|
0
|
0
|
175
|
POST
|
Hi, I was wondering if anyone could help me with this simple logout function. I'm still unfamiliar with using the IdentityManager. private void LogoutButton_Click(object sender, RoutedEventArgs e) { string credentials = IdentityManager.Current.Credentials.ToString(); IdentityManager.Current.RemoveCredential(credentials); } Right now it's not accepting the string as a credential, but I don't know how to convert it into a usable format.
... View more
07-17-2012
08:24 AM
|
0
|
2
|
2061
|
POST
|
I'm interested in using the bookmark tool and saving the resulting bookmarks on the server (ARGIS Server or SQL) so they can be accessed by anyone at any location instead of saving the bookmarks in the silverlight app and having it bound to that particular machine. Is there any way to do this with the bookmark tool provided in the toolkit or am I barking up the wrong tree with this one?
... View more
07-16-2012
01:41 PM
|
0
|
2
|
376
|
POST
|
Got it. Thanks for all the help Joe!
private static Graphic GetGraphicSibling(object item)
{
if (item != null)
{
MethodInfo mi = item.GetType().GetMethod("GetGraphicSibling");
if (mi != null)
return mi.Invoke(item, null) as Graphic;
}
return null;
}
private void BookmarksDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
foreach (var item in e.AddedItems)
{
var g = GetGraphicSibling(item);
g.Select();
TabletMap.ZoomTo(g.Geometry);
}
foreach (var item in e.RemovedItems)
{
var g = GetGraphicSibling(item);
g.UnSelect();
}
}
... View more
07-16-2012
10:38 AM
|
0
|
0
|
368
|
POST
|
I know i'm probably being overly dense here, but the code is now throwing the exception "A local variable named 'g' cannot be declared in this scope because it would give a different meaning to 'g', which is already used in a 'parent or current' scope to denote something else" And I'm not sure how to get around it.
private void BookmarksDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
object obj = e.AddedItems[0];
//This bit of trickery is from a post that Jennifer made on the forum to convert the SelectedItem to a graphic using reflection
MethodInfo methodInfo = obj.GetType().GetMethod("GetGraphicSibling");
if (methodInfo == null) return;
Graphic g = methodInfo.Invoke(obj, null) as Graphic;
foreach (Graphic g in e.AddedItems)
{
g.Select();
TabletMap.ZoomTo(g.Geometry);
}
foreach (Graphic g in e.RemovedItems)
g.UnSelect();
}
... View more
07-16-2012
08:38 AM
|
0
|
0
|
368
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|