예제 #1
0
파일: Book.aspx.cs 프로젝트: renyh1013/dp2
 void BiblioControl1_WantFocus(object sender, WantFocusEventArgs e)
 {
     if (e.Focus == true)
         this.CommentsControl1.Active = false;
     else
         this.CommentsControl1.Active = true;
 }
예제 #2
0
        void commentcontrol_WantFocus(object sender, WantFocusEventArgs e)
        {
            CommentControl source = (CommentControl)sender;
            if (e.Focus == true)
            {
                source.Active = true;

                List<Control> controls = BrowseSearchResultControl.FindControl(this,
    typeof(CommentControl));

                // 找到sender对象以外的其他CommentControl对象,把它们设置为Active = false的状态
                foreach (Control control in controls)
                {
                    CommentControl comment_control = (CommentControl)control;
                    if (comment_control == source)
                    {
                        comment_control.Active = true;
                    }
                    else
                    {
                        comment_control.Active = false;
                    }
                }
            }
            else
            {
                // 大家都为true
                List<Control> controls = BrowseSearchResultControl.FindControl(this,
    typeof(CommentControl));

                // 找到sender对象以外的其他CommentControl对象,把它们设置为Active = false的状态
                foreach (Control control in controls)
                {
                    CommentControl comment_control = (CommentControl)control;
                    comment_control.Active = true;
                }
            }

            /*
            CommentControl source = (CommentControl)sender;

            List<Control> controls = BrowseSearchResultControl.FindControl(this,
                typeof(CommentControl));

            // 找到sender对象以外的其他CommentControl对象,把它们设置为Active = false的状态
            foreach (Control control in controls)
            {
                CommentControl comment_control = (CommentControl)control;
                if (comment_control == source)
                {
                    comment_control.Active = true;
                }
                else
                {
                    comment_control.Active = false;
                }
            }

            // 把底部的editor隐藏
            CommentControl editor = (CommentControl)this.FindControl("editor");
            editor.Visible = false;
             * */

            // 继续发给父对象
            if (this.WantFocus != null)
            {
                WantFocusEventArgs e1 = new WantFocusEventArgs();
                e1.Focus = e.Focus;
                this.WantFocus(this, e1);
            }
        }
예제 #3
0
        void editor_WantFocus(object sender, WantFocusEventArgs e)
        {
            if (this.MinimizeNewReviewEdtior == true)
            {
                // editor说它要放弃焦点
                // 那么就最小化它
                if (e.Focus == false)
                {
                    CommentControl commentcontrol = (CommentControl)sender;
                    commentcontrol.Minimized = "true";
                }
                // 继续发给父对象
                if (this.WantFocus != null)
                {
                    WantFocusEventArgs e1 = new WantFocusEventArgs();
                    e1.Focus = e.Focus;
                    this.WantFocus(this, e1);
                }
            }


        }
예제 #4
0
        void commentscontrol_WantFocus(object sender, WantFocusEventArgs e)
        {
            CommentsControl source = (CommentsControl)sender;

            List<Control> comments_controls = FindControl(this,
                typeof(CommentsControl));

            List<Control> items_controls = FindControl(this,
    typeof(ItemsControl));

            if (e.Focus == true)
            {
                source.Active = true;

                // 把整个浏览控件中的除了sender以外的其他CommentsControl对象设置为Active = false
                foreach (Control control in comments_controls)
                {
                    CommentsControl comment_control = (CommentsControl)control;
                    if (comment_control == source)
                    {
                        comment_control.Active = true;
                    }
                    else
                    {
                        comment_control.Active = false;
                    }
                }

                // 把整个浏览控件中的ItemsControl对象设置为Active = false
                foreach (Control control in items_controls)
                {
                    ItemsControl items_control = (ItemsControl)control;
                    items_control.Active = false;
                }
            }
            else
            {
                // 没有人独占,大家都为 true
                foreach (Control control in comments_controls)
                {
                    CommentsControl comment_control = (CommentsControl)control;
                    comment_control.Active = true;
                }

                foreach (Control control in items_controls)
                {
                    ItemsControl items_control = (ItemsControl)control;
                    items_control.Active = true;
                }
            }
        }
예제 #5
0
        void change_button_Click(object sender, EventArgs e)
        {
            this.EditAction = "change";

            if (this.WantFocus != null)
            {
                WantFocusEventArgs e1 = new WantFocusEventArgs();
                this.WantFocus(this, e1);
            }
        }
예제 #6
0
        void minimize_button_Click(object sender, EventArgs e)
        {
            if (this.Minimized == "true")
                this.Minimized = "false";
            else
                this.Minimized = "true";

            if (this.WantFocus != null)
            {
                WantFocusEventArgs e1 = new WantFocusEventArgs();
                if (this.Minimized == "true")
                    e1.Focus = false;
                else
                    e1.Focus = true;

                this.WantFocus(this, e1);
            }
        }
예제 #7
0
        // 放弃编辑
        void cancel_button_Click(object sender, EventArgs e)
        {
            this.EditAction = "";
            this.ClearEdit();

            if (this.WantFocus != null)
            {
                WantFocusEventArgs e1 = new WantFocusEventArgs();
                e1.Focus = false;   // 不再独占Focus
                this.WantFocus(this, e1);
            }

            if (this.Submited != null)
            {
                SubmitedEventArgs e1 = new SubmitedEventArgs();
                e1.Action = "cancel";  // cancel
                this.Submited(this, e1);
            }
        }
예제 #8
0
        // TODO: 最好 redirect 到当前URL。但要注意跳转到接近的link
        void submit_button_Click(object sender, EventArgs e)
        {
            string strError = "";
            string strWarning = "";

            int nRet = DoSubmit(
            out strWarning,
            out strError);
            if (nRet == -1)
                goto ERROR1;

            string strAction = this.EditAction;
            if (String.IsNullOrEmpty(strAction) == true)
                strAction = "change";

            this.EditAction = "";

            if (this.WantFocus != null)
            {
                WantFocusEventArgs e1 = new WantFocusEventArgs();
                e1.Focus = false;   // 不再独占Focus
                this.WantFocus(this, e1);
            }

            if (this.Submited != null)
            {
                SubmitedEventArgs e1 = new SubmitedEventArgs();
                e1.Action = strAction;  // new / change
                this.Submited(this, e1);
            }

            if (String.IsNullOrEmpty(strWarning) == false)
                this.SetDebugInfo("warninginfo", strWarning);
            else
            {
                this.Page.Response.Redirect("./book.aspx?commentrecpath=" + HttpUtility.UrlEncode(this.RecPath) + "#active", true);
            }
            return;
        ERROR1:
            this.SetDebugInfo("errorinfo", strError);
        }
예제 #9
0
        void commentcontrol_WantFocus(object sender, WantFocusEventArgs e)
        {
            // 最后有函数统一设置了,这里就不用作了
            /*
            CommentControl source = (CommentControl)sender;
            List<Control> controls = BrowseSearchResultControl.FindControl(this,
                typeof(CommentControl));

            // 找到sender对象以外的其他CommentControl对象,把它们设置为Active = false的状态
            foreach (Control control in controls)
            {
                CommentControl comment_control = (CommentControl)control;
                if (comment_control == source)
                {
                    comment_control.Active = true;
                }
                else
                {
                    comment_control.Active = false;
                }
            }

            // 找到所有BiblioControl对象
            controls = BrowseSearchResultControl.FindControl(this,
    typeof(BiblioControl));

            // 把它们设置为Active = false的状态
            foreach (Control control in controls)
            {
                BiblioControl biblio_control = (BiblioControl)control;
                biblio_control.Active = false;
            }

            // 隐藏底部的cmdline中的按钮
            EnableCmdButtons(false);
            m_bButtonSetted = true;
             * */

            /*
            // 把底部的editor隐藏
            CommentControl editor = (CommentControl)this.FindControl("editor");
            editor.Visible = false;

            // 继续发给父对象
            if (this.SetActive != null)
            {
                SetActiveEventArgs e1 = new SetActiveEventArgs();
                this.SetActive(this, e1);
            }
             * */
        }
예제 #10
0
 void bibliocontrol_WantFocus(object sender, WantFocusEventArgs e)
 {
 }