/GPX.Firemap.Client/Modules/Views/FireScanView.xaml.cs
C# | 92 lines | 63 code | 19 blank | 10 comment | 0 complexity | 44a1041bdf4f60db105406adbfabd22c MD5 | raw file
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Animation;
- using System.Windows.Shapes;
- using Geocortex.EssentialsSilverlightViewer.Infrastructure.Configuration;
- using System.ComponentModel.Composition;
- using Microsoft.Practices.Prism.Events;
- using Geocortex.EssentialsSilverlightViewer.Infrastructure.Events;
- using Geocortex.EssentialsSilverlightViewer.Infrastructure.Commands;
-
- namespace GPX.Geocortex.Views
- {
- public partial class FireScanView : ChildWindow, IConfigurableView, IPartImportsSatisfiedNotification
- {
-
- [Import]
- public IEventAggregator EventAggregator { get; set; }
-
- private CommandRegistry cr;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="FireScanView"/> class.
- /// </summary>
- /// <param name="CommandRegistry">The command registry.</param>
- /// <remarks>Ideally the CommandRegistry should not be passed into the view, however Import statements are not invoked on this view?
- /// Perhaps this is because the view is only initialised by the module - therefore the module imports the CommandRegistry and passes it into the view
- /// upon initialisation of the view. The CommandRegistry is required to allow the buttons on the view to make calls to custom commands i.e.
- /// on selecting OK the selection created by the user should be applied to the map</remarks>
- public FireScanView(CommandRegistry CommandRegistry)
- {
- InitializeComponent();
- cr = CommandRegistry;
- }
-
- #region IConfigurableView Members
-
- public void InjectViewModel(object viewModel)
- {
-
- this.DataContext = (FireScanViewModel)viewModel;
- }
-
- public System.Type ViewModelType
- {
- get { return typeof(FireScanViewModel); }
- }
-
- #endregion
-
- #region IConfigurationInjection Members
- public string ModuleXmlConfiguration { get; set; }
- public string ViewXmlConfiguration { get; set; }
- #endregion
-
- public void OnImportsSatisfied()
- {
- EventAggregator.GetEvent<SiteInitializedEvent>().Subscribe(HandleEvent);
-
- }
-
- public void HandleEvent(SiteInitializedEventArgs args)
- {
- ShellCommands.BringToFront.Execute(this);
- }
-
- private void OKButton_Click(object sender, RoutedEventArgs e)
- {
- //call the custom command to apply any selection made by the user to the map
- cr.GetCommand("ApplyFireScanQueryToMap").Command.Execute(null);
-
- //after a child window has been closed Navigate text box controls are not enabled so explicitly call a command to enable them.
- cr.GetCommand("ResetNavigateUI").Command.Execute(null);
-
- this.DialogResult = true;
- }
-
- private void CancelButton_Click(object sender, RoutedEventArgs e)
- {
- this.DialogResult = false;
- cr.GetCommand("ResetNavigateUI").Command.Execute(null);
- }
-
- }
- }
-