public ChatPartisipants(string name, HashSet <string> username) { if (name == null) { throw new ArgumentNullException(nameof(name)); } ChatPartisipantsNames = username; FriendsConstructorBaseInput.CreateMultiplechat(name, string.Join('1', ChatPartisipantsNames)); }
public Friends(string MyUsername) { if (string.IsNullOrWhiteSpace(MyUsername)) { throw new ArgumentNullException(nameof(MyUsername)); } MyName = MyUsername; FriendsConstructorBaseInput friendsConstructor = new FriendsConstructorBaseInput(); //Get it hash set because of usefull check operation if many invitaions have sent HashSet <string> peoples = friendsConstructor.GetFriendsNames(MyName); FriendsUsernames = peoples; TopicsPaths = AzureServiceBusHelper.TakeAllTopicsForUser(MyUsername); }
public void SendMessage(List <string> TopicNames, string message, string fromuser) { if (string.IsNullOrWhiteSpace(message)) { throw new ArgumentNullException(nameof(message)); } Message = message; foreach (var toUserName in ChatPartisipantsNames) { string TopicName = TopicNames.Find(s => s.Split('1').ToList().Contains(toUserName)); AzureServiceBusHelper.SendMessageTopic(TopicName, toUserName.ToString(), fromuser, message); FriendsConstructorBaseInput.SaveMessage(TopicName, fromuser, message); } Console.WriteLine("\n**Message Sent!**"); }
public void AddNewFriends(HashSet <string> list) { if (list == null) { throw new ArgumentNullException(nameof(list)); } FriendsConstructorBaseInput friendsConstructor = new FriendsConstructorBaseInput(); foreach (var friendname in list) { friendsConstructor.InviteFriend(MyName, friendname); } foreach (var item in list) { FriendsUsernames.Add(item); } }
/// <summary> /// Display inviting friends /// </summary> private static void DisplayInviteFriends() { Console.WriteLine("Which friends do you want to invite? (Press 1 and enter to return to main menu)"); foreach (string subscription in FriendsConstructorBaseInput.GetSubscriptionsNames(user.UserName)) { Console.WriteLine("\t" + subscription); } Console.Write("Write names: "); HashSet <string> friendsnames = Console.ReadLine().ToLowerInvariant().Split().ToHashSet(); if (friendsnames.First() == "1") { MainMenu(); } else { user.Friends.AddNewFriends(friendsnames); MainMenu(); } }
public void LoadFriends() { FriendsConstructorBaseInput invitationlist = new FriendsConstructorBaseInput(); invitationlist.GetInvitaions(this, MyName); }