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


C# IEventAggregator.Publish方法代码示例

本文整理汇总了C#中IEventAggregator.Publish方法的典型用法代码示例。如果您正苦于以下问题:C# IEventAggregator.Publish方法的具体用法?C# IEventAggregator.Publish怎么用?C# IEventAggregator.Publish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEventAggregator的用法示例。


在下文中一共展示了IEventAggregator.Publish方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateStats

    public virtual void UpdateStats(BaseCaracterStats statData, IEventAggregator messenger)
    {
        MaxLife += statData.MaxLife;
        Life += statData.Life;
        if (MaxLife < Life) Life = MaxLife;
        if (Life <= 0)
        {
            Life = 0;
            messenger.Publish(new StopMessage());
            messenger.Publish(new PlayerDeathMessage());
        }
        RedHearts += statData.RedHearts;
        BlueHearts += statData.BlueHearts;
        YellowHearts += statData.YellowHearts;

        Attack += statData.Attack;
        BaseSpeed += statData.BaseSpeed;
        CurrentSpeed = BaseSpeed;
        AttackCadence += statData.AttackCadence;
        if (statData.OldTools)
        {
            OldTools = statData.OldTools;
        }
        messenger.Publish(new UpdateGuiMessage(this));
    }
开发者ID:Marchys,项目名称:fanalet,代码行数:25,代码来源:BaseProtagonistStats.cs

示例2: OkCancelPanelViewModel

        public OkCancelPanelViewModel(IEventAggregator eventAggregator)
        {
            this.OkCommand = new DelegateCommand<object>(
                o => eventAggregator.Publish(new CleanUpFilesMessage()));

            this.CancelCommand = new DelegateCommand<object>(o =>
                eventAggregator.Publish(new ClearFileSelectionMessage()));
        }
开发者ID:hemantksingh,项目名称:MusicManager,代码行数:8,代码来源:OkCancelPanelViewModel.cs

示例3: MenuViewModel

        //, Func<ProjectExplorerViewModel> projectExplorerViewModelBuilder, Func<EventAggregatorDebugViewModel> eventsDebugBuilder,)
        public MenuViewModel(IEventAggregator eventAggregator, Func<TeapotViewModel> teapotBuilder, IScriptRunner script, ProjectManager manager)
        {
            _eventAggregator = eventAggregator;
            Items = new BindableCollection<MenuItemViewModel> {
                new MenuItemViewModel {
                    Header = "_FILE",
                    Items = new BindableCollection<MenuItemViewModel> {
                        new MenuItemViewModel {
                            Header = "_Open",
                            Items = new BindableCollection<MenuItemViewModel> {
                                new MenuItemViewModel {
                                    Header = "_Project",
                                    Action = () => _eventAggregator.Publish(new OpenProjectDialog())
                                },
                                new MenuItemViewModel {
                                    Header = "Teapot",
                                    Action = () => _eventAggregator.Publish(new AddTabViewCommand {Model = teapotBuilder()})
                                },

                            }
                        },
                        new MenuItemViewModel {
                            Header = "Close",
                            Action = () => _eventAggregator.Publish(new DebugCommand("close"))
                        }
                    }
                },
                new MenuItemViewModel {
                    Header = "_EDIT"
                },
                new MenuItemViewModel {
                    Header = "_VIEW"
                },
                new MenuItemViewModel {
                    Header = "_BUILD",
                    Items = new BindableCollection<MenuItemViewModel> {
                        new MenuItemViewModel {
                            Header = "_Build Project",
                            Action = () => script.Execute(manager.Project)
                        },
                        new MenuItemViewModel {
                            Header = "Teapot",
                            Action = () => _eventAggregator.Publish(new AddTabViewCommand {Model = teapotBuilder()})
                        },

                    }
                },
                new MenuItemViewModel {
                    Header = "_WINDOW"
                },
                new MenuItemViewModel {
                    Header = "_HELP"
                }
            };
        }
开发者ID:veggielane,项目名称:OpenCAD,代码行数:56,代码来源:MenuViewModel.cs

示例4: MenuViewModel

 public MenuViewModel(IEventAggregator eventAggregator,
                      Func<ProjectExplorerViewModel> projectExplorerViewModelBuilder,
                      Func<EventAggregatorDebugViewModel> eventsDebugBuilder,
                      Func<TeapotViewModel> teapotBuilder)
 {
     _eventAggregator = eventAggregator;
     Items = new BindableCollection<MenuItemViewModel> {
         new MenuItemViewModel {
             Header = "_FILE",
             Items = new BindableCollection<MenuItemViewModel> {
                 new MenuItemViewModel {
                     Header = "Open Teapot",
                     Action = () =>
                              _eventAggregator.Publish(new AddTabViewCommand {Model = teapotBuilder()})
                 },
                 new MenuItemViewModel {
                     Header = "Open Events Tool",
                     Action = () =>
                              _eventAggregator.Publish(new AddToolViewCommand {Model = eventsDebugBuilder()})
                 },
                 new MenuItemViewModel {
                     Header = "Open Project Explorer",
                     Action = () =>
                              _eventAggregator.Publish(new AddToolViewCommand {Model = projectExplorerViewModelBuilder()})
                 },
                 new MenuItemViewModel {
                     Header = "Add part",
                     Action = () => _eventAggregator.Publish(new AddPartCommand {Part = new JsonPartMeta {FilePath = @"C:\temp\OpenCad\temp.cadpart"}})
                 },
                 new MenuItemViewModel {
                     Header = "Open Part",
                     Action = () =>
                              _eventAggregator.Publish(new AddTabViewCommand {Model = new PartViewModel()})
                 }
             }
         },
         new MenuItemViewModel {
             Header = "_EDIT"
         },
         new MenuItemViewModel {
             Header = "_VIEW"
         },
         new MenuItemViewModel {
             Header = "_WINDOW"
         },
         new MenuItemViewModel {
             Header = "_HELP"
         }
     };
 }
开发者ID:veggielane,项目名称:OpenCAD_old,代码行数:50,代码来源:MenuViewModel.cs

示例5: ExpensesFilterVM

        public ExpensesFilterVM(IEventAggregator eventAggregator)
        {
            //CashFlows = new BindableCollectionExt<ExpensesFilterEntityVM>();
            //CashFlowGroups = new BindableCollectionExt<ExpensesFilterEntityVM>();

            PropertyChanged += (s, e) => { eventAggregator.Publish(this); };
        }
开发者ID:adalbertus,项目名称:BudgetPlanner,代码行数:7,代码来源:ExpensesFilterVM.cs

示例6: PublishChange

 private static void PublishChange(IEventAggregator aggregator)
 {
     Task.Factory.StartNew(() =>
     {
         var message = new NetworkStatusChanged();
         aggregator.Publish(message);
     });
 }
开发者ID:Bunk,项目名称:trellow,代码行数:8,代码来源:NetworkService.cs

示例7: SpeakerViewModel

 public SpeakerViewModel(IEventAggregator eventAggregator, IWindowManager windowManager, ILoggingService loggingService)
 {
     EventAggregator = eventAggregator;
     _windowManager = windowManager;
     _loggingService = loggingService;
     EventAggregator.Publish(this);
     GetEventPresentationsForSpeaker(Int32.Parse(App.EventId), Int32.Parse(App.PersonId));
 }
开发者ID:onetug,项目名称:CodeCamp2011,代码行数:8,代码来源:SpeakerViewModel.cs

示例8: MessageListViewModel

        public MessageListViewModel(IEventAggregator eventAggregator)
        {
            ServiceControl.Instance.Messages()
                .SubscribeOnBackground()
                .Subscribe(ms => Messages = ms.DeserializeCollection<Message>());

            this.ChangedProperty<Message>(nameof(SelectedMessage))
                .Subscribe(m => eventAggregator.Publish(new MessageSelected() { Id = m.After?.Id }));
        }
开发者ID:distantcam,项目名称:ServiceInsight2,代码行数:9,代码来源:MessageListViewModel.cs

示例9: CardReader

        public CardReader(ILog log, IEventAggregator eventAggregator)
        {
            Log = log;
            EventAggregator = eventAggregator;

            Log.Debug("CardReader constructed");

            Connect();

            KeepAliveTimer = new Timer(s => EventAggregator.Publish(new KeepAlive()), null, KeepAliveInterval, KeepAliveInterval);
        }
开发者ID:edjo23,项目名称:shop,代码行数:11,代码来源:CardReader.cs

示例10: TopNavigationViewModel

 public TopNavigationViewModel(ImageGetter getter, IEventAggregator events)
 {
     _Events = events;
     Commands = new List<CommandItem>
     {
         new CommandItem { Image = getter.Home, DoCommand = () => {_Events.Publish(new NavigationMessage { Action = NavigationCommand.Home });} },
         new CommandItem { Image = getter.ArrowLeft, DoCommand = () => {throw new NotImplementedException("Left command is not implemented yet");} },
         new CommandItem { Image = getter.ArrowRight, DoCommand = () => {throw new NotImplementedException("Right command is not implemented yet");} },
         new CommandItem { Image = getter.Settings, DoCommand = () => {throw new NotImplementedException("Settings command is not implemented yet");} },
         new CommandItem { Image = getter.Help, DoCommand = () => {throw new NotImplementedException("Help command is not implemented yet");} }
     };
 }
开发者ID:PeterVDD,项目名称:Kermit,代码行数:12,代码来源:TopNavigationViewModel.cs

示例11: CarsRemoverCommand

 public CarsRemoverCommand( IMouseInformation mouseInformation, Factories.Factories factories, IEventAggregator eventAggregator )
 {
     Contract.Requires( mouseInformation != null );
     Contract.Requires( factories != null );
     Contract.Requires( eventAggregator != null );
     this._mouseInformation = mouseInformation;
     this._mouseInformation.LeftButtonPressed.Subscribe( s =>
                         {
                             var carInserter = new CarsRemover( factories, s.Location );
                             eventAggregator.Publish( new AddControlToRoadLayer( carInserter ) );
                         } );
 }
开发者ID:Klakier,项目名称:Road-Traffic-Simualator,代码行数:12,代码来源:CarsRemoverCommand.cs

示例12: EditResource

        public static void EditResource(IResourceModel resource, IEventAggregator eventAggregator)
        {
            if(eventAggregator == null)
            {
                throw new ArgumentNullException("eventAggregator");
            }
            if(resource != null)
            {
                switch(resource.ResourceType)
                {
                    case ResourceType.WorkflowService:
                        eventAggregator.Publish(new AddWorkSurfaceMessage(resource));
                        break;

                    case ResourceType.Service:
                        eventAggregator.Publish(new ShowEditResourceWizardMessage(resource));
                        break;
                    case ResourceType.Source:
                        eventAggregator.Publish(new ShowEditResourceWizardMessage(resource));
                        break;
                }
            }
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:23,代码来源:WorkflowDesignerUtils.cs

示例13: AlbumViewModel

        public AlbumViewModel(Album album)
        {
            _events = IoC.Get<IEventAggregator>();
            _windowManager = IoC.Get<IWindowManager>();
            Model = album;
            Tracks = new ReactiveList<TrackViewModel>();
            Tracks.AddRange(album.Tracks.Select(x => new TrackViewModel(x)));

            AddAlbumToPlaylistCommand = new ReactiveCommand();
            AddAlbumToPlaylistCommand.Subscribe(param => _events.Publish(Tracks.Select(x => x.Track).ToList()));

            EditorEditAlbumsCommand = new ReactiveCommand();
            EditorEditAlbumsCommand.Subscribe(
                param => _windowManager.ShowDialog(new AlbumTagEditorViewModel(Tracks.Select(x => x.Track.Model).ToList())));
        }
开发者ID:gfdittmer,项目名称:MiSharp,代码行数:15,代码来源:AlbumViewModel.cs

示例14: ArtistViewModel

        public ArtistViewModel(Artist artist)
        {
            Model = artist;
            Albums = artist.Albums;
            _events = IoC.Get<IEventAggregator>();
            _windowManager = IoC.Get<IWindowManager>();

            AddArtistToPlaylistCommand = new ReactiveCommand();
            AddArtistToPlaylistCommand.Subscribe(
                param => _events.Publish(Albums.SelectMany(x => x.Tracks).Select(x => x).ToList()));

            EditorEditArtistsCommand = new ReactiveCommand();
            EditorEditArtistsCommand.Subscribe(param => _windowManager.ShowDialog(
                new ArtistTagEditorViewModel(Albums.SelectMany(x => x.Tracks).Select(x => x.Model).ToList())));
        }
开发者ID:gfdittmer,项目名称:MiSharp,代码行数:15,代码来源:ArtistViewModel.cs

示例15: LoadAsync

        /// <summary>
        /// Loads the given URI by using an asynchronous request.
        /// </summary>
        /// <param name="requesters">The requesters to try.</param>
        /// <param name="request">The data of the request to send.</param>
        /// <param name="events">The event aggregator.</param>
        /// <param name="cancel">
        /// The token which can be used to cancel the request.
        /// </param>
        /// <returns>
        /// The task which will eventually return the response.
        /// </returns>
        public static async Task<IResponse> LoadAsync(this IEnumerable<IRequester> requesters, IRequest request, IEventAggregator events, CancellationToken cancel)
        {
            foreach (var requester in requesters)
            {
                if (requester.SupportsProtocol(request.Address.Scheme))
                {
                    using (var evt = new RequestStartEvent(requester, request))
                    {
                        if (events != null)
                            events.Publish(evt);

                        return await requester.RequestAsync(request, cancel).ConfigureAwait(false);
                    }
                }
            }

            return default(IResponse);
        }
开发者ID:sparra,项目名称:AngleSharp,代码行数:30,代码来源:RequesterExtensions.cs


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