PageRenderTime 55ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/shope/dfu
C# | 80 lines | 63 code | 16 blank | 1 comment | 0 complexity | 379ae19a2f96e232d891ba5027a4e152 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 System.ComponentModel.Composition;
  13. using Geocortex.EssentialsSilverlightViewer.Infrastructure.Configuration;
  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 AutoRefreshView : ChildWindow, IConfigurableView, IPartImportsSatisfiedNotification
  20. {
  21. [Import]
  22. public IEventAggregator EventAggregator { get; set; }
  23. private CommandRegistry cr;
  24. #region IConfigurableView Members
  25. public void InjectViewModel(object viewModel)
  26. {
  27. this.DataContext = (AutoRefreshViewModel)viewModel;
  28. }
  29. public System.Type ViewModelType
  30. {
  31. get { return typeof(AutoRefreshViewModel); }
  32. }
  33. #endregion
  34. #region IConfigurationInjection Members
  35. public string ModuleXmlConfiguration { get; set; }
  36. public string ViewXmlConfiguration { get; set; }
  37. #endregion
  38. public AutoRefreshView(CommandRegistry CommandRegistry)
  39. {
  40. InitializeComponent();
  41. cr = CommandRegistry;
  42. }
  43. public void OnImportsSatisfied()
  44. {
  45. EventAggregator.GetEvent<SiteInitializedEvent>().Subscribe(HandleEvent);
  46. }
  47. public void HandleEvent(SiteInitializedEventArgs args)
  48. {
  49. ShellCommands.BringToFront.Execute(this);
  50. }
  51. private void OKButton_Click(object sender, RoutedEventArgs e)
  52. {
  53. //call the custom command to apply autorefresh
  54. cr.GetCommand("ApplyAutoRefresh").Command.Execute(null);
  55. this.DialogResult = true;
  56. cr.GetCommand("ResetNavigateUI").Command.Execute(null);
  57. }
  58. private void CancelButton_Click(object sender, RoutedEventArgs e)
  59. {
  60. this.DialogResult = false;
  61. cr.GetCommand("ResetNavigateUI").Command.Execute(null);
  62. }
  63. }
  64. }