Ejemplo n.º 1
0
        private void ShowInstrumentationLogList(
            LoggingViewDataSet loggingViewData,
            LogIDPairEntity logIDPair,DateTimeCompare timeEntity,
            InstrumentationSearchCondition condition)
        {
            using (AsyncWorkerByTrunk<IInstrumentationView> worker = new AsyncWorkerByTrunk<IInstrumentationView>(_presenter, this.GridViewInstrumentation, new Control[] { ButtonClear }, true))
            {
                worker.DoWork += delegate(object oDoWork, DoWorkEventArgs eDoWork)
                {
                    eDoWork.Result = _presenter.GetInstrumentationData(
                                logIDPair,timeEntity,
                                condition);
                    Thread.Sleep(300); // default 300
                };
                worker.RunWorkerCompleted += delegate(object oCompleted, RunWorkerCompletedEventArgs eCompleted)
                {
                    if (WorkItem.SmartParts[ViewId] == null || !IsAsyncWorking)
                    {
                        this.ButtonSearch.Text = "&Search";
                        return;
                    }

                    // ExceptionViewData exceptionViewData = eCompleted.Result as ExceptionViewData;
                    LoggingViewDataSet tempLoggingViewData = eCompleted.Result as LoggingViewDataSet;
                    if (tempLoggingViewData == null) tempLoggingViewData = new LoggingViewDataSet();
                    loggingViewData.Merge(tempLoggingViewData);
                    GridViewInstrumentation.DataSource = loggingViewData;
                    this.totalCount.Text = GridViewInstrumentation.Rows.Count.ToString();

                    string[] logIDPairArray = tempLoggingViewData.ExtendedProperties["LogIDPair"].ToString().Split(',');
                    Int64 minLogID = Convert.ToInt64(logIDPairArray[0]);
                    Int64 maxLogID = Convert.ToInt64(logIDPairArray[1]);

                    if (minLogID <= maxLogID)
                    {
                        ShowInstrumentationLogList(
                            loggingViewData,
                            new LogIDPairEntity(minLogID, maxLogID),timeEntity,
                            condition);
                    }
                    else
                    {
                        IsAsyncWorking = false;
                        this.ButtonSearch.Text = "&Search";
                        _presenter.OnUpdateProgressBar(ProgressBarStatus.OnEnd);
                        ProgressCounter--;

                        AsyncWaiting(500);
                    }
                };
                worker.Run();
            }
        }
Ejemplo n.º 2
0
        private void PrepareShowInstrumentationList(DateTimeCompare timepair)
        {
            using (AsyncWorkerByTrunk<IInstrumentationView> worker = new AsyncWorkerByTrunk<IInstrumentationView>(_presenter, this.GridViewInstrumentation, new Control[] { ButtonSearch, ButtonClear }, true))
            {
                worker.DoWork += delegate(object oDoWork, DoWorkEventArgs eDoWork)
                {
                    eDoWork.Result = _presenter.GetLogIDRangeByLogTime(timepair);
                };
                worker.RunWorkerCompleted += delegate(object oCompleted, RunWorkerCompletedEventArgs eCompleted)
                {
                    LogIDPairEntity logIDPairEntity = eCompleted.Result as LogIDPairEntity;

                    GridViewInstrumentation.DataSource = new LoggingViewDataSet();
                    this.totalCount.Text = GridViewInstrumentation.Rows.Count.ToString();

                    if (logIDPairEntity != null && logIDPairEntity.MinLogID > 0)
                    {
                        // Step 1. Return Min LOG_ID and Max LOG_ID

                        _presenter.OnUpdateProgressBar(ProgressBarStatus.OnProcess);
                        ProgressCounter++;
                        this.ButtonSearch.Text = "&Stop";
                        IsAsyncWorking = true;

                        // Step 2. Recursive loading data according to LOG_ID and LOG_ID
                        InstrumentationSearchCondition condition = new InstrumentationSearchCondition();
                        condition.UserName = TextBoxUserName.Text;
                        condition.IpAddress = TextBoxIpAddress.Text;
                        condition.ModuleId = TextBoxModuleId.Text;
                        condition.FunctionId = TextBoxFunctionId.Text;
                        condition.ComponentName = ComboxComponentName.Value.ToString();
                        condition.PCName = PCName.Text;
                        ShowInstrumentationLogList(
                            new LoggingViewDataSet(),
                            logIDPairEntity,timepair,
                            condition);
                    }
                };
                worker.Run();
            }
        }