PageRenderTime 52ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/GPX.Firemap.Client/Modules/Views/GridReferenceMapView.xaml.cs

https://bitbucket.org/shope/dfu
C# | 86 lines | 69 code | 17 blank | 0 comment | 2 complexity | c2e7d5c966b06b6e8fab55fe742887a6 MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Documents;
  8. using System.Windows.Input;
  9. using System.Windows.Media;
  10. using System.Windows.Media.Animation;
  11. using System.Windows.Shapes;
  12. using ESRI.ArcGIS.Client.Geometry;
  13. using ESRI.ArcGIS.Client.Tasks;
  14. using ESRI.ArcGIS.Client;
  15. using Geocortex.EssentialsSilverlightViewer.Infrastructure.Configuration;
  16. using System.ComponentModel.Composition;
  17. using Microsoft.Practices.Prism.Events;
  18. using Geocortex.EssentialsSilverlightViewer.Infrastructure.Events;
  19. using Geocortex.EssentialsSilverlightViewer.Infrastructure.Commands;
  20. using GPX.Geocortex.Models;
  21. namespace GPX.Geocortex.Views
  22. {
  23. public partial class GridReferenceMapView : ChildWindow, IConfigurableView, IPartImportsSatisfiedNotification
  24. {
  25. public Graphic selectedGraphic;
  26. private Envelope _initialExtent;
  27. [Import]
  28. public IEventAggregator EventAggregator { get; set; }
  29. public GridReferenceMapView(Envelope defaultExtent)
  30. {
  31. InitializeComponent();
  32. _initialExtent = defaultExtent;
  33. mapGridRefs.Extent = _initialExtent;
  34. }
  35. #region IConfigurableView Members
  36. public void InjectViewModel(object viewModel)
  37. {
  38. this.DataContext = (GridReferenceMapViewModel)viewModel;
  39. }
  40. public System.Type ViewModelType
  41. {
  42. get { return typeof(GridReferenceMapViewModel); }
  43. }
  44. #endregion
  45. #region IConfigurationInjection Members
  46. public string ModuleXmlConfiguration { get; set; }
  47. public string ViewXmlConfiguration { get; set; }
  48. #endregion
  49. public void OnImportsSatisfied()
  50. {
  51. EventAggregator.GetEvent<SiteInitializedEvent>().Subscribe(HandleEvent);
  52. }
  53. public void HandleEvent(SiteInitializedEventArgs args)
  54. {
  55. ShellCommands.BringToFront.Execute(this);
  56. }
  57. private void btnFullExtent_Click(object sender, RoutedEventArgs e)
  58. {
  59. this.mapGridRefs.ZoomTo(_initialExtent);
  60. }
  61. private void btnClose_Click(object sender, RoutedEventArgs e)
  62. {
  63. if (NavigateState.SelectedGraphic != null)
  64. this.Close();
  65. else
  66. MessageBox.Show("Please select a coordinate before exiting");
  67. }
  68. }
  69. }