当前位置: 首页>>代码示例>>C#>>正文


C# IEventAggregator.Subscribe方法代码示例

本文整理汇总了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();
 }
开发者ID:brucedog,项目名称:homesecurityviewer,代码行数:8,代码来源:ImageService.cs

示例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);
        }
开发者ID:klot-git,项目名称:scrum-factory,代码行数:34,代码来源:UserTasksSelectorViewModel.cs

示例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();
		}
开发者ID:ArildF,项目名称:Smeedee,代码行数:26,代码来源:WebPageWidget.cs

示例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(); });
        }
开发者ID:klot-git,项目名称:scrum-factory,代码行数:28,代码来源:BurndownViewModel.cs

示例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());
        }
开发者ID:hemantksingh,项目名称:MusicManager,代码行数:35,代码来源:MainViewModel.cs

示例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();
                });
            });
        }
开发者ID:klot-git,项目名称:scrum-factory,代码行数:33,代码来源:MemberViewModel.cs

示例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);
        }
开发者ID:klot-git,项目名称:scrum-factory,代码行数:31,代码来源:ProjectDetailViewModel.cs

示例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");
        }
开发者ID:Dustin-Howell,项目名称:Capstone,代码行数:12,代码来源:Game1.cs

示例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);
        }
开发者ID:PhilipBrockmeyer,项目名称:Wren,代码行数:12,代码来源:GameEventAggregator.cs

示例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);
        }
开发者ID:klot-git,项目名称:scrum-factory,代码行数:14,代码来源:JoinViewModel.cs

示例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;
        }
开发者ID:klot-git,项目名称:scrum-factory,代码行数:49,代码来源:ProjectTeamViewModel.cs

示例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);
        }
开发者ID:PhilipBrockmeyer,项目名称:Wren,代码行数:15,代码来源:AchievementsManager.cs

示例13: UsageSettingsViewModel

 public UsageSettingsViewModel(IEventAggregator events)
 {
     this.events = events;
     DisplayName = "Improve Hearthstone Tracker:";
     Order = 11;
     events.Subscribe(this);
 }
开发者ID:ProjectTako,项目名称:HearthstoneTracker,代码行数:7,代码来源:UsageSettingsViewModel.cs

示例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);
 }
开发者ID:BigBri41,项目名称:TWCTVWindowsPhone,代码行数:7,代码来源:BaseShellViewModel.cs

示例15: EmbeddedOrderViewModel

        public EmbeddedOrderViewModel(IEventAggregator events, Stock stock)
        {
            this._events = events;
            events.Subscribe(this);

            StockOrder = new StockOrder {Stock = stock};
        }
开发者ID:MBrepo,项目名称:Stock_Market,代码行数:7,代码来源:EmbeddedOrderViewModel.cs


注:本文中的IEventAggregator.Subscribe方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。