示例#1
0
 private Task SendToAttendeeAsync(AttendeeInfo attendee, string message)
 {
     try
     {
         var connectionId = _attendeeInfo[attendee.ID].ConnectionID;
         return(_hubContext.Clients.Client(connectionId).SendCoreAsync(Commands.SEND_TO_ATTENDEE, new object[] { message }));
         //return _hubContext.Clients.Client(connectionId).SendAsync(Commands.SEND_TO_ATTENDEE, message);
     }
     catch
     {
         Debug.WriteLine(String.Join(',', _attendeeInfo.Keys.ToArray()));
         throw;
     }
 }
示例#2
0
        //  Attendee registeration. provides name and preferred language and speaking language
        private Task <bool> InitializeAttendeeInfo(string name, string myLanguage, string preferredLanguage)
        {
            bool         exists   = false;
            AttendeeInfo attendee = null;

            if (!_attendeeInfo.ContainsKey(name))
            {
                attendee = new AttendeeInfo();
            }
            else
            {
                attendee = _attendeeInfo[name];
                exists   = true;
            }
            attendee.ID                = name;
            attendee.ConnectionID      = Context.ConnectionId;
            attendee.SpeakingLanguage  = myLanguage;
            attendee.PreferredLanguage = preferredLanguage;

            _attendeeInfo[name] = attendee;

            return(Task.FromResult <bool>(exists));
        }