MessageController.cs 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using OHV.Module.Interactivity.PopUp;
  7. using Prism.Interactivity.InteractionRequest;
  8. using Prism.Ioc;
  9. using Prism.Modularity;
  10. using Prism.Mvvm;
  11. using Prism.Services.Dialogs;
  12. namespace OHV.Module.Interactivity
  13. {
  14. public class MessageController : IModule
  15. {
  16. IDialogService dialogService;
  17. public MessageController( IDialogService dialogService )
  18. {
  19. this.dialogService = dialogService;
  20. }
  21. public void OnInitialized( IContainerProvider containerProvider )
  22. {
  23. }
  24. public void RegisterTypes( IContainerRegistry containerRegistry )
  25. {
  26. containerRegistry.RegisterDialog<NotificatioinView , NotificationViewModel>();
  27. containerRegistry.RegisterDialog<ConfirmationPopupView , ConfirmationPopupViewModel>();
  28. containerRegistry.RegisterDialog<MapView , MapViewModel>();
  29. containerRegistry.RegisterDialog<ServoConfigView , ServoConfigViewModel>();
  30. containerRegistry.RegisterDialog<InOutView , InOutViewModel>();
  31. containerRegistry.RegisterDialog<DriveServoView , DriveServoViewModel>();
  32. containerRegistry.RegisterDialog<LockServoView , LockServoViewModel>();
  33. containerRegistry.RegisterDialog<BatteryConfigView , BatteryConfigViewModel>();
  34. containerRegistry.RegisterDialog<OpticalReadingConfigView , OpticalReadingConfigViewModel>();
  35. containerRegistry.RegisterDialog<InOutControlView , InOutControlViewModel>();
  36. }
  37. public void ShowNotificationView( string Message , bool isOK = true )
  38. {
  39. var dialogPram = new DialogParameters();
  40. dialogPram.Add( "message" , Message );
  41. dialogPram.Add( "Type" , isOK );
  42. this.dialogService.ShowDialog( "NotificatioinView" , dialogPram , null );
  43. }
  44. public void ShowConfirmationPopupView( string Message , Action<IDialogResult> callBack )
  45. {
  46. this.dialogService.ShowDialog( "ConfirmationPopupView" , new DialogParameters( $"message={Message}" ) , callBack );
  47. }
  48. public void ShowMapPopupView( )
  49. {
  50. this.dialogService.ShowDialog( "MapView" , new DialogParameters() , null );
  51. }
  52. public void ShowServoConfigPopupView( )
  53. {
  54. this.dialogService.ShowDialog( "ServoConfigView" , new DialogParameters() , null );
  55. }
  56. public void ShowInOutPopupView( )
  57. {
  58. this.dialogService.ShowDialog( "InOutView" , new DialogParameters() , null );
  59. }
  60. public void ShowLockPopupView( )
  61. {
  62. this.dialogService.ShowDialog( "LockServoView" , new DialogParameters() , null );
  63. }
  64. public void ShowDrivePopupView( )
  65. {
  66. this.dialogService.ShowDialog( "DriveServoView" , new DialogParameters() , null );
  67. }
  68. public void ShowBatteryPopupView( )
  69. {
  70. this.dialogService.ShowDialog( "BatteryConfigView" , new DialogParameters() , null );
  71. }
  72. public void ShowOpticalReadPopupView()
  73. {
  74. this.dialogService.ShowDialog( "OpticalReadingConfigView" , new DialogParameters() , null );
  75. }
  76. public void ShowInOutControlPopupView()
  77. {
  78. this.dialogService.ShowDialog( "InOutControlView" , new DialogParameters() , null );
  79. }
  80. }
  81. }