Radical Documentation
View on GitHub
Primary version
Primary version
  • Home
  • Presentation
    • AbstractViewModel
    • Conventions
      • Bootstrap Conventions
      • Runtime Conventions
      • Conventions override
    • Commands and DelegateCommand
    • IViewResolver
      • Default view behaviors
      • view life cycle events
        • Callback expectations
        • notify messages
    • Message broker MVVM built-in messages
    • Application boot process
      • Application configuration
      • Application shutdown
      • Singleton applications
    • AbstractMementoViewModel
      • Simple ViewModel graphs
      • Collections and complex ViewModel graphs
    • Validation and Validation Services
    • Resources
      • Services as resources
      • ViewModels as resources
  • UI Composition
    • UI Composition
      • Region content lifecycle
      • TabControl region
      • Create a custom region
  • Concepts
    • Inversion of Control
      • Third party DI containers
    • Entities
      • Property System
    • Messaging and Message Broker
      • POCO messages
      • Standalone message handlers
    • Observers
      • PropertyObserver
      • MementoObserver
      • BrokerObserver
  • Memento
    • Change Tracking Service
      • MementoEntity and MementoEntityCollection
      • Handling change tracking:
        • Simple model
        • Collections
        • Complex objects graph
      • Atomic operations
      • Change Tracking Service API
      • Property Metadata for the ChangeTrackingService
      • Handling collection sync
      • Property State
  • Behaviors
    • DataGrid Behaviors
    • Password
    • Generic routed event handler to command behavior
    • Overlay adorner
      • Busy status manager
    • TextBox behaviors:
      • Command
      • Auto select
      • DisableUndoManager (.Net 3.5 only)
  • Markup Extensions
    • Editor binding
    • Auto Command binding
  • How to
    • Get the view of a given view model
    • Bi-directional communication between different windows/views
    • Handle the busy status during async/long running operations
    • Implement a customer improvement program
    • Manage focus
    • Create a splash screen
    • Access view model after view is closed
    • Intercept ViewModels before they are used
  • Upgrade guides
    • Radical Presentation 1.x to Radical 2.x for .NET Core
    • Radical 2.0.0 to Radical 2.1.0
Powered by GitBook
On this page
  • Application Messages
  • View/ViewModel Messages
  1. Presentation

Message broker MVVM built-in messages

Previousnotify messagesNextApplication boot process

Last updated 3 years ago

Radical Presentation relies on the to broadcast messages that can be used by the application to easily manage a lot of stuff that otherwise can be a bit cumbersome.

The following is the list of the Radical Presentation built-in messages and their meaning/usage.

Application Messages

These messages are broadcasted or dispatched by the application to notify application level state changes.

  • ApplicationBootCompleted:

    • broadcasted asynchronously by application bootstrapper to notify that the boot process is completed.

  • ApplicationShutdownRequest:

    • can be dispatched or broadcasted by anyone to request programmatically the application to shutdown. it is highly recommended that the message is broadcasted asynchronously_._ When the application shutdown is requested via the ApplicationShutdownRequest message, the following events might be dispatched:

      • ApplicationShutdownRequested:

        • dispatched synchronously by application bootstrapper to notify that the application has started the shutdown process, this event is dispatched synchronously to allow subscribers to easily cancel the shutdown process using a well known approach similar to the one exposed by the .net CancelEventArgs.

      • ApplicationShutdownCanceled:

        • broadcasted asynchronously by application bootstrapper to notify that the shutdown process has been canceled.

  • ApplicationShutdown:

    • broadcasted asynchronously by application bootstrapper to notify that the shutdown process is in progress, from this point on the process is not cancellable any more.

Note:

All the “application shutdown” related events/messages brings with them an enumeration (ApplicationShutdownReason) that identifies why the application is shutting down.

View/ViewModel Messages

The following messages are broadcasted or dispatched by the infrastructure when the state of a view changes or to request a change to the view status.

  • CloseViewRequest:

    • can be dispatched or broadcasted by anyone to request programmatically to a view to close. it is highly recommended that the message is broadcasted asynchronously. The message is generally used to close the view of the view model that issues the message, but the shape of the message allows to close a view attached to any view model.

    class SampleViewModel
    {
        readonly IMessageBroker broker;
    
        public SampleViewModel( IMessageBroker broker )
        {
            this.broker = broker;
        }
    
        public void Sample()
        {
            this.broker.Broadcast( this, new CloseViewRequest( this ) );
        }
    }
  • ViewModelClosed:

    • broadcasted asynchronously by the infrastructure to notify that a view and an associated ViewModel has been closed.

  • ViewModelClosing:

    • dispatched synchronously by the infrastructure to notify that the a view and an associated ViewModel is closing, this event is dispatched synchronously to allow subscribers to easily cancel the close process using a well known approach similar to the one exposed by the .net CancelEventArgs.

  • ViewLoaded:

    • broadcasted asynchronously by the infrastructure to notify that a view has been loaded.

  • ViewModelLoaded:

    • broadcasted asynchronously by the infrastructure to notify that a ViewModel has been loaded.

Note:

  • ViewModelShown:

    • broadcasted asynchronously by the infrastructure to notify that a view and an associated ViewModel has been shown for the first time.

ViewLoaded and ViewModelLoaded messages are broadcasted only under certain circumstances, depending on the result of the ShouldNotifyViewLoaded and ShouldNotifyViewModelLoaded .

MessageBroker
conventions