Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
        public UpdateGroupInfoForm(IRapidPassiveEngine engine, GlobalUserCache cache, GGGroup group)
        {
            InitializeComponent();

            this.rapidPassiveEngine = engine;
            this.currentGroup       = group;
            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 = group.ID;
            this.skinTextBox_nickName.SkinTxt.Text  = group.Name;
            this.skinTextBox_signature.SkinTxt.Text = group.Announce;

            globalUserCache = cache;
        }
Ejemplo n.º 3
0
        public GroupChatForm(IRapidPassiveEngine engine, string groupID, GlobalUserCache cache, IChatSupporter supporter)
        {
            this.rapidPassiveEngine = engine;
            this.globalUserCache    = cache;
            this.mine         = this.globalUserCache.GetUser(this.rapidPassiveEngine.CurrentUserID);
            this.ggSupporter  = supporter;
            this.currentGroup = this.globalUserCache.GetGroup(groupID);

            InitializeComponent();
            this.chatBoxSend.Initialize(GlobalResourceManager.EmotionDictionary);
            this.chatBox_history.Initialize(GlobalResourceManager.EmotionDictionary);
            this.chatBoxSend.Font      = SystemSettings.Singleton.Font;
            this.chatBoxSend.ForeColor = SystemSettings.Singleton.FontColor;
            this.Size = SystemSettings.Singleton.ChatFormSize;

            this.linkLabel_softName.Text = GlobalResourceManager.SoftwareName;

            this.toolShow.SetToolTip(this.panelFriendHeadImage, this.currentGroup.GroupID);
            this.Text = string.Format("{0}({1})", this.currentGroup.Name, this.currentGroup.GroupID);
            this.labelGroupName.Text = this.currentGroup.Name;
            this.label_announce.Text = this.currentGroup.Announce;
            this.chatBoxSend.Focus();

            this.emotionForm       = new EmotionForm();
            this.emotionForm.Load += new EventHandler(emotionForm_Load);
            this.emotionForm.Initialize(GlobalResourceManager.EmotionList);
            this.emotionForm.EmotionClicked += new CbGeneric <int, Image>(emotionForm_Clicked);
            this.emotionForm.Visible         = false;
            this.emotionForm.LostFocus      += new EventHandler(emotionForm_LostFocus);

            foreach (string memberID in this.currentGroup.MemberList)
            {
                GGUser friend = this.globalUserCache.GetUser(memberID);
                this.AddUserItem(friend);
            }

            if (SystemSettings.Singleton.LoadLastWordsWhenChatFormOpened)
            {
                LastWordsRecord record = this.currentGroup.Tag as LastWordsRecord;
                if (record != null)
                {
                    string talker = string.Format("{0}({1})", record.SpeakerName, record.SpeakerID);
                    this.AppendChatBoxContent(talker, record.SpeakTime, record.ChatBoxContent, Color.Blue);
                }
            }
        }
Ejemplo n.º 4
0
        /// <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);
        }