示例#1
0
        private void bindAscanDrawEvent()
        {
            ascanUpdateList = new List <DelegateAscanUpdate>();

            for (uint i = 0; i < sessionsAttrs.Count; i++)
            {
                DelegateAscanUpdate ascanUpdate = new DelegateAscanUpdate(i);
                ascanUpdateList.Add(ascanUpdate);
            }
        }
示例#2
0
        /**Stop timer.*/

        /*public void stop()
         * {
         *  if (timer.Enabled)
         *      timer.Enabled = false;
         * }*/

        /**Ascan UI timer function.*/
        private void AscanUIFunc()
        {
            //DEFINATION
            bool isError;

            int  dequeueResult;
            int  endCount;
            bool isQuit = false;

            //INIT
            isError  = false;
            endCount = 0;

            //PROCESSING
            init.handclasp_meet();

            DelegateAscanUpdate ascanUpdate = new DelegateAscanUpdate();

            while (!GlobalQuit.Quit && !isQuit)
            {
                try
                {
                    for (int i = 0; i < SessionInfo.sessionNum; i++)
                    {
                        dequeueResult = ascanInList[i].DequeueWithSemaphor(ref ascanQueueElement, ConstParameter.TimeOutMilliSecondValue);

                        if (dequeueResult == -1)
                        {
                            StackTrace st = new StackTrace(new StackFrame(true));
                            LogHelper.WriteLog("Ascan UI Thread timed out when semaphor wait for receiving!", st);
#if USE_WARNING
                            MessageBox.Show("A扫UI线程信号量超时,请马上设置断点检查。位置:AscanUIThread.AscanUIFunc");
#endif
                            status = ThreadCondition.error;
                            //isError = true;
                        }
                        else if (dequeueResult == 0)
                        {
                            continue;
                        }
                        else if (dequeueResult == 1)
                        {
                            if (ascanQueueElement.IsEnd)
                            {
                                endCount++;
                                if (endCount == ascanInList.Count)
                                {
                                    endCount = 0;
                                    isQuit   = true;
                                    //timer.Enabled = false;
                                    break;
                                }
                                else
                                {
                                    continue;
                                }
                            }

                            if (!MainForm.IsToStop)
                            {
                                if (i == SelectAscan.userIndex && (int)ascanQueueElement.getPort() == SelectAscan.port)
                                {
                                    MainForm.syncContext.Post(FormList.MDIChild.updateAscan, (Object)ascanQueueElement);
                                    //FormList.MDIChild.updateAscan(ascanQueueElement);
                                    //ascanUpdate.Execute(ascanQueueElement);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    StackTrace st = new StackTrace(new StackFrame(true));
                    LogHelper.WriteLog(ex, st);
#if USE_WARNING
                    MessageBox.Show("检测到异常,请马上设置断点检查。位置:AscanUIThread.AscanUIFunc");
#endif
                    status = ThreadCondition.error;
                    //isError = true;
                }
            }
            init.handclasp_force();

            clean.handclasp_meet();

            status = ThreadCondition.exit;
        }