void MyMapView_Loaded(object sender, RoutedEventArgs e) { if (Projects == null) { LoadProjectList(); // switch to the default project if (Projects != null) { ProjectLocation loc = Projects.Locations.ToList().Find(i => i.Default == true); if ((loc != null)) { App app = Application.Current as App; IS3MainWindow mw = (IS3MainWindow)app.MainWindow; mw.SwitchToMainFrame(loc.ID); } projectBox.ItemsSource = Projects.Locations; } } if (Projects != null) { Envelope projectExtent = new Envelope(Projects.XMin, Projects.YMin, Projects.XMax, Projects.YMax); AddProjectsToMap(); //Map.ZoomTo(ProjectExtent); } }
async void MyMapView_MouseDown(object sender, MouseButtonEventArgs e) { try { _isHitTesting = true; Point screenPoint = e.GetPosition(MyMapView); Graphic graphic = await ProjectGraphicsLayer.HitTestAsync(MyMapView, screenPoint); if (graphic != null) { string definitionFile = graphic.Attributes["DefinitionFile"] as string; App app = Application.Current as App; IS3MainWindow mw = (IS3MainWindow)app.MainWindow; mw.SwitchToMainFrame(definitionFile); } } catch (Exception ex) { } finally { _isHitTesting = false; } }
private void ViewMenu_Click(object sender, RoutedEventArgs e) { string projectID = _selectGraphic.Attributes["ID"] as string; App app = Application.Current as App; IS3MainWindow mw = (IS3MainWindow)app.MainWindow; mw.SwitchToMainFrame(projectID); }