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


C# IEventAggregator.ThrowIfNull方法代码示例

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


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

示例1: FchatService

        /// <summary>
        ///     Initializes a new instance of the <see cref="FchatService" /> class.
        ///     Chat connection is used to communicate with F-Chat using websockets.
        /// </summary>
        /// <param name="user">
        ///     The user.
        /// </param>
        /// <param name="eventagg">
        ///     The eventagg.
        /// </param>
        /// <param name="socket"></param>
        /// <param name="provider"></param>
        public FchatService(IAccount user, IEventAggregator eventagg, WebSocket socket, ITicketProvider provider)
        {
            this.socket = socket;
            this.provider = provider;
            Account = user.ThrowIfNull("user");
            events = eventagg.ThrowIfNull("eventagg");

            events.GetEvent<CharacterSelectedLoginEvent>()
                .Subscribe(ConnectToChat, ThreadOption.BackgroundThread, true);

            errsThatDisconnect = new[]
                {
                    Constants.Errors.NoLoginSlots,
                    Constants.Errors.NoServerSlots,
                    Constants.Errors.KickedFromServer,
                    Constants.Errors.SimultaneousLoginKick,
                    Constants.Errors.BannedFromServer,
                    Constants.Errors.BadLoginInfo,
                    Constants.Errors.TooManyConnections,
                    Constants.Errors.UnknownLoginMethod
                };

            InitializeLog();

            autoPingTimer.Elapsed += (s, e) => TrySend(Constants.ClientCommands.SystemPing);
            autoPingTimer.Start();

            staggerTimer = new Timer(GetNextConnectDelay()); // first reconnect is 5 seconds
            staggerTimer.Elapsed += (s, e) => DoReconnect();
        }
开发者ID:Khayde,项目名称:slimCat,代码行数:42,代码来源:F-ChatConnection.cs

示例2: FlistService

        public FlistService(IAccount model, IEventAggregator eventagg, IBrowseThings browser,
            IGetTickets ticketService, IFriendRequestService requestService)
        {
            this.browser = browser;
            this.ticketService = ticketService;
            this.requestService = requestService;

            try
            {
                this.model = model.ThrowIfNull("model");
                events = eventagg.ThrowIfNull("eventagg");

                events.GetEvent<LoginEvent>().Subscribe(GetTicket, ThreadOption.BackgroundThread);
                events.GetEvent<UserCommandEvent>().Subscribe(HandleCommand, ThreadOption.BackgroundThread);
                events.GetEvent<CharacterSelectedLoginEvent>().Subscribe(args => selectedCharacter = args);

                // fix problem with SSL not being trusted on some machines
                ServicePointManager.ServerCertificateValidationCallback =
                    (sender, certificate, chain, sslPolicyErrors) => true;
            }
            catch (Exception ex)
            {
                Exceptions.HandleException(ex);
            }
        }
开发者ID:WreckedAvent,项目名称:slimCat,代码行数:25,代码来源:FlistService.cs

示例3: ViewModelBase

        protected ViewModelBase(IUnityContainer contain, IRegionManager regman, IEventAggregator events, IChatModel cm,
            ICharacterManager manager)
        {
            try
            {
                Container = contain.ThrowIfNull("contain");
                RegionManager = regman.ThrowIfNull("regman");
                Events = events.ThrowIfNull("events");
                ChatModel = cm.ThrowIfNull("cm");
                CharacterManager = manager.ThrowIfNull("manager");

                RightClickMenuViewModel = new RightClickMenuViewModel(ChatModel.IsGlobalModerator, CharacterManager);
                CreateReportViewModel = new CreateReportViewModel(Events, ChatModel);
                ChatModel.SelectedChannelChanged += OnSelectedChannelChanged;

                Events.GetEvent<NewUpdateEvent>().Subscribe(UpdateRightClickMenu);
            }
            catch (Exception ex)
            {
                ex.Source = "Generic ViewModel, init";
                Exceptions.HandleException(ex);
            }
        }
开发者ID:Khayde,项目名称:slimCat,代码行数:23,代码来源:ViewModelBase.cs

示例4: MessageService

        public MessageService(
            IRegionManager regman,
            IUnityContainer contain,
            IEventAggregator events,
            IChatModel model,
            IChatConnection connection,
            IListConnection api,
            ICharacterManager manager,
            ILoggingService logger,
            IAutomationService automation)
        {
            this.logger = logger;
            this.automation = automation;

            try
            {
                region = regman.ThrowIfNull("regman");
                container = contain.ThrowIfNull("contain");
                this.events = events.ThrowIfNull("events");
                this.model = model.ThrowIfNull("model");
                this.connection = connection.ThrowIfNull("connection");
                this.api = api.ThrowIfNull("api");
                characterManager = manager.ThrowIfNull("characterManager");

                this.model.SelectedChannelChanged += (s, e) => RequestNavigate(this.model.CurrentChannel.Id);

                this.events.GetEvent<ChatOnDisplayEvent>()
                    .Subscribe(BuildHomeChannel, ThreadOption.UIThread, true);
                this.events.GetEvent<RequestChangeTabEvent>()
                    .Subscribe(RequestNavigate, ThreadOption.UIThread, true);
                this.events.GetEvent<UserCommandEvent>().Subscribe(CommandRecieved, ThreadOption.UIThread, true);

                commands = new Dictionary<string, CommandHandler>
                    {
                        {"priv", OnPrivRequested},
                        {Commands.UserMessage, OnPriRequested},
                        {Commands.ChannelMessage, OnMsgRequested},
                        {Commands.ChannelAd, OnLrpRequested},
                        {Commands.UserStatus, OnStatusChangeRequested},
                        {"close", OnCloseRequested},
                        {"join", OnJoinRequested},
                        {Commands.UserIgnore, OnIgnoreRequested},
                        {"clear", OnClearRequested},
                        {"clearall", OnClearAllRequested},
                        {"_logger_open_log", OnOpenLogRequested},
                        {"_logger_open_folder", OnOpenLogFolderRequested},
                        {"code", OnChannelCodeRequested},
                        {"_snap_to_last_update", OnNotificationFocusRequested},
                        {Commands.UserInvite, OnInviteToChannelRequested},
                        {"who", OnWhoInformationRequested},
                        {"getdescription", OnChannelDescripionRequested},
                        {"interesting", OnMarkInterestedRequested},
                        {"notinteresting", OnMarkNotInterestedRequested},
                        {"ignoreUpdates", OnIgnoreUpdatesRequested},
                        {Commands.AdminAlert, OnReportRequested},
                        {"tempignore", OnTemporaryIgnoreRequested},
                        {"tempunignore", OnTemporaryIgnoreRequested},
                        {"tempinteresting", OnTemporaryInterestingRequested},
                        {"tempnotinteresting", OnTemporaryInterestingRequested},
                        {"handlelatest", OnHandleLatestReportRequested},
                        {"handlereport", OnHandleLatestReportByUserRequested}
                    };
            }
            catch (Exception ex)
            {
                ex.Source = "Message Daemon, init";
                Exceptions.HandleException(ex);
            }
        }
开发者ID:Khayde,项目名称:slimCat,代码行数:69,代码来源:MessageService.cs

示例5: FchatService

        public FchatService(IAccount user, IEventAggregator eventagg, WebSocket socket, IGetTickets service)
        {
            this.socket = socket;
            this.service = service;
            Account = user.ThrowIfNull("user");
            events = eventagg.ThrowIfNull("eventagg");

            events.GetEvent<CharacterSelectedLoginEvent>()
                .Subscribe(ConnectToChat, ThreadOption.BackgroundThread, true);

            errsThatDisconnect = new[]
            {
                NoLoginSlots,
                NoServerSlots,
                KickedFromServer,
                SimultaneousLoginKick,
                BannedFromServer,
                BadLoginInfo,
                TooManyConnections,
                UnknownLoginMethod,
                TimedOutFromServer
            };

            errsThatPreventReconnect = new[]
            {
                BannedFromServer,
                TooManyConnections,
                KickedFromServer,
                UnknownLoginMethod,
                SimultaneousLoginKick,
                TimedOutFromServer
            };

            noisyTypes = new[]
            {
                UserJoin,
                UserLeave,
                UserStatus,
                PublicChannelList,
                PrivateChannelList,
                UserList,
                ChannelMessage,
                ChannelAd
            };

            autoPingTimer.Elapsed += (s, e) => TrySend(Constants.ClientCommands.SystemPing);

            staggerTimer = new Timer(GetNextConnectDelay()); // first reconnect is 5 seconds
            staggerTimer.Elapsed += (s, e) => DoReconnect();

            timeoutTimer = new Timer(TimeoutTimeMs); // 30 seconds
            timeoutTimer.Elapsed += (s, e) => OnTimeout();
        }
开发者ID:ZornTaov,项目名称:slimCat,代码行数:53,代码来源:FchatService.cs


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