本文整理汇总了C#中IAccount.ThrowIfNull方法的典型用法代码示例。如果您正苦于以下问题:C# IAccount.ThrowIfNull方法的具体用法?C# IAccount.ThrowIfNull怎么用?C# IAccount.ThrowIfNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAccount
的用法示例。
在下文中一共展示了IAccount.ThrowIfNull方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: 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();
}
示例3: LoginViewModel
private bool requestIsSent; // used for determining Login UI state
#endregion Fields
#region Constructors
public LoginViewModel(
IUnityContainer contain, IRegionManager regman, IAccount acc, IEventAggregator events, IChatModel cm,
ICharacterManager lists)
: base(contain, regman, events, cm, lists)
{
try
{
model = acc.ThrowIfNull("acc");
}
catch (Exception ex)
{
ex.Source = "Login ViewModel, Init";
Exceptions.HandleException(ex);
}
}
示例4: CharacterSelectViewModel
public CharacterSelectViewModel(
IUnityContainer contain, IRegionManager regman, IEventAggregator events, IAccount acc, IChatModel cm,
ICharacterManager manager)
: base(contain, regman, events, cm, manager)
{
try
{
model = acc.ThrowIfNull("acc");
Events.GetEvent<LoginCompleteEvent>()
.Subscribe(HandleLoginComplete, ThreadOption.UIThread, true);
}
catch (Exception ex)
{
ex.Source = "Character Select ViewModel, 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();
}