Exemplo n.º 1
0
 private ObservableCollection <string> OnlineUsers(AddToDict ins)
 {
     foreach (var userName in ins.clientDictionary)
     {
         OnlineClients.Add(userName.Value.UserName);
     }
     return(OnlineClients);
 }
Exemplo n.º 2
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     cache = _svc.RemoveUser(UserName);
     this._client.NotifyServer(new AddService.EventDataType()
     {
         ClientName   = UserName,
         EventMessage = "Logout"
     });
 }
Exemplo n.º 3
0
 public StartWindow(string _userName, AddToDict _inst, Guid _id, AddServiceClient svc)
 {
     InitializeComponent();
     Id            = _id;
     DataContext   = this;
     Header        = "Welcome " + _userName + "!";
     cache         = _inst;
     UserName      = _userName;
     Users         = new ObservableCollection <string>();
     _svc          = svc;
     LogicInstance = BL.Logic.Instance;
     this.RegisterClient();
     this._client.NotifyServer(new EventDataType()
     {
         ClientName   = UserName,
         EventMessage = "Login"
     });
 }
Exemplo n.º 4
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            var svc = new CheckersClient.LoginService.AddServiceClient();

            ins = svc.IsUserExist(txtUserName.Text, txtPassword.Password);
            string value = this.txtUserName.Text;
            Guid   id    = ins.clientDictionary.FirstOrDefault(x => x.Value.UserName == value).Key;

            if (ins.clientDictionary.Count != 0)
            {
                StartWindow window2 = new StartWindow(value, ins, id, svc);
                window2.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Login failed");
            }
        }
        //BL.Logic logic = BL.Logic.LogicInstance;

        //public void Message(string userName, AddToDict instance)
        //{
        //    if (logic.OnlineUserNames.Count == 0)
        //    {
        //        foreach (var user in instance.clientDictionary)
        //        {
        //            logic.OnlineUserNames.Add(user.Value.UserName);
        //        }
        //    }
        //    else
        //        logic.UpdateOnlineList(userName);



        //}
        #endregion
        public void Message(string userName, AddToDict instance)
        {
            throw new NotImplementedException();
        }