/// <summary>
 /// 공지함 리스트 생성
 /// </summary>
 /// <param name="msg"></param>
 private void DisplayFormOnNoticeListReceived(object sender, CustomEventArgs e)
 {//L|time‡content‡mode‡sender‡seqnum‡title|...
     try
     {
         string[] msg = (string[])e.GetItem;
         if (msg.Length >= 2)
         {
             if (noticelistform != null || noticelistform.IsDisposed)
             {
                 noticelistform = new NoticeListForm(connection);
             }
             noticelistform.AssignListInfo(msg);
             noticelistform.Show();
         }
         else
         {
             MessageBox.Show("등록된 공지가 없습니다.", "공지없음", MessageBoxButtons.OK);
         }
     }
     catch (Exception ex)
     {
         Logger.error("MakeNoticeListForm() " + ex.StackTrace.ToString());
     }
 }
        /// <summary>
        /// 공지함 리스트 생성
        /// </summary>
        /// <param name="msg"></param>
        private void MakeNoticeListForm(string[] msg) {//L|time‡content‡mode‡sender‡seqnum‡title|...
        
            try {

                {
                    if (noticelistform != null)
                    {
                        noticelistform.Close();
                    }
                    noticelistform = new NoticeListForm();

                    noticelistform.listView.SelectedIndexChanged += new EventHandler(listView_Click);
                    noticelistform.KeyDown += new KeyEventHandler(noticelistform_KeyDown);
                    noticelistform.listView.KeyDown += new KeyEventHandler(noticelistform_KeyDown);
                    noticelistform.btn_del.MouseClick += new MouseEventHandler(btn_del_Click);

                    noticelistform.listView.CheckBoxes = true;
                    noticelistform.btn_del.Visible = true;
                    noticelistform.cancel.Visible = true;
                    noticelistform.btn_all.Visible = true;


                    foreach (string item in msg)
                    {
                        try
                        {
                            if (!item.Equals("L") && item.Length != 0)
                            {

                                string[] arr = null;

                                if (item.Split('‡').Length > 4)// '|' -> shift+\ 
                                {
                                    arr = item.Split('‡');  //time‡content‡mode‡sender‡seqnum‡title|...
                                }

                                ListViewItem listitem = null;

                                if (arr != null && arr.Length > 4)
                                {
                                    logWrite("notice_time = " + arr[0]);

                                    if (arr[2].Equals("n"))
                                    {
                                        listitem = noticelistform.listView.Items.Add(arr[0], "일반", null);
                                    }
                                    else
                                    {
                                        listitem = noticelistform.listView.Items.Add(arr[0], "긴급", null);
                                        listitem.ForeColor = Color.Red;
                                    }


                                    string sender = "";
                                    if (arr[3] != null)
                                    {
                                        sender = GetUserName(arr[3].Trim());

                                        if (arr[1].Contains("\n\r\n\r"))
                                        {
                                            logWrite("찾음");
                                            arr[1].Replace("♪", " ");
                                        }
                                    }

                                    listitem.SubItems.Add(arr[5].Trim());
                                    listitem.SubItems.Add(arr[1].Trim());
                                    listitem.SubItems.Add(sender + "(" + arr[3].Trim() + ")");
                                    listitem.SubItems.Add(arr[0]);
                                    listitem.Tag = arr[4];
                                    logWrite("seqnum = " + arr[4]);
                                    noticelistform.listView.ListViewItemSorter = new ListViewItemComparerDe(3);

                                }
                            }
                        }
                        catch (Exception ex1)
                        {
                            logWrite(ex1.ToString());
                        }
                    }
                }

                noticelistform.Show();
            }
            catch (Exception e)
            {
                logWrite("MakeNoticeListForm() " + e.StackTrace.ToString());
            }
        }
        public void LogoutFormClose() { //로그아웃 전에 열린 폼 닫기 및 정보테이블 삭제
        
            //자원해제 대상
        //private Hashtable ChatFormList = new Hashtable();  //채팅창  key=id, value=chatform
        //private Hashtable MemoFormList = new Hashtable(); //key=time, value=SendMemoForm
        //private Hashtable TeamInfoList = new Hashtable(); //key=id, value=team
        //private Hashtable InList = new Hashtable();       //key=id, value=IPEndPoint
        //private Hashtable MemberInfoList = new Hashtable();
        //private Hashtable FileSendDetailList = new Hashtable();
        //private Hashtable FileSendFormList = new Hashtable();
        //private Hashtable FileSendThreadList = new Hashtable();
        //private Hashtable FileReceiverThreadList = new Hashtable();
        //private Hashtable NoticeDetailForm = new Hashtable();
        //private Hashtable treesource = new Hashtable();
        //private ArrayList MemoTable = new ArrayList();
        //private ArrayList omitteamlist = new ArrayList();
        
            try {
                if (noticelistform != null) {
                    noticelistform.Close();
                    noticelistform = null;
                }

                if (noticeresultform != null) {
                    noticeresultform.Close();
                    noticeresultform = null;
                }

                if (noreceiveboardform != null) {
                    noreceiveboardform.Close();
                    noreceiveboardform = null;
                }

                if (ChatFormList.Count != 0) {

                    foreach (DictionaryEntry de in ChatFormList) {
                        if (de.Value != null) {
                            try
                            {
                                ChatForm form = (ChatForm)de.Value;
                                form.Dispose();
                            }
                            catch (Exception e)
                            {
                                logWrite("form.Dispose() 에러 : " + e.ToString());
                            }
                        }
                    }
                    ChatFormList.Clear();
                    logWrite("ChatFormList Clear!");
                }

                if (MemoFormList.Count != 0)
                {
                    foreach (DictionaryEntry de in MemoFormList)
                    {
                        if (de.Value != null)
                        {
                            try
                            {
                                SendMemoForm form = (SendMemoForm)de.Value;
                                form.Dispose();
                            }
                            catch (Exception e)
                            {
                                logWrite("form.Dispose() 에러 : " + e.ToString());
                            }
                        }
                    }
                    MemoFormList.Clear();
                    logWrite("MemoFormList Clear!");
                }

                TeamInfoList.Clear();
                InList.Clear();
                MemberInfoList.Clear();
                FileSendDetailList.Clear();

                if (FileSendFormList.Count != 0)
                {
                    foreach (DictionaryEntry de in FileSendFormList)
                    {
                        if (de.Value != null)
                        {
                            try
                            {
                                SendFileForm form = (SendFileForm)de.Value;
                                form.Dispose();
                            }
                            catch (Exception e)
                            {
                                logWrite("form.Dispose() 에러 : " + e.ToString());
                            }
                        }
                    }
                    FileSendFormList.Clear();
                    logWrite("FileSendFormList Clear!");
                }

                FileSendThreadList.Clear();
                FileReceiverThreadList.Clear();
                FtpClientThreadList.Clear();

                if (NoticeDetailForm.Count != 0)
                {
                    foreach (DictionaryEntry de in NoticeDetailForm)
                    {
                        if (de.Value != null)
                        {
                            try
                            {
                                NoticeDetailResultForm form = (NoticeDetailResultForm)de.Value;
                                form.Dispose();
                            }
                            catch (Exception e)
                            {
                                logWrite("form.Dispose() 에러 : " + e.ToString());
                            }
                        }
                    }
                    NoticeDetailForm.Clear();
                    logWrite("NoticeDetailForm Clear!");
                }

                treesource.Clear();

                if (MemoTable.Count != 0)
                {
                    foreach (MemoForm memoform in MemoTable)
                    {
                        memoform.Dispose();
                    }
                    MemoTable.Clear();
                    logWrite("MemoTable Clear!");
                }

                omitteamlist.Clear();
            }
            catch (Exception e)
            {
                logWrite(e.ToString());
            }
        }
        /// <summary>
        /// 공지함 리스트 생성
        /// </summary>
        /// <param name="msg"></param>
        private void DisplayFormOnNoticeListReceived(object sender, CustomEventArgs e)
        {//L|time‡content‡mode‡sender‡seqnum‡title|...

            try
            {
                string[] msg = (string[])e.GetItem;
                if (msg.Length >= 2)
                {
                    if (noticelistform != null || noticelistform.IsDisposed)
                        noticelistform = new NoticeListForm(connection);
                    noticelistform.AssignListInfo(msg);
                    noticelistform.Show();
                }
                else
                    MessageBox.Show("등록된 공지가 없습니다.", "공지없음", MessageBoxButtons.OK);
            }
            catch (Exception ex)
            {
                Logger.error("MakeNoticeListForm() " + ex.StackTrace.ToString());
            }
        }