コード例 #1
0
ファイル: MainForm.cs プロジェクト: xydoublez/GGTalk-V5.5
        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);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: xydoublez/GGTalk-V5.5
        //状态选择项
        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)));
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: xydoublez/GGTalk-V5.5
        /// <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);
        }