本文整理汇总了C#中IHub类的典型用法代码示例。如果您正苦于以下问题:C# IHub类的具体用法?C# IHub怎么用?C# IHub使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IHub类属于命名空间,在下文中一共展示了IHub类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SearchResultsPageViewModel
public SearchResultsPageViewModel(ApplicationSettings settings, INavigationService navigationService, IImageSearchService imageSearchService, IHub hub, IAccelerometer accelerometer, IStatusService statusService, IShareDataRequestedPump shareMessagePump)
{
_settings = settings;
_navigationService = navigationService;
_imageSearchService = imageSearchService;
_hub = hub;
_accelerometer = accelerometer;
_statusService = statusService;
HomeCommand = _navigationService.GoBackCommand;
ViewDetailsCommand = new DelegateCommand(ViewDetails, () => SelectedImage != null);
LoadMoreCommand = new AsyncDelegateCommand(LoadMore);
ThumbnailViewCommand = new DelegateCommand(ThumbnailView);
ListViewCommand = new DelegateCommand(ListView);
SplitViewCommand = new DelegateCommand(SplitView);
SettingsCommand = new DelegateCommand(Settings);
AddImages(_settings.SelectedInstance.Images);
shareMessagePump.DataToShare = _settings.SelectedInstance.QueryLink;
_statusService.Title = _settings.SelectedInstance.Query;
_accelerometer.Shaken += accelerometer_Shaken;
_navigationService.Navigating += NavigatingFrom;
UpdateCurrentView(CurrentView);
_hub.Send(new UpdateTileImageCollectionMessage(_settings.SelectedInstance));
}
示例2: HubInvokerContext
public HubInvokerContext(IHub hub, TrackingDictionary state, MethodDescriptor methodDescriptor, object[] args)
{
Hub = hub;
MethodDescriptor = methodDescriptor;
Args = args;
State = state;
}
示例3: ProcessTurn
public void ProcessTurn(IHub services)
{
var personService = services.Resolve<IPersonService>();
var gameClockService = services.Resolve<IGameClockService>();
foreach(var person in personService.People.Where(p => !personService.IsRetired(p)))
{
if (person.RetirementDate > gameClockService.CurrentDate)
{
continue;
}
var currentWorkHistory = person.WorkHistory.FirstOrDefault(wh => !wh.EndDate.HasValue);
if(currentWorkHistory != null)
{
var employee = currentWorkHistory.Company.GetEmployee(person.Id);
if(!employee.IsFounder)
{
currentWorkHistory.EndDate = gameClockService.CurrentDate;
currentWorkHistory.EndingSalary = employee.Salary;
}
}
}
}
示例4: UserInputLoop
internal static void UserInputLoop(IHub hub)
{
string userInput;
while (!string.IsNullOrEmpty((userInput = Console.ReadLine())))
{
if (userInput.Equals("pose", StringComparison.OrdinalIgnoreCase))
{
foreach (var myo in hub.Myos)
{
Console.WriteLine("Myo {0} in pose {1}.", myo.Handle, myo.Pose);
}
}
else if (userInput.Equals("arm", StringComparison.OrdinalIgnoreCase))
{
foreach (var myo in hub.Myos)
{
Console.WriteLine("Myo {0} is on {1} arm.", myo.Handle, myo.Arm.ToString().ToLower());
}
}
else if (userInput.Equals("count", StringComparison.OrdinalIgnoreCase))
{
Console.WriteLine("There are {0} Myo(s) connected.", hub.Myos.Count);
}
}
}
示例5: HubInvokerContext
public HubInvokerContext(IHub hub, StateChangeTracker tracker, MethodDescriptor methodDescriptor, IList<object> args)
{
Hub = hub;
MethodDescriptor = methodDescriptor;
Args = args;
StateTracker = tracker;
}
示例6: VoipChannel
public VoipChannel(IHub hub, CoreDispatcher dispatcher,
VoipContext context)
{
_hub = hub;
Dispatcher = dispatcher;
Context = context;
}
示例7: JiraServiceViewModel
protected JiraServiceViewModel(IHub messageHub)
{
MessageHub = messageHub;
SettingsCommand = new DelegateCommand(OpenSettings);
SearchCommand = new DelegateCommand(ShowSearchPane);
}
示例8: ProcessTurn
public void ProcessTurn(IHub services)
{
var companyService = services.Resolve<ICompanyService>();
var gameClockService = services.Resolve<IGameClockService>();
foreach(var company in companyService.Companies)
{
foreach(var project in company.Projects)
{
if (IsProjectComplete(project))
{
CompleteProject(company, project);
companyService.ProcessTransaction(company, TransactionType.Project, project.Value, $"Completed {project.Definition.Name} project.");
}
else
{
var deadline = project.ExtensionDeadline.HasValue ?
project.ExtensionDeadline.Value :
project.Deadline;
if (gameClockService.CurrentDate >= deadline)
{
FailProject(company, project);
}
}
}
}
}
示例9: OnBeforeReconnect
protected override bool OnBeforeReconnect(IHub hub)
{
SignalRContext.ConnectionIdToSessionId[hub.Context.ConnectionId] = hub.GetSessionId();
Storage session = hub.GetSession();
session[InternalSessionKeys.DisconnectTimeKey] = null;
return base.OnBeforeReconnect(hub);
}
示例10: OnBeforeDisconnect
protected override bool OnBeforeDisconnect(IHub hub, bool stopCalled)
{
if (stopCalled)
{
hub.ClearSession();
}
return base.OnBeforeDisconnect(hub, stopCalled);
}
示例11: IssueViewModel
public IssueViewModel(IHub messageHub, ISettings settings, IDialogService dialogService, IJiraService service)
: base(messageHub)
{
_dialogService = dialogService;
_settings = (ApplicationSettings)settings;
_service = service;
LoadIssueComments();
}
示例12: ServiceCore
protected ServiceCore(IHub services)
{
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
_services = services;
}
示例13: OnAfterDisconnect
protected override void OnAfterDisconnect(IHub hub, bool stopCalled)
{
string sessionId;
SignalRContext.ConnectionIdToSessionId.TryRemove(hub.Context.ConnectionId, out sessionId);
Storage session = hub.GetSession();
session[InternalSessionKeys.DisconnectTimeKey] = DateTime.Now;
base.OnAfterDisconnect(hub, stopCalled);
}
示例14: ProcessTurn
public void ProcessTurn(IHub services)
{
var companyService = services.Resolve<ICompanyService>();
foreach(var company in companyService.Companies)
{
var accumulations = new Dictionary<int, decimal>();
foreach (var employee in company.Employees)
{
var allocations = company.Allocations.Where(a => a.Employee == employee);
var skillValues = new Dictionary<int, decimal>();
var remainingSkillValues = new Dictionary<int, decimal>();
foreach (var skill in employee.Person.Skills)
{
var skillValue = CalculateEmployeeSkillValue(employee, skill);
skillValues.Add(skill.SkillDefinition.Id, skillValue);
remainingSkillValues.Add(skill.SkillDefinition.Id, skillValue);
}
foreach (var allocation in allocations)
{
foreach (var requirement in allocation.Project.Requirements)
{
if (skillValues.ContainsKey(requirement.SkillDefinition.Id))
{
var value = allocation.Percent * skillValues[requirement.SkillDefinition.Id];
requirement.CurrentValue += value;
remainingSkillValues[requirement.SkillDefinition.Id] -= value;
}
}
}
foreach (var skill in remainingSkillValues)
{
if (accumulations.ContainsKey(skill.Key))
{
accumulations[skill.Key] += skill.Value;
}
else
{
accumulations.Add(skill.Key, skill.Value);
}
}
}
ProcessActionAccumulations(company, accumulations);
}
}
示例15: UpdateMeetingStatusToClients
private static void UpdateMeetingStatusToClients(IHub hub)
{
var meetingStati = BuildMeetingsStatus();
Debug.WriteLine("Meeting Status Update:");
foreach (var m in meetingStati)
{
Debug.WriteLine("Meeting {0} [HAsAgent:{1}] [HasClient:{2}] [MeetingStarted:{3}]", m.MeetingId, m.AgentJoined, m.ClientJoined, m.MeetingStarted);
}
hub.Clients.All.meetingStatusUpdated(meetingStati);
}