コード例 #1
0
        public UserManager(Dictionary <int, UserData> p_all_users_logged_in, DB_IsThereUserPass p_is_there_user_pass, DB_GetUserFriendsList p_get_user_friend_list
                           , DB_IsThereUser p_is_there_user, RemoveThread p_remove_thread, DB_CreateNewUser p_create_new_user, StartClientFriendChangedStatusInformDialog p_start_client_friend_changed_status_inform_dialog
                           , StartSendToClinetFormalMessage p_start_send_to_client_fromal_message, CreateOfflineMessage p_add_offline_meesge, RegisterThread p_register_a_thread)
        {
            all_users_logged_in = p_all_users_logged_in;

            is_there_user_pass   = p_is_there_user_pass;
            get_user_friend_list = p_get_user_friend_list;
            is_there_user        = p_is_there_user;
            remove_thread        = p_remove_thread;
            create_new_user      = p_create_new_user;
            start_client_friend_changed_status_inform_dialog = p_start_client_friend_changed_status_inform_dialog;
            start_send_to_client_fromal_message = p_start_send_to_client_fromal_message;
            add_offline_meesge = p_add_offline_meesge;
            register_a_thread  = p_register_a_thread;
        }
コード例 #2
0
        public ServerCore(Dictionary <int, UserData> p_all_users_logged_in, StartClientFriendChangedStatusInformDialog p_start_client_friend_changed_status_inform_dialog, StartSendToClinetFormalMessage p_start_send_to_client_fromal_message
                          , List <int> p_all_threads, SendToDistributerConstruct p_send_to_distributer_construct, object p_distributer_pulse_object)
        {
            int h = 0;

            while (h < 4)
            {
                try
                {
                    controller = new DB_Controller();
                    h          = 0;
                    break;
                }
                catch (System.Data.SqlClient.SqlException)
                {
                    h++;
                    continue;
                }
            }
            if (h > 3)
            {
                Console.WriteLine("Error in working with database");
                try
                {
                    Environment.Exit(5);
                }
                catch
                {
                }
                Thread.CurrentThread.Abort();
                return;
            }

            start_client_friend_changed_status_inform_dialog = p_start_client_friend_changed_status_inform_dialog;
            thread_manager = new ThreadManager(p_all_threads);
            start_send_to_client_fromal_message = p_start_send_to_client_fromal_message;

            user_manager = new UserManager(p_all_users_logged_in, new DB_IsThereUserPass(controller.IsThereUserPass), new DB_GetUserFriendsList(controller.GetUserFriendsList)
                                           , new DB_IsThereUser(controller.IsThereUser), new RemoveThread(SC_RemoveThread), new DB_CreateNewUser(controller.AddNewUser)
                                           , new StartClientFriendChangedStatusInformDialog(SC_StartClientFriendChangedStatusInformDialog), new StartSendToClinetFormalMessage(SC_StartSendToClinetFormalMessage)
                                           , new CreateOfflineMessage(SC_DB_AddOfflineMessage), new RegisterThread(SC_RegisterAThread));

            send_data = new SendData(p_send_to_distributer_construct, new IsLoggedIn(SC_IsLoggedIn), new GetOnlineUserThreadID(SC_GetOnlineUserThreadID),
                                     new GetAThreadUserName(SC_GetAThreadUserName), new IsThereUnauthWorkerThread(SC_IsThereUnauthWorkerThread), p_distributer_pulse_object);
        }