PageRenderTime 48ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://bitbucket.org/shope/dfu
C# | 92 lines | 63 code | 19 blank | 10 comment | 0 complexity | 44a1041bdf4f60db105406adbfabd22c 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 Geocortex.EssentialsSilverlightViewer.Infrastructure.Configuration;
  13. using System.ComponentModel.Composition;
  14. using Microsoft.Practices.Prism.Events;
  15. using Geocortex.EssentialsSilverlightViewer.Infrastructure.Events;
  16. using Geocortex.EssentialsSilverlightViewer.Infrastructure.Commands;
  17. namespace GPX.Geocortex.Views
  18. {
  19. public partial class FireScanView : ChildWindow, IConfigurableView, IPartImportsSatisfiedNotification
  20. {
  21. [Import]
  22. public IEventAggregator EventAggregator { get; set; }
  23. private CommandRegistry cr;
  24. /// <summary>
  25. /// Initializes a new instance of the <see cref="FireScanView"/> class.
  26. /// </summary>
  27. /// <param name="CommandRegistry">The command registry.</param>
  28. /// <remarks>Ideally the CommandRegistry should not be passed into the view, however Import statements are not invoked on this view?
  29. /// Perhaps this is because the view is only initialised by the module - therefore the module imports the CommandRegistry and passes it into the view
  30. /// upon initialisation of the view. The CommandRegistry is required to allow the buttons on the view to make calls to custom commands i.e.
  31. /// on selecting OK the selection created by the user should be applied to the map</remarks>
  32. public FireScanView(CommandRegistry CommandRegistry)
  33. {
  34. InitializeComponent();
  35. cr = CommandRegistry;
  36. }
  37. #region IConfigurableView Members
  38. public void InjectViewModel(object viewModel)
  39. {
  40. this.DataContext = (FireScanViewModel)viewModel;
  41. }
  42. public System.Type ViewModelType
  43. {
  44. get { return typeof(FireScanViewModel); }
  45. }
  46. #endregion
  47. #region IConfigurationInjection Members
  48. public string ModuleXmlConfiguration { get; set; }
  49. public string ViewXmlConfiguration { get; set; }
  50. #endregion
  51. public void OnImportsSatisfied()
  52. {
  53. EventAggregator.GetEvent<SiteInitializedEvent>().Subscribe(HandleEvent);
  54. }
  55. public void HandleEvent(SiteInitializedEventArgs args)
  56. {
  57. ShellCommands.BringToFront.Execute(this);
  58. }
  59. private void OKButton_Click(object sender, RoutedEventArgs e)
  60. {
  61. //call the custom command to apply any selection made by the user to the map
  62. cr.GetCommand("ApplyFireScanQueryToMap").Command.Execute(null);
  63. //after a child window has been closed Navigate text box controls are not enabled so explicitly call a command to enable them.
  64. cr.GetCommand("ResetNavigateUI").Command.Execute(null);
  65. this.DialogResult = true;
  66. }
  67. private void CancelButton_Click(object sender, RoutedEventArgs e)
  68. {
  69. this.DialogResult = false;
  70. cr.GetCommand("ResetNavigateUI").Command.Execute(null);
  71. }
  72. }
  73. }