void do_rapidPassiveEngine_ConnectionInterrupted() { this.globalUserCache.CurrentUser.UserStatus = UserStatus.OffLine; this.skinButton_headImage.Image = GlobalResourceManager.GetHeadImage(this.globalUserCache.CurrentUser); this.skinButton_State.Image = Properties.Resources.imoffline__2_; this.skinButton_State.Tag = ChatListSubItem.UserStatus.OffLine; this.skinButton_State.Enabled = false; this.notifyIcon.ChangeText(String.Format("{0}:{1}({2})\n状态:离线,正在重连 . . .", GlobalResourceManager.SoftwareName, this.globalUserCache.CurrentUser.Name, this.globalUserCache.CurrentUser.UserID)); this.notifyIcon.ChangeMyStatus(UserStatus.OffLine); foreach (GGUser friend in this.globalUserCache.GetAllUser()) { friend.UserStatus = UserStatus.OffLine; } this.friendListBox1.SetAllUserOffline(); this.recentListBox1.SetAllUserOffline(); foreach (ChatForm form in this.chatFormManager.GetAllForms()) { form.MyselfOffline(); } foreach (GroupChatForm form in this.groupChatFormManager.GetAllForms()) { form.MyselfOffline(); } }
public UpdateUserInfoForm(IRapidPassiveEngine engine, GlobalUserCache globalUserCache, GGUser user) { InitializeComponent(); this.rapidPassiveEngine = engine; this.currentUser = user; int registerPort = int.Parse(ConfigurationManager.AppSettings["RemotingPort"]); this.ggService = (IRemotingService)Activator.GetObject(typeof(IRemotingService), string.Format("tcp://{0}:{1}/RemotingService", ConfigurationManager.AppSettings["ServerIP"], registerPort));; this.skinLabel_ID.Text = user.UserID; this.skinTextBox_nickName.SkinTxt.Text = user.Name; this.skinTextBox_signature.SkinTxt.Text = user.Signature; if (user.HeadImageIndex >= 0) { this.headImageIndex = user.HeadImageIndex; this.pnlImgTx.BackgroundImage = GlobalResourceManager.GetHeadImage(user); //根据ID获取头像 } else { this.pnlImgTx.BackgroundImage = user.HeadImage; this.selfPhoto = true; } }
void form_UserInfoChanged(GGUser user) { this.labelSignature.Text = this.globalUserCache.CurrentUser.Signature; this.skinButton_headImage.Image = GlobalResourceManager.GetHeadImage(this.globalUserCache.CurrentUser); this.labelName.Text = this.globalUserCache.CurrentUser.Name; this.globalUserCache.AddOrUpdateUser(this.globalUserCache.CurrentUser); foreach (ChatForm chatForm in this.chatFormManager.GetAllForms()) { chatForm.OnMyInfoChanged(this.globalUserCache.CurrentUser); } }
public void OnUserInfoChanged(GGUser user) { ChatListSubItem[] items = this.chatListBox1.GetSubItemsByNicName(user.UserID); if (items == null || items.Length == 0) { return; } items[0].HeadImage = GlobalResourceManager.GetHeadImage(user); items[0].DisplayName = user.Name; items[0].PersonalMsg = user.Signature; items[0].Tag = user; this.chatListBox1.Invalidate(); }
//状态选择项 private void Item_Click(object sender, EventArgs e) { ToolStripMenuItem Item = (ToolStripMenuItem)sender; skinButton_State.Image = Item.Image; skinButton_State.Tag = Item.Tag; this.globalUserCache.CurrentUser.UserStatus = (UserStatus)Convert.ToInt32(skinButton_State.Tag); this.myStatus = this.globalUserCache.CurrentUser.UserStatus; this.skinButton_headImage.Image = GlobalResourceManager.GetHeadImage(this.globalUserCache.CurrentUser, true); this.notifyIcon.ChangeMyStatus(this.myStatus); this.rapidPassiveEngine.CustomizeOutter.Send(InformationTypes.ChangeStatus, BitConverter.GetBytes((int)this.globalUserCache.CurrentUser.UserStatus)); this.notifyIcon.ChangeText(String.Format("{0}:{1}({2})\n状态:{3}", GlobalResourceManager.SoftwareName, this.globalUserCache.CurrentUser.Name, this.globalUserCache.CurrentUser.UserID, GlobalResourceManager.GetUserStatusName(this.globalUserCache.CurrentUser.UserStatus))); }
void do_rapidPassiveEngine_RelogonCompleted(LogonResponse logonResponse) { if (logonResponse.LogonResult != LogonResult.Succeed) { this.notifyIcon.ChangeText(String.Format("{0}:{1}({2})\n状态:离线,请重新登录。", GlobalResourceManager.SoftwareName, this.globalUserCache.CurrentUser.Name, this.globalUserCache.CurrentUser.UserID)); MessageBoxEx.Show("自动重登录失败,可能是密码已经被修改。请重启程序,手动登录!", GlobalResourceManager.SoftwareName); return; } this.globalUserCache.CurrentUser.UserStatus = this.myStatus; this.skinButton_headImage.Image = GlobalResourceManager.GetHeadImage(this.globalUserCache.CurrentUser); this.skinButton_State.Enabled = true; this.skinButton_State.Image = GlobalResourceManager.GetStatusImage(this.globalUserCache.CurrentUser.UserStatus); this.skinButton_State.Tag = (int)this.globalUserCache.CurrentUser.UserStatus; this.globalUserCache.StartRefreshFriendInfo(); this.notifyIcon.ChangeText(String.Format("{0}:{1}({2})\n状态:{3}", GlobalResourceManager.SoftwareName, this.globalUserCache.CurrentUser.Name, this.globalUserCache.CurrentUser.UserID, GlobalResourceManager.GetUserStatusName(this.globalUserCache.CurrentUser.UserStatus))); this.notifyIcon.ChangeMyStatus(this.globalUserCache.CurrentUser.UserStatus); }
private void MainForm_Shown(object sender, EventArgs e) { this.globalUserCache.StartRefreshFriendInfo(); InformationForm frm = new InformationForm(this.rapidPassiveEngine.CurrentUserID, this.globalUserCache.CurrentUser.Name, GlobalResourceManager.GetHeadImage(this.globalUserCache.CurrentUser)); frm.Show(); }
/// <summary> /// 初始化流程: /// (1)Initialize时,从服务器加载自己的全部信息,从本地缓存文件加载好友列表。 /// (2)MainForm_Load,填充ChatListBox /// (3)MainForm_Shown,调用globalUserCache在后台刷新:若是第一次登录,则分批从服务器加载好友资料。否则,从服务器获取好友最新状态和版本,并刷新本地缓存。 /// (4)globalUserCache.FriendRTDataRefreshCompleted 事件,请求离线消息、离线文件、正式通知好友自己上线 /// </summary> public void Initialize(IRapidPassiveEngine engine, ChatListSubItem.UserStatus userStatus, Image stateImage)//, Image headImage, string nickName, ChatListSubItem.UserStatus userStatus, Image stateImage) { GlobalResourceManager.PostInitialize(engine.CurrentUserID); this.Cursor = Cursors.WaitCursor; this.toolTip1.SetToolTip(this.skinButton_headImage, "帐号:" + engine.CurrentUserID); this.rapidPassiveEngine = engine; this.globalUserCache = new GlobalUserCache(this.rapidPassiveEngine); this.globalUserCache.FriendInfoChanged += new CbGeneric <GGUser>(globalUserCache_FriendInfoChanged); this.globalUserCache.FriendStatusChanged += new CbGeneric <GGUser>(globalUserCache_FriendStatusChanged); this.globalUserCache.GroupChanged += new CbGeneric <GGGroup, GroupChangedType, string>(globalUserCache_GroupInfoChanged); this.globalUserCache.FriendRTDataRefreshCompleted += new CbGeneric(globalUserCache_FriendRTDataRefreshCompleted); this.globalUserCache.FriendRemoved += new CbGeneric <string>(globalUserCache_FriendRemoved); this.globalUserCache.FriendAdded += new CbGeneric <GGUser>(globalUserCache_FriendAdded); this.globalUserCache.CurrentUser.UserStatus = (UserStatus)((int)userStatus); this.myStatus = this.globalUserCache.CurrentUser.UserStatus; this.labelSignature.Text = this.globalUserCache.CurrentUser.Signature; this.skinButton_headImage.Image = GlobalResourceManager.GetHeadImage(this.globalUserCache.CurrentUser); this.labelName.Text = this.globalUserCache.CurrentUser.Name; skinButton_State.Image = stateImage; skinButton_State.Tag = userStatus; this.skinLabel_softName.Text = GlobalResourceManager.SoftwareName; this.notifyIcon.ChangeText(String.Format("{0}:{1}({2})\n状态:{3}", GlobalResourceManager.SoftwareName, this.globalUserCache.CurrentUser.Name, this.globalUserCache.CurrentUser.UserID, GlobalResourceManager.GetUserStatusName(this.globalUserCache.CurrentUser.UserStatus))); this.MaximumSize = new Size(543, Screen.GetWorkingArea(this).Height); this.Size = SystemSettings.Singleton.MainFormSize; this.Location = SystemSettings.Singleton.MainFormLocation;//new Point(Screen.PrimaryScreen.Bounds.Width - this.Width - 20, 40); this.friendListBox1.Initialize(this.globalUserCache.CurrentUser, this, new UserInformationForm(new Point(this.Location.X - 284, this.friendListBox1.Location.Y))); this.groupListBox.Initialize(this.globalUserCache.CurrentUser, GlobalConsts.CompanyGroupID); this.recentListBox1.Initialize(this); if (!SystemSettings.Singleton.ShowLargeIcon) { this.friendListBox1.IconSizeMode = ChatListItemIcon.Small; this.大头像ToolStripMenuItem.Checked = false; this.小头像ToolStripMenuItem.Checked = true; } //文件传送 this.rapidPassiveEngine.FileOutter.FileRequestReceived += new CbFileRequestReceived(fileOutter_FileRequestReceived); this.rapidPassiveEngine.FileOutter.FileResponseReceived += new CbGeneric <TransferingProject, bool>(fileOutter_FileResponseReceived); this.rapidPassiveEngine.ConnectionInterrupted += new CbGeneric(rapidPassiveEngine_ConnectionInterrupted); //预订断线事件 this.rapidPassiveEngine.BasicOutter.BeingPushedOut += new CbGeneric(BasicOutter_BeingPushedOut); this.rapidPassiveEngine.RelogonCompleted += new CbGeneric <LogonResponse>(rapidPassiveEngine_RelogonCompleted); //预订重连成功事件 this.rapidPassiveEngine.MessageReceived += new CbGeneric <string, int, byte[], string>(rapidPassiveEngine_MessageReceived); //群、组 this.rapidPassiveEngine.ContactsOutter.BroadcastReceived += new CbGeneric <string, string, int, byte[], string>(ContactsOutter_BroadcastReceived); this.rapidPassiveEngine.ContactsOutter.ContactsOffline += new CbGeneric <string>(ContactsOutter_ContactsOffline); //所有联系人的下线事件 //网盘访问器 V2.0 this.nDiskOutter = new NDiskOutter(this.rapidPassiveEngine.FileOutter, this.rapidPassiveEngine.CustomizeOutter); this.notifyIcon.UnhandleMessageOccured += new CbGeneric <UnhandleMessageType, string>(notifyIcon_UnhandleMessageOccured); this.notifyIcon.UnhandleMessageGone += new CbGeneric <UnhandleMessageType, string>(notifyIcon_UnhandleMessageGone); this.notifyIcon.Initialize(this, this); }
public Image GetHeadImage(IUser user) { return(GlobalResourceManager.GetHeadImage((GGUser)user)); }
private void AddUserItem(GGUser friend) { ChatListSubItem subItem = new ChatListSubItem(friend.UserID, friend.UserID, friend.Name, friend.Signature, GlobalResourceManager.ConvertUserStatus(friend.UserStatus), GlobalResourceManager.GetHeadImage(friend)); subItem.Tag = friend; this.chatListBox1.Items[0].SubItems.AddAccordingToStatus(subItem); }
public static Image GetHeadImage(GGUser user) { return(GlobalResourceManager.GetHeadImage(user, false)); }