Exemplo n.º 1
0
        void Stop_OnBeginLoop(object sender, BeginLoopEventArgs e)
        {
            lock (this)
            {
                // 第一次OnBegin触发
                if (this.m_bStartGroupSearch == false)
                {
                    this.m_stopDir.OnStop += new StopEventHandler(m_stopDir_OnStop);
                    this.m_stopDir.SetMessage("开始检索 ...");

                    /*
                    Stop active = this.MainForm.stopManager.ActiveStop;
                    Debug.Assert(this.MainForm.stopManager.IsActive(this.m_stopDir) == true, "");
                     * */

                    this.m_stopDir.BeginLoop();
                    this.m_connectionDir.EnableControls(false);
                }

                this.m_bStartGroupSearch = true;
            }
#if NOOOOOOOOOOOOOOOO
            lock (this)
            {
                this.m_stops.Add((Stop)sender);

                // 第一次OnBegin触发
                if (this.m_nGroupSearchCount == 0)
                {
                    this.m_stopDir.OnStop += new StopEventHandler(m_stopDir_OnStop);
                    this.m_stopDir.SetMessage("开始检索 ...");

                    /*
                    Stop active = this.MainForm.stopManager.ActiveStop;
                    Debug.Assert(this.MainForm.stopManager.IsActive(this.m_stopDir) == true, "");
                     * */

                    this.m_stopDir.BeginLoop();
                    this.m_connectionDir.EnableControls(false);
                }


                this.m_nGroupSearchCount++;
                this.m_nServerCount++;

                this.m_stopDir.SetMessage("正在检索 (目标数 " + this.m_nGroupSearchCount.ToString() + ") ...");
            }
#endif
        }
Exemplo n.º 2
0
        //准备做事情,被循环调,时面了调了Stopmanager的Enable()函数,修改父窗口的按钮状态
        // return:
        //      true 成功
        //      false   失败。BeginLoop() 发生了嵌套
        public void BeginLoop()
        {
#if NO
            if (_inBeginLoop > 0 
                && _allowNest == false)
                throw new Exception("针对同一 Stop 对象,BeginLoop 不能嵌套调用");
#endif

            int nRet = Interlocked.Increment(ref _inBeginLoop);
            // _inBeginLoop++;
            if (nRet == 1)
            {
                nStop = 0;	// 正在处理

                if (m_manager != null)
                {
                    bool bIsActive = m_manager.IsActive(this);

                    if (this.OnBeginLoop != null)
                    {
                        BeginLoopEventArgs e = new BeginLoopEventArgs();
                        e.IsActive = bIsActive;
                        this.OnBeginLoop(this, e);
                    }

                    if (bIsActive == true)
                    {
                        m_manager.ChangeState(this,
                            StateParts.All | StateParts.SaveEnabledState,
                            true);
                    }
                    else
                    {
                        // 不在激活位置的stop,不要记忆原有的reversebutton状态。因为这样会记忆到别人的状态
                        m_manager.ChangeState(this,
                            StateParts.All,
                            true);
                    }
                }
            }
        }
Exemplo n.º 3
0
        //准备做事情,被循环调,时面了调了Stopmanager的Enable()函数,修改父窗口的按钮状态
        public void BeginLoop()
        {
            nStop = 0;	// 正在处理

            if (m_manager != null)
            {
                bool bIsActive = m_manager.IsActive(this);

                if (this.OnBeginLoop != null)
                {
                    BeginLoopEventArgs e = new BeginLoopEventArgs();
                    e.IsActive = bIsActive;
                    this.OnBeginLoop(this, e);
                }

                if (bIsActive == true)
                {
                    m_manager.ChangeState(this,
                        StateParts.All | StateParts.SaveEnabledState,
                        true);
                }
                else
                {
                    // 不在激活位置的stop,不要记忆原有的reversebutton状态。因为这样会记忆到别人的状态
                    m_manager.ChangeState(this,
                        StateParts.All ,
                        true);
                }
            }
        }