Beispiel #1
0
 void modNameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (!CheckUser())
     {
         return;
     }
     using (var dlg = new UserNameDialog(this))
     {
         dlg.SetUser(CurUser);
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 string name = dlg.InputText;
                 this.ModUserName(CurUser, name);
                 log("成功修改[" + CurUser.Name + "]名字为[" + name + "]");
                 ReadUsers();
             }
             catch (Exception ex)
             {
                 this.Error("修改角色名字失败\n" + ex.Message);
             }
         }
     }
 }
Beispiel #2
0
        private void CorrentBtn_Click(object sender, RoutedEventArgs e)
        {
            //拉取本地数据
            var            user = xml.ReadDocs().FirstOrDefault();
            UserNameDialog nd   = new UserNameDialog();

            if (nd.ShowDialog() == true)
            {
                UserInfor info = new UserInfor();
                info.OldUser  = user.User;
                info.ClientId = user.ClientId;
                info.User     = nd.UserName;

                //发送至服务器
            }
        }
Beispiel #3
0
        /// <summary>
        /// 向服务器注册本地信息,并写入本地
        /// </summary>
        private bool RegisterInfoToService()
        {
            //拉取本地数据
            var user = xml.ReadDocs().FirstOrDefault();

            //无数据需要创建数据并发送给服务器 并从服务器返回当前使用的clientid
            if (user == null || user.User == null)
            {
                UserNameDialog nd = new UserNameDialog();
                if (nd.ShowDialog() == true)
                {
                    xml.WriteDoc(JsonConvert.SerializeObject(new UserInfor()
                    {
                        ClientId = "", User = nd.UserName
                    }));

                    //发送至服务器
                    hubProxy.On <UserInfor>("Register", UserInfor => SynchronizationContext.Current.Post(delegate {
                        var a = UserInfor;
                    }, null));
                }
            }
            return(true);
        }