Ejemplo n.º 1
0
 public SignUpCommand(
     MainWindowViewModel mainWindowViewModel,
     IServerChatService serverChatService)
 {
     this.mainWindowViewModel = mainWindowViewModel;
     this.serverChatService   = serverChatService;
 }
Ejemplo n.º 2
0
 public SignOutCommand(
     IUserService userService,
     IServerChatService serverChatService,
     MainWindowViewModel mainWindowViewModel)
 {
     this.userService         = userService;
     this.serverChatService   = serverChatService;
     this.mainWindowViewModel = mainWindowViewModel;
 }
Ejemplo n.º 3
0
 public SignInCommand(
     MainWindowViewModel mainWindowViewModel,
     IUserService userService,
     IServerChatService serverChatService)
 {
     this.mainWindowViewModel = mainWindowViewModel;
     this.userService         = userService;
     this.serverChatService   = serverChatService;
 }
        public ServerChatServiceTests()
        {
            var serviceCollection = new ServiceCollection();

            serviceProvider = DependencyInjectionService.ConfigureServicesTransient(serviceCollection);

            serverChatService = serviceProvider.GetService <IServerChatService>();
            serverChatService.StartServer();
        }
Ejemplo n.º 5
0
 public ChatViewModel(IServerChatService serverChat, IUserService userService)
 {
     _serverChat  = serverChat;
     _userService = userService;
     Recipient    = _userService.Recipient;
     _serverChat.MessageReceived += Server_MessageReceived;
     SendMessageCommand           = new RelayCommand(SendMessage);
     Messages = new ObservableCollection <string>();
 }
        /// <summary>
        /// The class Constructor that receives the new TCP Connection, accepting the new client and waiting
        /// for the messages.
        /// </summary>
        /// <param name="tcpCon"></param>
        /// <param name="serverChatService"></param>
        public ChatConnectionService(TcpClient tcpCon, IServerChatService serverChatService)
        {
            TcpClient = tcpCon;

            ThreadSender = new Thread(AcceptClient);

            ThreadSender.Start();

            _serverChatService = serverChatService;
        }
 public SwitchChatCommand(
     IChatService chatService,
     IUserService userService,
     IServerChatService serverChatService,
     IMapper mapper)
 {
     this.chatService       = chatService;
     this.userService       = userService;
     this.serverChatService = serverChatService;
     this.mapper            = mapper;
 }
Ejemplo n.º 8
0
 public LobbyViewModel(IServerGameService serverGame, IServerChatService serverChat, IServerUserService serverUser, IUserService userService, INavigationService nav, IChatService chatService, IGameService gameService)
 {
     _serverUser  = serverUser;
     _serverChat  = serverChat;
     _serverGame  = serverGame;
     _userService = userService;
     _nav         = nav;
     _chatService = chatService;
     _gameService = gameService;
     _serverUser.LogInCompleted       += Server_LogInCompleted;
     _serverUser.LogOutCompleted      += Server_LogOutCompleted;
     _serverChat.MessageReceivedCheck += Server_MessageReceivedCheck;
     _serverGame.GameRequested        += Server_GameRequested;
     _serverGame.GameAccepted         += Server_GameAccepted;
     _serverGame.GameDeclined         += Server_GameDeclined;
     _gameRequests      = new List <string>();
     LogOutCommand      = new RelayCommand(LogOut);
     StartChatCommand   = new RelayCommand <string>(StartChat);
     RequestGameCommand = new RelayCommand <string>(RequestGame);
     Task t = LoadUsers();
 }
Ejemplo n.º 9
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(usernameTextbox.Text))
            {
                MessageBox.Show("Username can not be null/whitespace");
                return;
            }

            usernameTextbox.Enabled = false;
            loginButton.Enabled     = false;

            _userName = usernameTextbox.Text;
            _userId   = Guid.NewGuid();

            var clientChatService = new ClientChatService();

            clientChatService.ConnectedClientsListUpdatedEvent += UpdateListOfConnectedClients;
            clientChatService.NewMessageReceivedEvent          += DisplayNewMessage;

            // Send clientChatService to the server as our callback, so the server can signal us when needed.
            _serverChatProxy = new ServerChatProxy(clientChatService);
            _serverChannel   = _serverChatProxy.ChannelFactory.CreateChannel();

            try
            {
                _serverChannel.Logon(_userId, _userName);
            }
            catch (Exception)
            {
                MessageBox.Show("Failed to logon. Make sure the server application is running.");
                usernameTextbox.Enabled = true;
                loginButton.Enabled     = true;
                return;
            }

            sendButton.Enabled     = true;
            messageTextbox.Enabled = true;
        }
Ejemplo n.º 10
0
 public DeleteChatCommand(IServerChatService serverChatService)
 {
     this.serverChatService = serverChatService;
 }
Ejemplo n.º 11
0
 public CreateChatCommand(IServerChatService serverChatService)
 {
     this.serverChatService = serverChatService;
 }
 public SendMessageCommand(IServerChatService serverChatService)
 {
     this.serverChatService = serverChatService;
 }
Ejemplo n.º 13
0
 public PromoteChatMemberCommand(IServerChatService serverChatService)
 {
     this.serverChatService = serverChatService;
 }