public void ChangedUser(){ if(m_user==null){ return; } using(UserForm form=new UserForm(false, ShortPasswrod)){ if(form.ShowDialog() == DialogResult.OK){ User user = form.GetUser(); if(m_notifyIcon!=null && user!=null){ m_user=user; m_notifyIcon.Text="用户:"+m_user.Name; m_user.Save(); } } } Show(); }
public void Show(){ if(m_user==null){ //需要登录 using(UserForm form=new UserForm(true,ShortPasswrod)){ if(form.ShowDialog() == DialogResult.OK){ m_user = form.GetUser(); if(m_user!=null && m_notifyIcon!=null){ m_notifyIcon.Text="用户:"+m_user.Name; m_user.Save(); } } } } if(m_user==null){ return; } if(m_room==null || m_room.IsDisposed){ m_room=new RoomForm(this); } m_room.Text = ""+m_user.Name; m_room.Show(); m_room.Activate(); }