public override bool tryPartition(IGraph graph, BackgroundWorker bgw, out Groups results) { ICollection<Motif> oMotifs; Groups oGroups; int i = 0; bool rv = TryCalculateDConnectorMotifs(graph, m_iDMinimum, m_iDMaximum, bgw, out oMotifs); if (rv == true) { oGroups = new Groups(oMotifs.Count); foreach (Motif m in oMotifs) { oGroups.Add(i, (DConnectorMotif)m); i++; } } else oGroups = new Groups(1); results = oGroups; return rv; }
public override bool tryPartition(IGraph graph, BackgroundWorker bgw, out Groups results) { ICollection<Community> oGraphMetrics; Groups oGroups; int i = 1; bool rv = TryCalculateClustersWakitaTsurumi(graph, bgw, out oGraphMetrics); if (rv == true) { oGroups = new Groups(oGraphMetrics.Count); foreach (Community m in oGraphMetrics) { oGroups.Add(i, m); i++; } } else oGroups = new Groups(1); results = oGroups; return rv; }
public Task JoinGroup(string groupName) { return(Groups.Add(Context.ConnectionId, groupName)); }
public async Task Subscribe(string topic) { await Groups.Add(Context.ConnectionId, topic); Clients.Client(Context.ConnectionId).onSubscribed(topic); }
public void createGroup(string userId) { string clientId = Context.ConnectionId; Groups.Add(clientId, userId); }
public void Join(string Name) { Groups.Add(Context.ConnectionId, Name); }
public void Subscribe(string userId) { Groups.Add(Context.ConnectionId, userId); }
public YmnosStructure(YmnosGroup group) { Groups.Add(new YmnosGroup(group)); }
public void JoinGroup(string groupName) { Groups.Add(Context.ConnectionId, groupName); Clients.All.reportGroupMember(groupName, Context.ConnectionId); }
private void AddToGroup() { Groups.Add(Context.ConnectionId, CurrentUser.UserName); }
public async Task AssociateJob(string jobId) { await Groups.Add(Context.ConnectionId, jobId); }
public void AddToGroups() { Groups.Add(Context.ConnectionId, "foo"); Groups.Add(Context.ConnectionId, "bar"); Caller.groupAdded(); }
public async Task SendMessage(string userIdPar, string message, string conId) { try { var loginUserId = Context.User.Identity.GetUserId(); var isInit = _context.Conversations.Any(c => c.Id == conId); if (!isInit) { var con = new Conversation() { Id = conId, Name = $"{loginUserId}_{userIdPar}", StartTime = DateTime.Now, CreatedBy = loginUserId, }; var savedCon = _context.Conversations.Add(con); var mes = new Message() { Id = Guid.NewGuid().ToString(), Content = message, ConversationId = savedCon.Id, SendTime = DateTime.Now, SentUserId = loginUserId }; var savedMes = _context.Messages.Add(mes); var savedUserConversation = _context.UserConversations.AddRange(new List <UserConversation>() { new UserConversation() { ConversationId = savedCon.Id, UserId = loginUserId, JoinedTime = DateTime.Now }, new UserConversation() { ConversationId = savedCon.Id, UserId = userIdPar, JoinedTime = DateTime.Now } }); await _context.SaveChangesAsync(); await Groups.Add(Context.ConnectionId, savedCon.Id); var connectionIdOfUserPar = connection.FirstOrDefault(c => c.UserId == userIdPar)?.ConnectionId; if (connectionIdOfUserPar != null) { await Groups.Add(connectionIdOfUserPar, savedCon.Id); } var sentUserName = _context.Users.FirstOrDefault(u => u.Id == loginUserId)?.UserName; var messageModel = new MessageModel() { MessageId = savedMes.Id, ConversationId = savedCon.Id, Content = savedMes.Content, SentUserId = savedMes.SentUserId, SentUserName = sentUserName ?? "noname", }; Clients.OthersInGroup(savedCon.Id).getMessage(messageModel); } else { var mes = new Message() { Id = Guid.NewGuid().ToString(), Content = message, ConversationId = conId, SendTime = DateTime.Now, SentUserId = loginUserId }; var savedMes = _context.Messages.Add(mes); await _context.SaveChangesAsync(); var sentUserName = _context.Users.FirstOrDefault(u => u.Id == loginUserId)?.UserName; var messageModel = new MessageModel() { MessageId = savedMes.Id, ConversationId = conId, Content = savedMes.Content, SentUserId = savedMes.SentUserId, SentUserName = sentUserName ?? "noname", }; Clients.OthersInGroup(conId).getMessage(messageModel); } } catch (Exception ex) { throw; } }
public void Subscribe(string customerId) { Groups.Add(Context.ConnectionId, customerId); }
public async Task JoinGroup(string group) { await Groups.Add(Context.ConnectionId, group); Clients.Group(group).doMessage("Joined Group:" + group); }
public override Task OnConnected() { Groups.Add(Context.ConnectionId, Context.ConnectionId).Wait(); return(PingGroup()); }
public void AddText(byte group, byte entry) { Groups.Add(group, entry); }
public string JoinGroup(string connectionId, string groupName) { Groups.Add(connectionId, groupName).Wait(); return(connectionId + " joined " + groupName); }
public async Task JoinGroup(string groupName) { await Groups.Add(Context.ConnectionId, groupName); Clients.Client(Context.ConnectionId).JoinGroup(); }
public void JoinGroup(string roomName) { Groups.Add(this.Context.ConnectionId, roomName); }
/* Gather required information for monitor clients and update records if necessary */ public void RegisterMonitor() { /* If the user is authenticated it retrieves the userId value from the authenticated information. * If the user is not authenticated it retrieves the value from the userId sent with the command */ if (Context.User.Identity.IsAuthenticated) { string id = Context.User.Identity.Name.GetUserId(); Clients.Caller.userId = id; } string userId = Clients.Caller.userId; /* Retrieve the userName from the database for the userId given */ string userName = Database.GetUserName(userId, ""); /* If userName is not present set it to the userId */ if (userName == null) { userName = userId; } /* Store the userId and userName on the connection for easy retrieval */ Clients.Caller.userId = userId; Clients.Caller.userName = userName; /* Update information in the chatHelper table for the user */ string chatHelper = Database.GetChatHelper(userId, Context.ConnectionId); /* No chatHelper record exists, display an error */ if (chatHelper == "noRecord") { Clients.Caller.throwMessage("User Not Found", "<p>No user record for ATTUID: '<b>" + userId + "</b>' found.</p><p>Unable to connect as a chatHelper at this time.</p>", true); return; } /* User shows connected in chatHelper, display an error */ if (chatHelper == "existingConnection") { Clients.Caller.throwMessage("User Already Connected", "<p>ATTUID: '<b>" + userId + "</b>' has an existing connection.</p><p>Please try again in a few minutes.</p>", true); return; } /* Add the connection to the group Monitor */ Groups.Add(Context.ConnectionId, groupNames.Monitor); /* Add the connection to a group based on userId */ Groups.Add(Context.ConnectionId, userId); /* Get Location Names From Location Codes */ string locationCodes = Database.GetLocationCodes(); /* Update the userName div on the main page with the recovered userName and send permissions */ Clients.Caller.updateDisplay(userName, chatHelper, locationCodes); /* Get QueryString of URL */ var url = HttpContext.Current.Request.Url.Query; var query = HttpUtility.ParseQueryString(url); var instance = query.Get("instance"); if (instance.ToLower() == "staging") { instance = "Staging"; } else { instance = "Prod"; } /* Retrieve list of Sasha Sessions from the sashaSessions and push them to the newly connected monitor */ string sashaSessionRecords = Database.GetSashaSessionRecords(instance); Clients.Caller.receiveSashaSessionRecords(sashaSessionRecords); }
public void Connect(string userid, string chatid) { var id = Context.ConnectionId; Groups.Add(id, chatid); }
/// <summary> /// This is called by all web app clients to be able to broadcast easier at a later time /// </summary> public async Task JoinWebApp() { await Groups.Add(Context.ConnectionId, Resources.WepAppClientsGroupName); }
// public string serverMethod(string msg) // { // return msg; // } // /// <summary> // /// return message to all client // /// </summary> // /// <param name="msg"></param> // public void serverToClient(string msg) // { // Clients.All.clientMethod(msg); // } //step 2 create a server method //public void servermethod(string name, string msg) //{ // string connectionId = Context.ConnectionId; // Clients.Others.clientMethod(name, connectionId, msg); // //Clients.Caller.clientMethod(name, connectionId, msg); // //Clients.All.clientMethod(name, connectionId, msg); //} //public override Task OnConnected() //{ // Info info = new Info(); // info.ConId = Context.ConnectionId; // info.ConStatus = Context.Headers["Connection"]; // info.Transport = Context.QueryString["transport"]; // info.Host = Context.Request.Url.Host; // info.Port = Context.Request.Url.Port.ToString(); // info.Username = Context.User.Identity.Name; // return Clients.All.log(info); //} //public override Task OnDisconnected(bool stopCalled) //{ // return Clients.All.log("DisConnected " + DateTime.Now); //} //public override Task OnConnected() //{ // ConnectionIds.Add(Context.ConnectionId); // return base.OnConnected(); //} //public void servermethod(string name, string msg) //{ // string ConId = Context.ConnectionId; // //send message to second connection // Clients.Client(ConnectionIds[1]).clientmethod(name, ConId, msg); // //we have allexcept method //} public void join(string group) { Groups.Add(Context.ConnectionId, group); //Groups.Remove(); }
public void Listen() { Groups.Add(Context.ConnectionId, LWETGroup); }
public Task JoinRoom(string groupStock) { return(Groups.Add(Context.ConnectionId, groupStock)); }
/// <summary> /// 变量组改名 /// </summary> /// <param name="group"></param> /// <param name="newName"></param> public bool ChangeGroupName(string oldgroupFullName, string newName) { if (Groups.ContainsKey(oldgroupFullName)) { var grp = Groups[oldgroupFullName]; var ss = grp.Parent != null ? grp.Parent.FullName + "." + newName : newName; if (Groups.ContainsKey(ss)) { return(false); } //获取改组的所有子组 var gg = GetAllChildGroups(grp); //从Groups删除目标组以及所有子组 var vnames = gg.Select(e => e.FullName).ToList(); Groups.Remove(oldgroupFullName); foreach (var vv in vnames) { if (Groups.ContainsKey(vv)) { Groups.Remove(vv); } } grp.Name = newName; //修改子组变量对变量组的引用 string fullname = string.Empty; foreach (var vv in gg) { fullname = vv.FullName; foreach (var vvt in vv.Tags) { vvt.Group = fullname; } } //修改本组变量对变量组的引用 fullname = grp.FullName; if (grp.Tags != null) { foreach (var vv in grp.Tags) { vv.Group = fullname; } } //将目标组以及所有子组添加至Groups中 Groups.Add(fullname, grp); foreach (var vv in gg) { Groups.Add(vv.FullName, vv); } IsDirty = true; return(true); } return(false); }
//// ************************************** Group Chat**************************************// //public void AddToRoom(string roomName) //{ // //Retrieve room. // var room = db.Rooms.Find(roomName); // if (room != null) // { // var user = new User() { UserName = Context.User.Identity.Name }; // db.Users.Attach(user); // room.Users.Add(user); // db.SaveChanges(); // Groups.Add(Context.ConnectionId, roomName); // } //} //public void RemoveFromRoom(string roomName) //{ // // Retrieve room. // //var room = db.Rooms.Find(roomName); // //if (room != null) // //{ // // var user = new User() { UserName = Context.User.Identity.Name }; // // db.Users.Attach(user); // // room.Users.Remove(user); // // db.SaveChanges(); // // Groups.Remove(Context.ConnectionId, roomName); // //} //} public async Task JoinRoom(string roomName) { await Groups.Add(Context.ConnectionId, roomName); Clients.Group(roomName).addChatMessage(Context.User.Identity.Name + " joined."); }
public void JoinRelay(string groupName) { Groups.Add(Context.ConnectionId, groupName); }
public Groups GetGroups(OrganizationalUnit organizationalUnit) { if (organizationalUnit == null) throw new ArgumentNullException("organizationalUnit"); Groups groups = new Groups(); using (DirectorySearcher directorySearcher = new DirectorySearcher(Entry) { Filter = String.Format("OU={0}", organizationalUnit) }) { SearchResultCollection searchResult = directorySearcher.FindAll(); if (searchResult.Any()) { foreach (SearchResult searchResul in searchResult) { DirectoryEntry directoryEntry = searchResul.GetDirectoryEntry(); foreach (DirectoryEntry child in directoryEntry.Children) { GroupDescriptor group = GroupDescriptor.Initialize(child.Properties); groups.Add(group); } } } } return groups; }
public void Login(string channel, Player player) { Groups.Add(Context.ConnectionId, channel); UpdatePlayer(channel, player, MessageType.Other); }
public async Task Participar(string nomeParticipante, string produtoId) { await Groups.Add(Context.ConnectionId, produtoId); Clients.Group(produtoId).adicionarMensagem(nomeParticipante, Context.ConnectionId, "Bom leilão a todos!"); }
public async Task AddToGroup(string groupName) { await Groups.Add(Context.ConnectionId, groupName); }
/// <summary> /// 查看分组 /// </summary> /// <param name="context">Context.</param> public void Getgroup(JabinfoContext context) { Weixin wx = new Weixin (); Utils Util = new Utils (); string url = "https://api.weixin.qq.com/cgi-bin/groups/get?access_token="+wx.GetAccessToken(); string json = Jabinfo.Help.Http.GetHttps(url); var dict = Util.JsonTo<Dictionary<string, List<Dictionary<string, object>>>>(json); var gs = new Groups(); var gilist = dict["groups"]; foreach (var gidict in gilist) { var gi = new GroupVO(); gi.name = gidict["name"].ToString(); gi.id = Convert.ToInt32(gidict["id"]); gi.count = Convert.ToInt32(gidict["count"]); gs.Add(gi); } context.Variable ["groupList"] = gs; }