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);
                }
            }
        }
Beispiel #2
0
        public void Initialize(string _userID, string groupID, IDynamicGroupOutter _groupOutter)
        {
            this.userID      = _userID;
            this.groupID     = groupID;
            this.groupOutter = _groupOutter;

            #region Emotion
            List <string> tempList        = ESBasic.Helpers.FileHelper.GetOffspringFiles(AppDomain.CurrentDomain.BaseDirectory + "Emotion\\");
            List <string> emotionFileList = new List <string>();
            foreach (string file in tempList)
            {
                string name = file.ToLower();
                if (name.EndsWith(".bmp") || name.EndsWith(".jpg") || name.EndsWith(".jpeg") || name.EndsWith(".png") || name.EndsWith(".gif"))
                {
                    emotionFileList.Add(name);
                }
            }
            emotionFileList.Sort(new Comparison <string>(CompareEmotionName));
            List <Image> emotionList = new List <Image>();
            for (int i = 0; i < emotionFileList.Count; i++)
            {
                emotionList.Add(Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "Emotion\\" + emotionFileList[i]));
            }
            #endregion

            this.emotionDictionary = new Dictionary <uint, Image>();
            for (uint i = 0; i < emotionList.Count; i++)
            {
                this.emotionDictionary.Add(i, emotionList[(int)i]);
            }

            this.chatBox_his.Initialize(this.emotionDictionary);
            this.chatBox_send.Initialize(this.emotionDictionary);

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