public void ShowInfo(string account)
        {
            //this.U1.Text += " 昵称:" + us.Name + '\n' + " 等级:" + us.Grade + '\n' + '\n';
            LoginReference.User[] usarr = new LoginReference.User[4];
            int cnt = 0;

            foreach (var item in CC.Users)
            {
                usarr[cnt++] = loginclient.Userinfo(item.id);
            }
            //得到了已登录的所有用户的信息
            if (usarr[0].Avart == null)
            {
                usarr[0].Avart = "boy.png";
            }
            this.photo1.Source = new BitmapImage(new Uri("pack://application:,,,/image/" + usarr[0].Avart));
            this.U1.Text      += " 昵称:" + usarr[0].Name + '\n' + " 等级:" + usarr[0].Grade + '\n';

            if (cnt == 1)
            {
                return;
            }

            if (usarr[1].Avart == null)
            {
                usarr[1].Avart = "boy.png";
            }
            this.photo2.Source = new BitmapImage(new Uri("pack://application:,,,/image/" + usarr[1].Avart));
            this.U2.Text      += " 昵称:" + usarr[1].Name + '\n' + " 等级:" + usarr[1].Grade + '\n';

            if (cnt == 2)
            {
                return;
            }

            if (usarr[2].Avart == null)
            {
                usarr[2].Avart = "boy.png";
            }
            this.photo3.Source = new BitmapImage(new Uri("pack://application:,,,/image/" + usarr[2].Avart));
            this.U3.Text      += " 昵称:" + usarr[2].Name + '\n' + " 等级:" + usarr[2].Grade + '\n';

            if (cnt == 3)
            {
                return;
            }

            if (usarr[3].Avart == null)
            {
                usarr[3].Avart = "boy.png";
            }
            this.photo4.Source = new BitmapImage(new Uri("pack://application:,,,/image/" + usarr[3].Avart));
            this.U4.Text      += " 昵称:" + usarr[3].Name + '\n' + " 等级:" + usarr[3].Grade + '\n' + '\n';
        }
Esempio n. 2
0
        //所有button事件
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (e.Source == sign_in)//登录事件
            {
                try
                {
                    //登录检测,true则为登录成功
                    bool flag = client.Login(account.Text, passward.Password);
                    if (flag)
                    {
                        //登录成功首先获取到该用户的所有信息,然后为传参做准备
                        us = client.Userinfo(account.Text);
                        //生成该用户的关联窗体的关系
                        if (CC.Users == null)
                        {
                            CC.Users = new List <User>();
                        }
                        User newuser = new User(us.Acount);
                        CC.Users.Add(newuser);
                        item             = CC.GetUser(us.Acount);
                        item.LoginWindow = this;
                        item.LoginWindow.Close();
                        // item.MainWindow.ShowLogin(us.Name);

                        //再显示登录后的界面,room
                        RoomWindow RW = new RoomWindow(us);
                        item.RoomWindow = RW;
                        item.RoomWindow.Show();
                    }
                    else
                    {
                        MessageBox.Show("登录失败!");
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("未连接到服务器!");
                }
            }
            else if (e.Source == forgetPw)//忘记密码事件
            {
                this.Close();
                ForgetPwWindow FP = new ForgetPwWindow();
                FP.Show();
            }
            else if (e.Source == sign_for)//注册事件
            {
                this.Close();
                RegisteredWindow RW = new RegisteredWindow();
                RW.Show();
            }
        }
 public PlayerInfo(LoginReference.User us)
 {
     InitializeComponent();
     this.account.Text = us.Acount;
     this.name.Text    = us.Name;
     this.level.Text   = us.Grade.ToString();
     this.sign.Text    = us.Sign;
     if (us.Avart == null)
     {
         us.Avart = "boy.png";
     }
     this.photo.Source = new BitmapImage(new Uri("pack://application:,,,/image/" + us.Avart));
 }
Esempio n. 4
0
        public LoginReference.User us; //用户的所有信息


        public RoomWindow(LoginReference.User ustmp)
        {
            InitializeComponent();
            us            = ustmp;
            item          = CC.GetUser(us.Acount);
            Checkinclient = new CheckinServerClient(new InstanceContext(this));
            loginclient   = new LoginServiceClient();
            if (us.Avart == null)
            {
                us.Avart = "boy.png";
            }
            this.photo.Source = new BitmapImage(new Uri("pack://application:,,,/image/" + us.Avart));
            Checkinclient.Login(us.Name);
        }
 //传参方式的变化
 public MainWindow(LoginReference.User ustmp)
 {
     InitializeComponent();
     us   = ustmp;
     item = CC.GetUser(us.Acount);
 }