本文整理汇总了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();
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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();
}