本文整理汇总了C#中IEventAggregator.Subscribe方法的典型用法代码示例。如果您正苦于以下问题:C# IEventAggregator.Subscribe方法的具体用法?C# IEventAggregator.Subscribe怎么用?C# IEventAggregator.Subscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEventAggregator
的用法示例。
在下文中一共展示了IEventAggregator.Subscribe方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImageService
public ImageService(IEventAggregator eventAggregator)
{
_eventAggregator = eventAggregator;
_eventAggregator.Subscribe(this);
_cascade = new FaceHaarCascade();
_harHaarObjectDetector = new HaarObjectDetector(_cascade, 30);
SetupDetector();
}
示例2: UserTasksSelectorViewModel
public UserTasksSelectorViewModel(
[Import]IBackgroundExecutor executor,
[Import]IEventAggregator aggregator,
[Import]ITasksService tasksService,
[Import] IDialogService dialogs,
[Import]IAuthorizationService authorizator)
{
this.executor = executor;
this.aggregator = aggregator;
this.tasksService = tasksService;
this.dialogs = dialogs;
this.authorizator = authorizator;
tasksViewSource = new System.Windows.Data.CollectionViewSource();
notMineTasksViewSource = new System.Windows.Data.CollectionViewSource();
TrackingTaskInfo = null;
aggregator.Subscribe<MemberProfile>(ScrumFactoryEvent.SignedMemberChanged, m => { OnPropertyChanged("SignedMemberUId"); });
aggregator.Subscribe(ScrumFactoryEvent.ApplicationWhentForeground, () => { LoadTasks(true); });
aggregator.Subscribe(ScrumFactoryEvent.ShowUserTasksSelector, Show);
aggregator.Subscribe<Task>(ScrumFactoryEvent.TaskAssigneeChanged, OnTaskChanged);
aggregator.Subscribe<Task>(ScrumFactoryEvent.TaskChanged, OnTaskChanged);
ShowTaskDetailCommand = new DelegateCommand<TaskViewModel>(ShowTaskDetail);
TrackTaskCommand = new DelegateCommand<TaskViewModel>(TrackTask);
timeKeeper.Tick += new EventHandler(timeKeeper_Tick);
}
示例3: WebPageWidget
public WebPageWidget()
{
webPageViewModel = GetInstance<WebPageViewModel>();
webPageController = GetInstance<WebPageController>();
eventAggregator = GetInstance<IEventAggregator>();
PropertyChanged += WebPageWidget_PropertyChanged;
ConfigurationChanged += WebPageWidget_ConfigurationChanged;
webPageView = new WebPageView {DataContext = webPageViewModel};
View = webPageView;
SettingsView = new WebPageSettingsView {DataContext = webPageViewModel};
eventAggregator.Subscribe<OpenModalDialogMessage>(this, msg =>
{
webPageView.HideWebBrowser();
});
eventAggregator.Subscribe<CloseModalDialogMessage>(this, msg =>
{
webPageView.ShowWebBrowser();
});
SaveSettings.BeforeExecute += (o, e) => webPageController.SaveConfiguration();
webPageViewModel.Save.ExecuteDelegate = () => SaveSettings.Execute();
}
示例4: BurndownViewModel
public BurndownViewModel(
[Import] IBacklogService backlogService,
[Import] IProjectsService projectsService,
[Import] IBackgroundExecutor backgroundExecutor,
[Import] IEventAggregator eventAggregator,
[Import] IAuthorizationService authorizator)
{
this.backlogService = backlogService;
this.projectsService = projectsService;
this.executor = backgroundExecutor;
this.aggregator = eventAggregator;
this.authorizator = authorizator;
NeedRefresh = false;
OnLoadCommand = new DelegateCommand(() => {if (NeedRefresh) LoadData();});
SetBaselineCommand = new DelegateCommand(_CanChangeBaseline, SetBaseline);
aggregator.Subscribe<Project>(ScrumFactoryEvent.ViewProjectDetails, p=> {
Project = p;
SetPlannings();
AskForRefresh();
});
aggregator.Subscribe<Project>(ScrumFactoryEvent.BurndownShouldRefresh, AskForRefresh);
aggregator.Subscribe<ICollection<Sprint>>(ScrumFactoryEvent.SprintsDateChanged, o => { AskForRefresh(); });
aggregator.Subscribe<BacklogItem[]>(ScrumFactoryEvent.BacklogItemsChanged, b => { AskForRefresh(); });
}
示例5: MainViewModel
public MainViewModel(IPromptService promptService,
IEventAggregator eventAggregator,
Func<FileSelectionViewModel> fileSelectionViewModelfactory,
Func<OkCancelPanelViewModel> okCancelViewModelfactory)
{
string selectedPath = null;
SelectFilesCommand = new DelegateCommand<object>(o =>
{
selectedPath = promptService.ShowFolderBrowserDialogue();
if (string.IsNullOrEmpty(selectedPath)) return;
FileSelection = fileSelectionViewModelfactory();
FileSelection.LoadFiles(selectedPath);
OkCancelPanel = okCancelViewModelfactory();
});
eventAggregator.Subscribe<CleanUpFilesMessage>(this, message =>
{
try
{
if(FileSelection == null) return;
FileSelection.CleanUpFiles(selectedPath);
}
catch (UnauthorizedAccessException exception)
{
var errorMessage = string.Format("Failed to clean up files. {0} " +
"This may be due to the file being marked as 'Read Only'",
exception.Message);
promptService.ShowError(errorMessage);
}
ClearFileSelection();
});
eventAggregator.Subscribe<ClearFileSelectionMessage>(this, message =>
ClearFileSelection());
}
示例6: MemberViewModel
public MemberViewModel(
[Import(typeof(IAuthorizationService))] IAuthorizationService authorizator,
[Import(typeof(IBackgroundExecutor))] IBackgroundExecutor executor,
[Import(typeof(IEventAggregator))] IEventAggregator aggregator,
[Import] IDialogService dialogs,
[Import(typeof(ITasksService))] ITasksService taskService,
[Import(typeof(ITeamService))] ITeamService teamService)
{
this.taskService = taskService;
this.authorizator = authorizator;
this.executor = executor;
this.aggregator = aggregator;
this.teamService = teamService;
this.dialogs = dialogs;
aggregator.Subscribe(ScrumFactoryEvent.ShowProfile, Show);
aggregator.Subscribe<MemberProfile>(ScrumFactoryEvent.SignedMemberChanged, OnSignedMemberChanged);
ChangeAvatarCommand = new DelegateCommand(ChangeMemberImage);
RemoveAvatarCommand = new DelegateCommand(RemoveMemberImage);
CloseWindowCommand = new DelegateCommand(Close);
CreateAvatarCommand = new DelegateCommand(CreateAvatar);
UpdateAvatarCommand = new DelegateCommand(() => {
executor.StartBackgroundTask(
() => {
teamService.UpdateMember(authorizator.SignedMemberProfile.MemberUId, MemberProfile);
}, () => {
myProfileNocache = new Random().Next().ToString();
DefineMemberAvatarUrl();
});
});
}
示例7: ProjectDetailViewModel
public ProjectDetailViewModel([Import] IEventAggregator eventAggregator)
{
this.aggregator = eventAggregator;
aggregator.Subscribe<Project>(ScrumFactoryEvent.ViewProjectDetails, ViewProjectDetails);
aggregator.Subscribe<Task>(ScrumFactoryEvent.ShowTaskDetail, t => { if (!View.IsVisible) dialogs.SelectTopMenu(this);}, 5);
aggregator.Subscribe<BacklogItem>(ScrumFactoryEvent.ShowItemDetail, i => { if (!View.IsVisible) dialogs.SelectTopMenu(this); });
aggregator.Subscribe<BacklogItem>(ScrumFactoryEvent.ShowItemDetail, i => { if (!View.IsVisible) dialogs.SelectTopMenu(this); });
aggregator.Subscribe<IProjectTabViewModel>(ScrumFactoryEvent.ShowProjectTab,
w => {
if (w == SelectedProjectTab)
return;
CloseAllChildWindows();
SelectedProjectTab = w;
});
aggregator.Subscribe<MemberProfile>(ScrumFactoryEvent.SignedMemberChanged, m => {
SelectedProjectTab = ProjectPanels.FirstOrDefault();
});
aggregator.Subscribe<Sprint>(ScrumFactoryEvent.SprintAdded, s => { RefreshProject(); });
aggregator.Subscribe<ICollection<Sprint>>(ScrumFactoryEvent.SprintsDateChanged, s => { RefreshProject(); });
aggregator.Subscribe(ScrumFactoryEvent.SprintsShifted, RefreshProject);
ShowCodeRepositoryCommand = new DelegateCommand<string>(ShowCodeRepository);
ShowDocRepositoryCommand = new DelegateCommand<string>(ShowDocRepository);
CopyProjectUrlCommand = new DelegateCommand(CopyProjectUrl);
}
示例8: Game1
public Game1(IEventAggregator eventAggregator, IProvideBoardState boardProvider)
: base()
{
BoardProvider = boardProvider;
_eventAggregator = eventAggregator;
_eventAggregator.Subscribe(this);
_eventAggregator.Subscribe(_moveAnimationListener = new MoveAnimationListener(eventAggregator));
_graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
Content = new ContentManager(Services, "Content");
}
示例9: GameEventAggregator
public GameEventAggregator(IEventAggregator eventAggregator, IEmulationRunner emulationRunner)
{
_eventAggregator = eventAggregator;
_emulationRunner = emulationRunner;
_gameStartedActions = new List<Action>();
_gameEndedActions = new List<Action>();
_memoryChangedActions = new Dictionary<Int32, IList<Action<GameMemoryChangedEvent>>>();
eventAggregator.Subscribe<MemoryValueChangedEvent>(ValueChanged);
eventAggregator.Subscribe<EmulatorStartedEvent>(EmulatorStarted);
eventAggregator.Subscribe<EmulatorQuitEvent>(EmulatorQuit);
}
示例10: JoinViewModel
public JoinViewModel(
[Import(typeof(IEventAggregator))] IEventAggregator aggregator,
[Import(typeof(IAuthorizationService))] IAuthorizationService authorizator,
[Import(typeof(IDialogService))] IDialogService dialogService)
{
this.aggregator = aggregator;
this.authorizator = authorizator;
this.dialogs = dialogService;
aggregator.Subscribe(ScrumFactoryEvent.ShowJoinDialog, Show);
aggregator.Subscribe<ICollection<Role>>(ScrumFactoryEvent.ProjectRolesChanged, OnRolesChanged);
JoinProjectCommand = new DelegateCommand(CanJoinProject, JoinProject);
}
示例11: ProjectTeamViewModel
public ProjectTeamViewModel(
[Import]IEventAggregator eventAggregator,
[Import]IProjectsService projectsServices,
[Import]ITeamService teamServices,
[Import]ITasksService taskServices,
[Import]IBackgroundExecutor backgroundExecutor,
[Import] IDialogService dialogs,
[Import]IAuthorizationService authorizationService)
{
this.taskServices = taskServices;
this.aggregator = eventAggregator;
this.projectsServices = projectsServices;
this.teamServices = teamServices;
this.executor = backgroundExecutor;
this.authorizator = authorizationService;
this.dialogs = dialogs;
ShowRolesListCommand = new DelegateCommand(CanShowRoleList, ShowRolesList);
AddNewMemberCommand = new DelegateCommand(CanAddNewMember, AddNewMember);
RemoveMemberCommand = new DelegateCommand<ProjectMembershipViewModel>(CanRemoveMember, RemoveMember);
ShowJoinDialogCommand = new DelegateCommand(CanJoinProject, ShowJoinDialog);
ShowContactListCommand = new DelegateCommand(ShowContactList);
SelectNewRoleCommand = new DelegateCommand<Role>(SelectNewRole);
membershipViewSource = new System.Windows.Data.CollectionViewSource();
membershipViewSource.SortDescriptions.Add(new SortDescription("SortPriority", ListSortDirection.Ascending));
membershipViewSource.SortDescriptions.Add(new SortDescription("ProjectMembership.Role.RoleName", ListSortDirection.Ascending));
membershipViewSource.SortDescriptions.Add(new SortDescription("Member.FullName", ListSortDirection.Ascending));
membershipViewSource.Filter += new System.Windows.Data.FilterEventHandler(membershipViewSource_Filter);
aggregator.Subscribe<Project>(ScrumFactoryEvent.ViewProjectDetails, OnViewProjectDetails);
aggregator.Subscribe<ICollection<Role>>(ScrumFactoryEvent.ProjectRolesChanged, roles => { OnPropertyChanged("Roles"); });
aggregator.Subscribe<Role>(ScrumFactoryEvent.ProjectRoleChanged, role => { membershipViewSource.View.Refresh(); });
aggregator.Subscribe(ScrumFactoryEvent.ShowProjectTeam, () => { aggregator.Publish<IProjectTabViewModel>(ScrumFactoryEvent.ShowProjectTab, this); });
// need thi when membership is removed from the project module
aggregator.Subscribe<ProjectMembership>(ScrumFactoryEvent.ProjectMembershipRemoved, AfterRemoveMember);
MemberCustomFilter = MemberFilter;
RefreshMemberFilter = LoadMembers;
}
示例12: AchievementsManager
public AchievementsManager(IAchievementsService achievementsService, ISettingsManager settingsManager, IPersistenceManager persistenceManager, IEventAggregator eventAggregator)
{
_settingsManager = settingsManager;
_persistenceManager = persistenceManager;
_achievementsService = achievementsService;
_eventAggregator = eventAggregator;
eventAggregator.Subscribe<LoggedOnEvent>((ev) =>
{
SynchronizeAchievementDefinitions();
SynchronizeAchievementState();
});
eventAggregator.Subscribe<EmulatorStartingEvent>(EmulatorStarting);
}
示例13: UsageSettingsViewModel
public UsageSettingsViewModel(IEventAggregator events)
{
this.events = events;
DisplayName = "Improve Hearthstone Tracker:";
Order = 11;
events.Subscribe(this);
}
示例14: BaseShellViewModel
protected BaseShellViewModel(IEventAggregator eventAggregator)
{
this._eventAggregator = eventAggregator as EventAggregator;
eventAggregator.Subscribe(this);
Application.Current.Host.Content.FullScreenChanged += new EventHandler(this.ContentFullScreenChanged);
base.PropertyChanged += new PropertyChangedEventHandler(this.BaseShellViewModelPropertyChanged);
}
示例15: EmbeddedOrderViewModel
public EmbeddedOrderViewModel(IEventAggregator events, Stock stock)
{
this._events = events;
events.Subscribe(this);
StockOrder = new StockOrder {Stock = stock};
}