Exemple #1
0
        public ChatPartisipants(string name, HashSet <string> username)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            ChatPartisipantsNames = username;
            FriendsConstructorBaseInput.CreateMultiplechat(name, string.Join('1', ChatPartisipantsNames));
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 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!**");
 }
Exemple #4
0
        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);
            }
        }
Exemple #5
0
        /// <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();
            }
        }
Exemple #6
0
        public void LoadFriends()
        {
            FriendsConstructorBaseInput invitationlist = new FriendsConstructorBaseInput();

            invitationlist.GetInvitaions(this, MyName);
        }