Table of contents
DataContext
, but does not rely on it.RoutedCommand
) that are well suited to associate a control that invoked a command, such as a button, or a menu item, with a command handler associated with the current element that has keyboard focus.DelegateCommand
class, which allows you to call a delegate when executing a command, and the CompositeCommand
class, which allows you to combine several commands into one. These classes are different from the built-in class RoutedCommand
, which routes the processing of a command down and up through the visual tree. They allow you to initiate a command in the visual tree, and process it at a higher level.CompositeCommand
class implements the ICommand
interface, so it can be bound to controls. The CompositeCommands
class can be associated with several child commands. When CompositeCommand
executed, the child commands will also be executed.CompositeCommand
class supports activation. When a CanExecuteChanged
event CanExecuteChanged
, it itself generates this event. After that, the associated control calls the CanExecute
method on the CompositeCommand
. CompositeCommand
polls all child commands by calling their CanExecute
method. If any command returns false
, the CompositeCommand
also returns false
, thus deactivating the control.CompositeCommand
commands defined in the shell that make sense throughout the application, such as Save , Save All and Cancel . Modules can register their local teams with these global teams, thus taking part in their execution.A note about WPF Routed Events (routed events) and Routed Commands (routed commands).
Routed events differ from ordinary events in that they can be handled by several handlers located in different places in the element tree. WPF routed events carry messages between items in the visual tree. Items that are not in the visual tree cannot process these commands. Routed events can be used for communication between elements of the visual tree, since event data is stored for each element in the route. One item can change something in this data, and this change will be available for the next item in the route.
You can use WPF routed events in the following cases: setting a common handler in a common root element, or when creating your own control class.
DelegateCommand
in the constructor of the view model and make it accessible through the property of the ICommand
type. public class ArticleViewModel : NotificationObject { private readonly ICommand _showArticleListCommand; public ArticleViewModel(INewsFeedService newsFeedService, IRegionManager regionManager, IEventAggregator eventAggregator) { _showArticleListCommand = new DelegateCommand(this.ShowArticleList); } public ICommand ShowArticleListCommand { get { return _showArticleListCommand; } } }
The note.
For rarely used commands, it often makes sense to "lazily" create aDelegateCommand
directly in theget
method of a property.
public class ArticleViewModel : NotificationObject { private readonly ICommand _showArticleListCommand; public ArticleViewModel(INewsFeedService newsFeedService, IRegionManager regionManager, IEventAggregator eventAggregator) { } public ICommand ShowArticleListCommand { get { return _showArticleListCommand ?? ( _showArticleListCommand = new DelegateCommand(this.ShowArticleList) ); } } }
CompositeCommand
in the constructor of the view model and make it accessible via the ICommand
property. public class MyViewModel : NotificationObject { private readonly CompositeCommand _saveAllCommand; public ArticleViewModel(INewsFeedService newsFeedService, IRegionManager regionManager, IEventAggregator eventAggregator) { _saveAllCommand = new CompositeCommand(); _saveAllCommand.RegisterCommand(new SaveProductsCommand()); _saveAllCommand.RegisterCommand(new SaveOrdersCommand()); } public ICommand SaveAllCommand { get { return _saveAllCommand; } } }
DelegateCommand
, or CompositeCommand
, is created and made available through a static class. public static class GlobalCommands { public static CompositeCommand MyCompositeCommand = new CompositeCommand(); }
GlobalCommands.MyCompositeCommand.RegisterCommand(command1); GlobalCommands.MyCompositeCommand.RegisterCommand(command2);
The note.
To improve code testability, you can use a proxy class to access a globally accessible command and mock it in tests.
<Button Name="MyCompositeCommandButton" Command="{x:Static local:GlobalCommands.MyCompositeCommand}" Content="Execute My Composite Command"> </Button>
x:static
, so to bind a button in Silverlight, you need to follow these steps:public
property to get the command specified in the static class. public ICommand MyCompositeCommand { get { return GlobalCommands.MyCompositeCommand; } }
DataContext
(which is done in a separate code file). view.DataContext = model;
xmlns:prism="clr-namespace:Microsoft.Practices.Prism.Commands;assembly=Microsoft.Practices.Prism"
Click.Command
property. <Button Name="MyCommandButton" prism:Click.Command="{Binding MyCompositeCommand}" Content="Execute MyCommand"/> </Button>
The note.
Another approach is to save the command as a resource in the App.xaml file in theApplication.Resources
section. After that, in the submission, make a binding to it.
<Button Name="MyCommandButton" prism:Click.Command="{Binding MyCompositeCommand, Source={StaticResource GlobalCommands}} Content="Execute MyCommand"/> </Button>
RegionContext
to transfer an object between a region's host and views loaded into that region, as shown in the illustration below.RegionContext
and then wait for a change notification. The view can also change the RegionContext
value. There are several ways to get and set up with RegionContext
:RegionContext
region using XAML.RegionContext
region in code.RegionContext
from a view inside the region.The note.
Currently, Prism supports gettingRegionContext
from a view within a region, if that view is a descendant of aDependencyObject
. If your view is notDependencyObject
(for example, if you use data templates and add a view model directly to a region), consider creating your ownRegionBehavior
class to pass theRegionContext
to the view objects.
A note about theDataContext
property.
The data context is a concept that allows controls to inherit data source information for binding from their parent elements. Child elements automatically inherit theDataContext
from their parent elements. Data spreads down the visual tree.
The best way to bind a view model to a view in Silverlight is to use theDataContext
. That is why, in most scenarios, theDataContext
property is used to store the view model. Because of this, it is not recommended to useDataContext
as a communication mechanism between loosely coupled views.
IMarketFeedService
. The Position module consumes this service using the DI container defined in the application shell. IMarketFeedService
intended for use by other modules, so it is located in the general assembly of StockTraderRI.Infrastructure , but its specific implementation should not be publicly available, so it is defined in the Market module and can change independently of other modules.ObservablePosition
class gets the IMarketFeedService
service through dependency injection into the constructor. [Export(typeof(IMarketFeedService))] [PartCreationPolicy(CreationPolicy.Shared)] public class MarketFeedService : IMarketFeedService, IDisposable { ... }
The note.
Some DI containers allow you to register dependencies using attributes, as shown in the example above. Others may require explicit registration. In such cases, registration is usually done at module load time in theIModule.Initialize
method. For more information, see Part 4, Developing Modular Applications .
EventAggregator
provides multi-address publishing / subscription functionality. This means that there may be several publishers publishing an event, and several subscribers who subscribe to this event. Consider using EventAggregator
to publish events between multiple modules and when sending messages between business logic code, such as controllers and presenters.EventAggregator
class allows subscribers, or publishers, to detect a specific heir to EventBase
to determine the type of event. It can be used by several subscribers and publishers at once, as shown in the illustration below.A note on events in the .NET Framework.
Using the event mechanism built into the .NET Framework is the simplest and most obvious way for components to communicate with each other, if weak connectivity is not required. Events in the .NET Framework implement the Publish-Subscribe template, but to subscribe to an object event, an immediate reference to this object is required, which, in composite applications, is often located in another module. The result is a strongly related design. Consequently, the .NET Framework events should be used to exchange messages within modules, but not between them.
If you are using the .NET Framework events, you must be very careful not to allow memory leaks, especially if you have non-static or short-lived components that subscribe to events of a static or long-lived object. If the subscriber does not unsubscribe, the link to it will be saved by the publisher, which will prevent the garbage collector from releasing the first one.
EventAggregator
service from the container happens through the IEventAggregator
interface. The event aggregator is responsible for detecting, or creating and saving event objects. public interface IEventAggregator { TEventType GetEvent<TEventType>() where TEventType : EventBase; }
EventAggregator
creates an event object on the first request, if it has not yet been created. It frees the publisher or subscriber from having to determine if an event is available.CompositePresentationEvent
class. It is the only implementation of the EventBase
class included in the Prism library. It maintains a list of subscribers and handles sending events to these subscribers.CompositePresentationEvent
class is generic and requires the definition of the type of payload. This helps publishers and subscribers provide methods with the correct signature for successfully connecting events. The following code shows a partial definition of the class CompositePresentationEvent
. public class CompositePresentationEvent<TPayload> : EventBase { ... public SubscriptionToken Subscribe(Action<TPayload> action); public SubscriptionToken Subscribe(Action<TPayload> action, ThreadOption threadOption); public SubscriptionToken Subscribe(Action<TPayload> action, bool keepSubscriberReferenceAlive) public virtual SubscriptionToken Subscribe(Action<TPayload> action, ThreadOption threadOption, bool keepSubscriberReferenceAlive); public virtual SubscriptionToken Subscribe(Action<TPayload> action, ThreadOption threadOption, bool keepSubscriberReferenceAlive, Predicate<TPayload> filter); public virtual void Publish(TPayload payload); public virtual void Unsubscribe(Action<TPayload> subscriber); public virtual bool Contains(Action<TPayload> subscriber) ... }
CompositePresentationEvent
events using the IEventAggregator
interface.CompositePresentationEvent , , . TPayLoad . , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
class is CompositePresentationEvent , , . TPayLoad . , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
CompositePresentationEvent , , . TPayLoad
. , .
, TickerSymbolSelectedEvent
Stock Trader RI . , . , .
public class TickerSymbolSelectedEvent : CompositePresentationEvent<string> { }
.
, , . Stock Trader RI , StockTraderRI.Infrastructure .
EventAggregator
Publish
. EventAggregator
, , IEventAggregator
.
, TickerSymbolSelectedEvent
.
this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Publish("STOCK0");
, Subscribe
CompositePresentationEvent
. CompositePresentationEvents
. .
, UI. , . , . , .
.
UI
, UI . WPF Silverlight, UI UI.
, . UI, UI. , UI. , UI, Dispatcher
.
CompositePresentationEvent
, UI. , .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews, ThreadOption.UIThread); } public void ShowNews(string companySymbol) { this.articlePresentationModel.SetTickerSymbol(companySymbol); }
ThreadOption
:
PublisherThread
. . . BackgroundThread
. .NET Framework. UIThread
. UI.
. , filter
. System.Predicate , , , .
, -, .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId);
.
- Silverlight, , ( CompositePresentationEvent
). - , Silverlight. , public , keepSubscriberReferenceAlive
true
, ( ).
- Silverlight, public
, , , ( ).
public bool FundOrderFilter(FundOrder fundOrder){ return fundOrder.CustomerId == this.customerId; } ... FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, FundOrderFilter);
.
Subscribe
Microsoft.Practices.Prism.Events.SubscriptionToken
, . , -, , .
.
, . .
( Strong references )
, , , , , . .
, CompositePresentationEvent
. , , CompositePresentationEvent
, . .
, keepSubscriberReferenceAlive
Subscribe
, .
FundAddedEvent fundAddedEvent = eventAggregator.GetEvent<FundAddedEvent>(); bool keepSubscriberReferenceAlive = true; fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, keepSubscriberReferenceAlive, fundOrder => fundOrder.CustomerId == _customerId);
keepSubscriberReferenceAlive
bool
:
true
, , . , . false
( , ), , . , .
, , , . , TickerSymbolSelectedEvent
, string
, .
public void Run() { ... this.eventAggregator .GetEvent<TickerSymbolSelectedEvent>() .Subscribe(ShowNews); } public void ShowNews(string companySymbol) { articlePresentationModel.SetTickerSymbol(companySymbol); }
, , , .
, , .
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); fundAddedEvent.Subscribe(FundAddedEventHandler, ThreadOption.PublisherThread); fundAddedEvent.Unsubscribe(FundAddedEventHandler);
, , . Subscribe
.
FundAddedEvent fundAddedEvent = this.eventAggregator.GetEvent<FundAddedEvent>(); subscriptionToken = fundAddedEvent.Subscribe( FundAddedEventHandler, ThreadOption.UIThread, false, fundOrder => fundOrder.CustomerId == this.customerId); fundAddedEvent.Unsubscribe(subscriptionToken);
, "Weak References" MSDN: http://msdn.microsoft.com/en-us/library/ms404247.aspx .
Source: https://habr.com/ru/post/182580/
All Articles