public override void execEffect() { if (idTarget != null) { Conversations.PlayConversation(idTarget); } }
public Task <Conversation> FindConvo(int id) { return(Conversations .Include(c => c.FirstUser) .Include(c => c.SecondUser) .FirstOrDefaultAsync(c => c.ConversationId == id)); }
public override CommandResult OnExecute(ICommandSource src, ICommandArgs args) { var playerId = src.ToPlayer().CSteamId.m_SteamID; if (!Conversations.ContainsKey(playerId)) { return(CommandResult.Lang("NOBODY_TO_REPLY")); } var target = ( from conversation in Conversations where conversation.Value.Equals(playerId) select UPlayer.From(conversation.Key) ).FirstOrDefault(); if (target == null) { return(CommandResult.Lang("NO_LONGER_ONLINE")); } src.DispatchCommand($"tell \"{target.DisplayName}\" \"{args.Join(0)}\""); return(CommandResult.Success()); }
public void AddOrUpdateConversation(SignalConversation conversation, SignalMessage updateMessage) { SignalConversation uiConversation; if (!ConversationsDictionary.ContainsKey(conversation.ThreadId)) { uiConversation = conversation.Clone(); Conversations.Add(uiConversation); ConversationsDictionary.Add(uiConversation.ThreadId, uiConversation); } else { uiConversation = ConversationsDictionary[conversation.ThreadId]; uiConversation.LastActiveTimestamp = conversation.LastActiveTimestamp; uiConversation.CanReceive = conversation.CanReceive; uiConversation.LastMessage = conversation.LastMessage; uiConversation.LastSeenMessage = conversation.LastSeenMessage; uiConversation.LastSeenMessageIndex = conversation.LastSeenMessageIndex; uiConversation.MessagesCount = conversation.MessagesCount; uiConversation.ThreadDisplayName = conversation.ThreadDisplayName; uiConversation.UnreadCount = conversation.UnreadCount; if (uiConversation is SignalContact ourContact && conversation is SignalContact newContact) { ourContact.Color = newContact.Color; }
void Awake() { conversations = Conversations.CreateFromJSON(jsonFile.text); //ConversationSystem.options = new string[conversations.Keys.Count]; //conversations.Keys.CopyTo(ConversationSystem.options, 0); DontDestroyOnLoad(gameObject); }
public void SetMerchant(Player p, Character c) { _merchant = c; _conversationManager.ClearConversations(); Conversations list = GameRef.Content.Load <Conversations>(@"SilverProphet\MerchantConversations\" + _merchant.Name); _conversation = list.ConversationList[_merchant.Name]; if (!_merchantManager.ContainsMerchant(_merchant.Name)) { _inventory = GameRef.Content.Load <MerchantInventory>(@"SilverProphet\MerchantInventories\" + _merchant.Name); } else { _inventory = _merchantManager.GetMerchant(_merchant.Name); } player = p; _portrait = c.Portrait; _mode = MerchantMode.Talk; _selectedIndex = 0; _selectedItem = ""; _conversation.StartConversation(); }
public List <DirectMessageVM> GetDirectMessages(int conversationID, int currentUser) { List <DirectMessageVM> lista = db.tsp_getConversationDM(conversationID).Select(x => new DirectMessageVM { senderID = x.SenderID, content = x.Content, dateTime = x.DateCreated }).ToList(); Conversations conversation = db.Conversations.Find(conversationID); int otherUserID = conversation.User1ID; if (currentUser == conversation.User1ID) { otherUserID = conversation.User2ID; } Users user = db.Users.Find(otherUserID); foreach (var item in lista) { item.dmImg = user.ProfileImage; } return(lista); }
private void OnPeerDataUpdated() { var peers = SignaledPeerData.Peers; ObservableCollection <ConversationViewModel> copyConversations = new ObservableCollection <ConversationViewModel>(Conversations); foreach (var contact in copyConversations) { if (peers.All(p => p.UserId != contact.UserId)) { Conversations.Remove(contact); } } foreach (var peer in peers) { var contact = Conversations.SingleOrDefault(s => s.UserId == peer.UserId); if (contact == null) { contact = _contactFactory(); contact.Name = peer.Name; contact.UserId = peer.UserId; contact.ProfileSource = new BitmapImage(new Uri(AvatarLink.EmbeddedLinkFor(peer.Avatar))); contact.OnCloseConversation += Contact_OnCloseConversation; contact.OnIsInCallMode += Contact_OnIsInCallMode; var sortList = Conversations.ToList(); sortList.Add(contact); sortList = sortList.OrderBy(s => s.Name).ToList(); Conversations.Insert(sortList.IndexOf(contact), contact); contact.Initialize(); } contact.IsOnline = peer.IsOnline; } UpdateSelection(); }
private void UpdateSelection() { if (SelectedConversation == null && LayoutService.Instance.LayoutType == LayoutType.Parallel) { SelectedConversation = Conversations.FirstOrDefault(); } }
private static Hashtable LoadConversationFromRequest(out bool privateConversation) { Hashtable conversation; string keyString = HttpContext.Current.Request.QueryString[LongConversationRequestKey] ?? HttpContext.Current.Request.Form[LongConversationRequestKey]; if (!string.IsNullOrEmpty(keyString)) { Guid conversationKey = new Guid(keyString); conversation = (Hashtable)Conversations[conversationKey]; if (conversation == null) { throw new InvalidOperationException("Attempted to load a specific UnitOfWork that no longer exists."); } Conversations.Remove(conversationKey); privateConversation = true; } else { conversation = (Hashtable)Conversations[DefaultLongConversationKey]; Conversations.Remove(DefaultLongConversationKey); privateConversation = false; } return(conversation); }
private void InitializeRainbowSDK() { rainbowApplication = new Rainbow.Application();; // Set Application Id, Secret Key and Host Name rainbowApplication.SetApplicationInfo(APP_ID, APP_SECRET_KEY); rainbowApplication.SetHostInfo(HOST_NAME); // Get Rainbow main objects rainbowContacts = rainbowApplication.GetContacts(); rainbowConversations = rainbowApplication.GetConversations(); rainbowFavorites = rainbowApplication.GetFavorites(); // EVENTS WE WANT TO MANAGE rainbowApplication.ConnectionStateChanged += RainbowApplication_ConnectionStateChanged; rainbowContacts.RosterPeerAdded += RainbowContacts_RosterPeerAdded; rainbowContacts.RosterPeerRemoved += RainbowContacts_RosterPeerRemoved; rainbowConversations.ConversationCreated += RainbowConversations_ConversationCreated; rainbowConversations.ConversationRemoved += RainbowConversations_ConversationRemoved; rainbowFavorites.FavoriteCreated += RainbowFavorites_FavoriteCreated; rainbowFavorites.FavoriteRemoved += RainbowFavorites_FavoriteRemoved; rainbowContactsList = new List <Contact>(); }
private void InitializeRainbowSDK() { rainbowApplication = new Rainbow.Application(); // Set Application Id, Secret Key and Host Name rainbowApplication.SetApplicationInfo(APP_ID, APP_SECRET_KEY); rainbowApplication.SetHostInfo(HOSTNAME); // Get Rainbow main objects rainbowContacts = rainbowApplication.GetContacts(); rainbowConversations = rainbowApplication.GetConversations(); rainbowInstantMessaging = rainbowApplication.GetInstantMessaging(); // Events we want to manage rainbowApplication.ConnectionStateChanged += RainbowApplication_ConnectionStateChanged; rainbowContacts.RosterContactAdded += RainbowContacts_RosterContactAdded; rainbowContacts.RosterContactRemoved += RainbowContacts_RosterContactRemoved; rainbowContacts.ContactPresenceChanged += RainbowContacts_ContactPresenceChanged; rainbowConversations.ConversationCreated += RainbowConversations_ConversationCreated; rainbowConversations.ConversationRemoved += RainbowConversations_ConversationRemoved; rainbowInstantMessaging.MessageReceived += RainbowInstantMessaging_MessageReceived; rainbowInstantMessaging.ReceiptReceived += RainbowInstantMessaging_ReceiptReceived; rainbowInstantMessaging.UserTypingChanged += RainbowInstantMessaging_UserTypingChanged; rainbowContactsList = new List <Contact>(); rainbowConvList = new List <Conversation>(); }
public override CommandResult OnExecute(ICommandSource src, ICommandArgs args) { if (args.Length == 0) { return(CommandResult.ShowUsage()); } if (!Conversations.ContainsKey(src.DisplayName)) { return(CommandResult.Lang(EssLang.NOBODY_TO_REPLY));; } var target = (from conversation in Conversations where conversation.Value.Equals(src.DisplayName) select UPlayer.From(conversation.Key) ).FirstOrDefault(); if (target == null) { return(CommandResult.Lang(EssLang.NO_LONGER_ONLINE)); } src.DispatchCommand($"tell \"{target.DisplayName}\" \"{args.Join( 0 )}\""); return(CommandResult.Success()); }
public void Run() { Envelope envelope; Conversation conversation; while (stillRunning) { envelope = UdpCommunicator.Receive(1000); if (envelope == null && TcpCommunicator != null) { envelope = TcpCommunicator.Receive(1000); } if (envelope != null) { ConversationId id = envelope.Message.ConversationId; conversation = Conversations.GetConversation(id); if (conversation != null) // If the conversation already exists { conversation.IncomingEnvelopes.Enqueue(envelope); } else // If the conversation does not exist { Responder newConversation; newConversation = _conversationFactory.CreateFromEnvelope(envelope); Message m = envelope.Message; newConversation.Launch(m); Conversations.Add(newConversation); } } } }
/// <summary> /// GetConversationMember /// </summary> /// <remarks> /// Enumerate the members of a conversation. /// /// This REST API takes a ConversationId and a UserId and returns a ChannelAccount /// object for the members of the conversation. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='conversationId'> /// Conversation ID /// </param> /// <param name='userId'> /// User ID /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ChannelAccount> GetConversationMemberAsync(this Conversations operations, string userId, string conversationId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetConversationMemberWithHttpMessagesAsync(userId, conversationId, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/* ---------- Internal method to process new events/messages/conversations/... ----------- */ private void InitializeDb() { Conversations.Clear(); using (var db = new LiteDatabase(DbPath)) { var users = db.GetCollection <User>("users"); var conversations = db.GetCollection <Conversation>("conversations"); var messages = db.GetCollection <Message>("messages"); var events = db.GetCollection <ConversationEvent>("events"); users.EnsureIndex(x => x.Id, true); conversations.EnsureIndex(x => x.Id, true); // First retrieve all the conversations conversations.FindAll().ToList().ForEach(Conversations.Add); // Then populate them with messages and events foreach (Message msg in messages.FindAll()) { Conversations.Where(x => x.Id.Equals(msg.ConversationId)).First().AddItem(msg); } foreach (ConversationEvent evt in events.FindAll()) { Conversations.Where(x => x.Id.Equals(evt.ConversationId)).First().AddItem(evt); } } }
private void AnalizeToken(int index) { Conversation conversation = ExtractConversation(index); if (!Conversations.ContainsKey(Tokens[index])) { Conversations.Add(Tokens[index], new List <Conversation>()); } Conversations[Tokens[index]].Add(conversation); if (IsTollFree(conversation.To)) { if (GetIndexByTenant(conversation.Tenant) != -1) { Bills[GetIndexByTenant(conversation.Tenant)].AddTollFreeMinutes(conversation.Billing); } } else { if (IsInternational(conversation.To)) { if (GetIndexByTenant(conversation.Tenant) != -1) { Bills[GetIndexByTenant(conversation.Tenant)].AddInterMinutes(conversation.Billing); } } if (GetIndexByTenant(conversation.Tenant) != -1) { Bills[GetIndexByTenant(conversation.Tenant)].AddMinutes(conversation.Billing); } } }
private async void OnMessageReceivedReceived(object sender, Message a) { if (a != null) { var msg = a as Message; msg.ConversationId = msg.Name; // depending on msg.Name (username), store it on database conversation //so user can see it later frm Conversations page await DBService.Instance.Update <Message>(msg); if (!IsDetailOpened) { var matchingConv = Conversations.Where(u => u.Name == msg.Name).FirstOrDefault(); if (matchingConv != null) { //update already filled collection Conversations[Conversations.IndexOf(matchingConv)].Messages.Add(msg); Conversations[Conversations.IndexOf(matchingConv)].UnreadMessages++; } await ShowToast(string.Format("New message from {0}", msg.Name), msg.Text); } else { OnMessagePassingToDetail(this, msg); } } }
public async Task <int> AddInitialConversationAsync(Conversations initialConversation) { await _context.Conversations.AddAsync(initialConversation); _context.SaveChanges(); return(initialConversation.Id); }
public async void AddMessage(string text) { if (ServiceManager.IsConnected) { var reference = CurrentConversation; var id = await ServiceManager.WriteMessage(text, reference.InterlocutorId); if (id != null) { if (!Conversations.Contains(reference)) { Conversations.Insert(0, reference); } else { Conversations.Move(Conversations.IndexOf(reference), 0); } reference.Messages.Add(new Message() { Content = text, IsAuthor = true, Id = id }); } _parent.MessagesListBox.ScrollIntoView( reference.Messages[reference.Messages.Count - 1]); } }
public void Write(System.Xml.Linq.XElement root) { Folders.Write(root); Domains.Write(root); Audio.Write(root); Conversations.Write(root); Localizations.Write(root); }
public void Load(System.Xml.Linq.XElement root) { Folders.Load(root); Domains.Load(root); Audio.Load(root); Conversations.Load(root); Localizations.Load(root); }
public void CloseClient() { thread.Abort(); thread.Join(500); Users.Clear(); Conversations.Clear(); client.Close(); }
public override bool Equals(object obj) { GraphNode node = (GraphNode)obj; return(Character.Equals(node.Character) && Conversations.SequenceEqual(node.Conversations) && Links.Equals(node.Links)); }
private static (DirectLineClient Client, Conversation Conversation) StartHBConversation() { //var secret = "c2Nb5-ENwqg.O7fE_fx56mxGdewzFq0JiJ561pO3PesjfLuPKVGYJJI"; var secret = "C7qnGmJ_Uo8.cGdO53PW5MmAT7xq707cOTBfNSebO6n8waNOM1Eqc0Y"; var client = new DirectLineClient(secret); return(client, client.Conversations.StartConversation()); }
public List <DMPreviewVM> GetDMPreview(int myUserID) { List <DMPreviewVM> lista = new List <DMPreviewVM>(); foreach (var user in db.Users.ToList()) { Conversations conversation = db.Conversations .Where(x => x.User1ID == myUserID && x.User2ID == user.UserID).SingleOrDefault(); if (conversation == null) { conversation = db.Conversations .Where(x => x.User1ID == user.UserID && x.User2ID == myUserID).SingleOrDefault(); } if (conversation != null) { int usrID = -1; if (conversation.User1ID == myUserID) { usrID = conversation.User2ID; } else { usrID = conversation.User1ID; } Users usr = db.Users.Find(usrID); try { DMPreviewVM listItem = db.tsp_LatestMessage(conversation.User1ID, conversation.User2ID).Select(x => new DMPreviewVM { conversationID = conversation.ConversationID, nickname = usr.Nickname, username = usr.Username, content = x.Content, time = x.DateCreated, imgProfile = usr.ProfileImage }).SingleOrDefault(); if (db.tsp_LatestMessage(conversation.User1ID, conversation.User2ID).SingleOrDefault().SenderID == myUserID) { listItem.isMineLastMessage = true; } else { listItem.isMineLastMessage = false; } lista.Add(listItem); } catch (Exception) { } } } return(lista.OrderByDescending(x => x.time).ToList()); }
public Cain(World world, int snoId, TagMap tags) : base(world, snoId, tags) { this.Attributes[GameAttribute.MinimapActive] = true; Conversations.Add(new ConversationInteraction(72416)); Conversations.Add(new ConversationInteraction(198588)); Conversations.Add(new ConversationInteraction(73171)); Interactions.Add(new IdentifyAllInteraction()); }
internal void AttachConversation(Conversation conversation) { if (conversation == null) { return; } //TODO bug 怎么会出现重复的Conversation? Conversations.Add(conversation.ID, conversation); }
internal void RemoveConversation(Conversation conversation) { if (conversation == null) { return; } Conversations.Remove(conversation.ID); }
public void Terminate() { Messages.Clear(); messageUIDS.Clear(); Conversations.Clear(); ConversationByCID.Clear(); visibilityByConversationID.Clear(); ConversationFilter = string.Empty; }
public void setup() { // Very helpful for debugging RhinoMocks.Logger = new Rhino.Mocks.Impl.TextWriterExpectationLogger(Console.Out); mockedClient = MockRepository.GenerateMock<ReevooClient>(); conversations = MockRepository.GeneratePartialMock<Conversations>(); conversations.Stub(x => x.ClientUrl()).Return(null); conversations.Trkref = "FOO"; conversations.client = mockedClient; }
public SearchPage() { InitializeComponent(); mVoice = App.mVoice; mFiltered = new Conversations(); mFiltered.Dispatcher = Dispatcher; mSearchList.ItemsSource = mFiltered; mTimer.Tick += new EventHandler(mTimer_Tick); mTimer.Interval = new TimeSpan(0, 0, 0, 0, 500); }
public Stream GetConversationsForCommentForum(string siteName, string commentForumUid) { var conversations = new Conversations(); return GetOutputStream(conversations); }
public static void ShowOptions(Conversations.Option[] options, UnityAction<int> optionPressed, bool isRandom) { GameObject canvas = GameObject.Find("Canvas"); GameObject textBubble = LoadPrefab(canvas.transform, "Text Options"); OptionsLogic optionsLogic = textBubble.GetComponent<OptionsLogic>(); optionsLogic.options = options; optionsLogic.isRandom = isRandom; if (optionPressed != null) { optionsLogic.optionPressed = optionPressed; } }