Esempio n. 1
0
 private void UserServiceProxy_OnLoginEvent(object sender, OnLoginEventArgs e)
 {
     OnlineUsers         = new ObservableCollection <UserDTO>(ContactStateManager.GetOnlineContacts());
     OfflineUsers        = new ObservableCollection <UserDTO>(ContactStateManager.GetOfflineContacts());
     ConsoleLog.Document = e.UserName + "has loged in";
     //OnlineUsers.Add(new UserDTO {UserName= e.UserName });
 }
Esempio n. 2
0
 //ctor:
 public ContactListViewModel()
 {
     onlineUsers  = new ObservableCollection <UserDTO>(ContactStateManager.GetOnlineContacts());
     offlineUsers = new ObservableCollection <UserDTO>(ContactStateManager.GetOfflineContacts());
     ConsoleLog   = new ConsoleLog();
     //init proxies:
     UserServiceProxy = UserServiceProxy.Instance;  //TODO: is needed?
     UserServiceProxy.OnLoginEvent    += UserServiceProxy_OnLoginEvent;
     UserServiceProxy.OnSignedUpEvent += UserServiceProxy_OnSignedUp;
     UserServiceProxy.OnLogoutEvent   += UserServiceProxy_OnLogout;
     ChatServiceProxy = ChatServiceProxy.Instance;
     ChatServiceProxy.OnMessageSentEvent += ChatServiceProxy_OnMessageSent;
     GameServiceProxy              = GameServiceProxy.Instance;
     GameServiceProxy.OnGameEvent += GameServiceProxy_OnGameEvent;
     //init ICommands:
     SendGameRequestCommand = new MyCommand(SendGameRequest);
     OpenChatWindowCommand  = new MyCommand(OpenChatWindow);
     //subscribe to Closing Window event:
     Application.Current.MainWindow.Closing += MainWindow_OnWindowClosing;
 }
Esempio n. 3
0
 private void UserServiceProxy_OnLogout(object sender, OnLogoutEventArgs e)
 {
     OnlineUsers          = new ObservableCollection <UserDTO>(ContactStateManager.GetOnlineContacts());
     OfflineUsers         = new ObservableCollection <UserDTO>(ContactStateManager.GetOfflineContacts());
     ConsoleLog.Document += $"{e.UserName} has loged out";
 }