示例#1
0
        public ClientProcessing()
        {
            syncFunctions  = new Dictionary <Options, Functions>();
            asyncFunctions = new Dictionary <Options, AsyncFunctions>();
            syncFunctions.Add(Options.LOGOUT, new Functions(Logout));
            syncFunctions.Add(Options.LOGIN, new Functions(Login));
            syncFunctions.Add(Options.CREATE_USER, new Functions(CreateUser));
            syncFunctions.Add(Options.CHECK_USER_NAME, new Functions(CheckUserName));
            syncFunctions.Add(Options.GET_FRIENDS, new Functions(GetFriends));
            syncFunctions.Add(Options.DELETE_ACCOUNT, new Functions(DeleteAccount));
            syncFunctions.Add(Options.ADD_FRIEND, new Functions(AddFriend));
            syncFunctions.Add(Options.ACCEPT_FRIEND, new Functions(AcceptFriend));
            syncFunctions.Add(Options.DECLINE_FRIEND, new Functions(DeclineFriend));


            asyncFunctions.Add(Options.ACTIVE_FRIENDS, new AsyncFunctions(SendActiveFriends));
            asyncFunctions.Add(Options.FRIEND_INVITATIONS, new AsyncFunctions(SendInvitations));
            asyncFunctions.Add(Options.INCOMMING_CALL, new AsyncFunctions(SendCall));

            dbMethods          = new DbMethods();
            activeUsers        = new List <User>();
            eventHandlers      = new Dictionary <string, EventWaitHandle>();
            userLoginHandler   = new Dictionary <int, EventWaitHandle>();
            invitations        = dbMethods.GetInvitations();
            userInvitationsIds = dbMethods.GetUsersInvitationsIds();
            whichFunction      = new Dictionary <string, List <Tuple <Options, string> > >();
        }
示例#2
0
        public ClientProcessing()
        {
            functions = new List <Functions>();
            functions.Add(new Functions(Logout));
            functions.Add(new Functions(Login));
            functions.Add(new Functions(CreateUser));
            functions.Add(new Functions(CheckUserName));
            functions.Add(new Functions(Disconnect));
            functions.Add(new Functions(GetFriends));
            functions.Add(new Functions(SendConversation));
            functions.Add(new Functions(ActivateConversation));
            functions.Add(new Functions(SendMessage));
            functions.Add(new Functions(NewMessages));
            functions.Add(new Functions(Notification));
            functions.Add(new Functions(AddFriend));
            functions.Add(new Functions(DhExchange));
            functions.Add(new Functions(SendInvitations));
            functions.Add(new Functions(DeclineFriend));
            functions.Add(new Functions(AcceptFriend));
            functions.Add(new Functions(SendConversationKey));
            functions.Add(new Functions(SendAcceptedFriends));

            dbMethods           = new DbMethods();
            activeUsers         = new List <User>();
            invitations         = dbMethods.GetInvitations();
            messagesToSend      = new Dictionary <int, Dictionary <int, List <Message> > >();
            notifications       = new Dictionary <int, Dictionary <int, Notification> >();
            activeConversations = new Dictionary <int, int>();
        }