Beispiel #1
0
        public GroupChatterForm(GroupInfo gi)
        {
            InitializeComponent();
            Show();

            StartPosition = FormStartPosition.CenterScreen;
            m_group = gi;
            m_msg_input_tbx.Focus();

            m_user_list.Items.AddRange(m_group.GetUserArray());
            QueryGroupUsers();
            UpdateMessage();

            this.Text = string.Format("{0} - 房间({1})", m_group.Name, m_group.Key);
        }
Beispiel #2
0
 public static GroupInfo Create(string name)
 {
     GroupInfo group = new GroupInfo(Guid.NewGuid().ToString(), name);
     return group;
 }
Beispiel #3
0
 public static void DeleteGroup(GroupInfo group)
 {
     lock (LockObject)
     {
         if (m_groups.ContainsKey(group.Key))
             m_groups.Remove(group.Key);
     }
 }
Beispiel #4
0
 public static void AddGroup(GroupInfo group)
 {
     lock (LockObject)
     {
         if (!m_groups.ContainsKey(group.Key))
             m_groups.Add(group.Key, group);
     }
 }
Beispiel #5
0
 public void AddGroup(GroupInfo gi)
 {
     m_list.Items.Add(gi);
 }
Beispiel #6
0
 public void DeleteGroup(GroupInfo gi)
 {
     m_list.Items.Remove(gi);
 }
Beispiel #7
0
        public NP_AppendGroupImageMessageCmd(byte[] data, IPEndPoint remoteIP)
        {
            m_user = UserInfoManager.FindUser(remoteIP);

            int key_length = Helper.GetInt(data);
            m_group = GroupInfoManager.FindGroup(Helper.GetString(data, 4, key_length));

            int length = Helper.GetInt(data, key_length + 4);
            m_filename = Helper.GetString(data, key_length + 8, length);
            m_filename = Path.Combine(DataManager.GetCustomFaceFolderPath(), m_filename);

            int fileDataOffset = 4 + key_length + length + 4;
            int fileDataLength = data.Length - fileDataOffset;

            MemoryStream ms = new MemoryStream(data, fileDataOffset, fileDataLength);
            byte[] imgData = ms.ToArray();
            ms.Dispose();

            GenerateImageFile(imgData, ref m_filename);
        }
Beispiel #8
0
            public ItemContextMenu(GroupInfo group)
            {
                m_group = group;

                this.Items.Add("CreateGroup");
                this.Items.Add("QuitGroup");
                this.ItemClicked += new ToolStripItemClickedEventHandler(ItemContextMenu_ItemClicked);
            }
Beispiel #9
0
        public static void AddGroup(string groupKey, string name)
        {
            if (string.IsNullOrEmpty(groupKey) || string.IsNullOrEmpty(name))
                return;

            if (GroupInfoManager.FindGroup(groupKey) != null)
                return;

            s_singleton.Invoke(new DoAction(delegate
            {
                Logger.WriteLine(string.Format("Add Group: {0}. with key: {1}", name, groupKey));

                GroupInfo gi = new GroupInfo(groupKey, name);
                GroupInfoManager.AddGroup(gi);
                s_singleton.m_groups.AddGroup(gi);
            }));
        }
Beispiel #10
0
            void m_timer_Tick(object sender, EventArgs e)
            {
                m_timer.Start();

                if (m_flashingUser != null && !m_flashingUser.IsReceiveNewMessage)
                {
                    m_flashingUser = null;
                }

                if (m_flashingGroup != null && !m_flashingGroup.IsReceiveNewMessage)
                {
                    m_flashingGroup = null;
                }

                if (m_flashingUser == null)
                {
                    m_flashingUser = UserInfoManager.FindUserWhichHaveNewMessage();
                }

                if (m_flashingUser == null)
                {
                    m_flashingGroup = GroupInfoManager.FindGroupWhichHaveNewMessage();
                }

                if (m_flashingUser == null && m_flashingGroup == null)
                {
                    m_tray.Icon = IconManager.Tray_Normal;
                    return;
                }
                else
                {
                    m_state = !m_state;

                    if (m_state)
                        m_tray.Icon = IconManager.Tray_Normal;
                    else
                        m_tray.Icon = IconManager.Tray_Blank;
                }
            }
Beispiel #11
0
        public static void QuitGroup(GroupInfo group)
        {
            if (group == null)
                return;

            s_singleton.Invoke(new DoAction(delegate
            {
                Logger.WriteLine(string.Format("Quit Group: {0}. with key: {1}", group.Name, group.Key));

                GroupInfoManager.DeleteGroup(group);
                s_singleton.m_groups.DeleteGroup(group);
            }));
        }
Beispiel #12
0
        public static void QueryGroupUser(GroupInfo group)
        {
            if (group == null)
                return;

            s_singleton.Invoke(new DoAction(delegate
            {
                Logger.WriteLine(string.Format("Query Group Users, group name: {0}. with key: {1}", group.Name, group.Key));

                group.QueryGroupUsers();
            }));
        }
Beispiel #13
0
        public static void GroupAddUser(GroupInfo group, UserInfo user)
        {
            if (group == null || user == null)
                return;

            s_singleton.Invoke(new DoAction(delegate
            {
                Logger.WriteLine(string.Format("Group: {0}, Add user: {1}", group.Name, user.Username));
                group.AddUser(user);
            }));
        }