示例#1
0
        private void USER_SEARCH_BUTTON_Click(object sender, EventArgs e)
        {
            string id = this.USER_SEARCH_TEXTBOX.Text.Trim( );

            if (id.Length <= 0)
            {
                NotifyBox.Show(this, "오류", "회원 ID를 입력하세요.", NotifyBoxType.OK, NotifyBoxIcon.Warning);
                return;
            }

            if (id == GlobalVar.NAVER_USER_ID)
            {
                NotifyBox.Show(this, "오류", "셀프 활동 정지는 불가능합니다!", NotifyBoxType.OK, NotifyBoxIcon.Warning);
                return;
            }

            if (GlobalVar.ADMINS[id] != null)
            {
                NotifyBox.Show(this, "오류", "다른 스탭분들께 활동 정지를 주는 행위는 불가능합니다!", NotifyBoxType.OK, NotifyBoxIcon.Warning);
                return;
            }

            this.USER_SEARCH_TEXTBOX.Enabled = false;
            this.USER_SEARCH_BUTTON.Text     = "서버에 요청하는 중 ...";
            this.USER_SEARCH_BUTTON.Enabled  = false;

            Thread thread = new Thread(() =>
            {
                if (NaverRequest.CheckMemberExistsSimple(id))
                {
                    MemberInformationStruct?info = NaverRequest.GetMemberInformation(id);

                    if (info.HasValue)
                    {
                        if (this.InvokeRequired)
                        {
                            this.Invoke(new Action(() =>
                            {
                                selectedMemberInformation = info.Value;
                                userSelected = true;
                            }));
                        }
                        else
                        {
                            selectedMemberInformation = info.Value;
                            userSelected = true;
                        }
                    }
                    else
                    {
                        NotifyBox.Show(this, "오류", "죄송합니다, 회원 데이터를 불러올 수 없었습니다, 다시 시도하세요.", NotifyBoxType.OK, NotifyBoxIcon.Error);
                    }
                }
                else
                {
                    NotifyBox.Show(this, "오류", "입력하신 아이디는 존재하지 않는 카페 회원입니다.", NotifyBoxType.OK, NotifyBoxIcon.Error);
                }

                if (this.InvokeRequired)
                {
                    this.Invoke(new Action(() =>
                    {
                        this.USER_SEARCH_BUTTON.Text     = "회원 검색";
                        this.USER_SEARCH_BUTTON.Enabled  = true;
                        this.USER_SEARCH_TEXTBOX.Enabled = true;
                    }));
                }
                else
                {
                    this.USER_SEARCH_BUTTON.Text     = "회원 검색";
                    this.USER_SEARCH_BUTTON.Enabled  = true;
                    this.USER_SEARCH_TEXTBOX.Enabled = true;
                }
            })
            {
                IsBackground = true
            };

            thread.Start( );
        }
示例#2
0
        private void USER_SEARCH_BUTTON_Click(object sender, EventArgs e)
        {
            string id = this.USER_SEARCH_TEXTBOX.Text.Trim( );

            if (id.Length <= 0)
            {
                NotifyBox.Show(this, "오류", "회원 ID를 입력하세요.", NotifyBoxType.OK, NotifyBoxIcon.Warning);
                return;
            }

            if (id == GlobalVar.NAVER_USER_ID)
            {
                NotifyBox.Show(this, "오류", "셀프 경고는 불가능합니다!", NotifyBoxType.OK, NotifyBoxIcon.Warning);
                return;
            }

            if (GlobalVar.ADMINS[id] != null)
            {
                NotifyBox.Show(this, "오류", "다른 스탭분들께 경고를 주는 행위는 불가능합니다!", NotifyBoxType.OK, NotifyBoxIcon.Warning);
                return;
            }

            this.USER_SEARCH_TEXTBOX.Enabled = false;

            this.USER_SEARCH_BUTTON.Text    = "서버에 요청하는 중 ...";
            this.USER_SEARCH_BUTTON.Enabled = false;

            this.WARN_RUN_BUTTON.Enabled      = false;
            this.WARNING_COUNT.Enabled        = false;
            this.WARNING_COUNT_AFTERDESC.Text = "경고 횟수를 서버에서 가져오고 있습니다 ...";

            Task.Factory.StartNew(() =>
            {
                if (NaverRequest.CheckMemberExistsSimple(id))
                {
                    MemberInformationStruct?info        = NaverRequest.GetMemberInformation(id);
                    Tuple <bool, int, string> countData = NaverRequest.GetMemberWarningCount(id);

                    if (countData.Item1)
                    {
                        warnCount = countData.Item2 + 1;
                        Utility.SetUriCookieContainerToNaverCookies("http://cafe.naver.com");

                        if (info.HasValue)
                        {
                            if (this.InvokeRequired)
                            {
                                this.Invoke(new Action(() =>
                                {
                                    selectedMemberInformation = info.Value;
                                    userSelected = true;

                                    this.nickName = selectedMemberInformation.nickName + "(" + selectedMemberInformation.memberID + ")";
                                    this.onlyID   = this.nickName.Substring(this.nickName.IndexOf('(') + 1, this.nickName.Length - this.nickName.IndexOf('(') - 2);

                                    this.WARNING_COUNT.Value       = warnCount;
                                    this.USERNICK_EXAMPLE.Text     = nickName;
                                    this.THREAD_TITLE_EXAMPLE.Text = nickName + "님 경고 (총 " + warnCount + "회)";
                                    //this.chatSendHelper.Navigate( new Uri( GlobalVar.CAFE_CHAT_URL ) );
                                }));
                            }
                            else
                            {
                                selectedMemberInformation = info.Value;
                                userSelected = true;

                                this.nickName = selectedMemberInformation.nickName + "(" + selectedMemberInformation.memberID + ")";
                                this.onlyID   = this.nickName.Substring(this.nickName.IndexOf('(') + 1, this.nickName.Length - this.nickName.IndexOf('(') - 2);

                                this.WARNING_COUNT.Value       = warnCount;
                                this.USERNICK_EXAMPLE.Text     = nickName;
                                this.THREAD_TITLE_EXAMPLE.Text = nickName + "님 경고 (총 " + warnCount + "회)";
                                //this.chatSendHelper.Navigate( new Uri( GlobalVar.CAFE_CHAT_URL ) );
                            }
                        }
                        else
                        {
                            NotifyBox.Show(this, "오류", "죄송합니다, 회원 데이터를 불러올 수 없었습니다, 다시 시도하세요.", NotifyBoxType.OK, NotifyBoxIcon.Error);
                        }
                    }
                    else
                    {
                        NotifyBox.Show(this, "오류", "죄송합니다, 회원 데이터를 불러올 수 없었습니다, 다시 시도하세요.", NotifyBoxType.OK, NotifyBoxIcon.Error);
                    }
                }
                else
                {
                    NotifyBox.Show(this, "오류", "입력하신 아이디는 존재하지 않는 카페 회원입니다.", NotifyBoxType.OK, NotifyBoxIcon.Error);
                }

                if (this.InvokeRequired)
                {
                    this.Invoke(new Action(() =>
                    {
                        this.USER_SEARCH_BUTTON.Text     = "회원 검색";
                        this.USER_SEARCH_BUTTON.Enabled  = true;
                        this.USER_SEARCH_TEXTBOX.Enabled = true;
                    }));
                }
                else
                {
                    this.USER_SEARCH_BUTTON.Text     = "회원 검색";
                    this.USER_SEARCH_BUTTON.Enabled  = true;
                    this.USER_SEARCH_TEXTBOX.Enabled = true;
                }
            });
        }