コード例 #1
0
        BackgroundWorker_DoWork
        (
            object sender,
            DoWorkEventArgs e
        )
        {
            AssertValid();

            Debug.Assert(e.Argument is ProcessGraphMLFilesAsyncArgs);

            ProcessGraphMLFilesAsyncArgs processGraphMLFilesAsyncArgs =
                (ProcessGraphMLFilesAsyncArgs)e.Argument;

            ProcessGraphMLFilesInternal(processGraphMLFilesAsyncArgs,
                                        m_BackgroundWorker, e);
        }
コード例 #2
0
        ProcessGraphMLFilesInternal
        (
            ProcessGraphMLFilesAsyncArgs processGraphMLFilesAsyncArgs,
            BackgroundWorker backgroundWorker,
            DoWorkEventArgs doWorkEventArgs
        )
        {
            Debug.Assert(processGraphMLFilesAsyncArgs != null);
            Debug.Assert(backgroundWorker != null);
            Debug.Assert(doWorkEventArgs != null);
            AssertValid();

            while (true)
            {
                ProcessGraphMLFilesRecursive(
                    processGraphMLFilesAsyncArgs.GraphMLFolderPath,
                    backgroundWorker);

                Int32 sleepPeriodSeconds =
                    Properties.Settings.Default.SleepPeriodSeconds;

                ReportProgress(backgroundWorker,

                               String.Format(
                                   "{0} {1} seconds."
                                   ,
                                   PausingMessagePrefix,
                                   sleepPeriodSeconds
                                   ));

                while (sleepPeriodSeconds > 0)
                {
                    if (backgroundWorker.CancellationPending)
                    {
                        doWorkEventArgs.Cancel = true;
                        return;
                    }

                    Thread.Sleep(1000);
                    sleepPeriodSeconds--;
                }
            }
        }
コード例 #3
0
        ProcessGraphMLFilesAsync
        (
            String graphMLFolderPath
        )
        {
            Debug.Assert(!String.IsNullOrEmpty(graphMLFolderPath));
            AssertValid();

            if (this.IsBusy)
            {
                throw new InvalidOperationException(
                          "An asynchronous operation is already in progress."
                          );
            }

            ProcessGraphMLFilesAsyncArgs processGraphMLFilesAsyncArgs =
                new ProcessGraphMLFilesAsyncArgs();

            processGraphMLFilesAsyncArgs.GraphMLFolderPath = graphMLFolderPath;

            m_BackgroundWorker = CreateBackgroundWorker();
            m_BackgroundWorker.RunWorkerAsync(processGraphMLFilesAsyncArgs);
        }
コード例 #4
0
    ProcessGraphMLFilesInternal
    (
        ProcessGraphMLFilesAsyncArgs processGraphMLFilesAsyncArgs,
        BackgroundWorker backgroundWorker,
        DoWorkEventArgs doWorkEventArgs
    )
    {
        Debug.Assert(processGraphMLFilesAsyncArgs != null);
        Debug.Assert(backgroundWorker != null);
        Debug.Assert(doWorkEventArgs != null);
        AssertValid();

        while (true)
        {
            ProcessGraphMLFilesRecursive(
                processGraphMLFilesAsyncArgs.GraphMLFolderPath,
                backgroundWorker);

            Int32 sleepPeriodSeconds =
                Properties.Settings.Default.SleepPeriodSeconds;

            ReportProgress(backgroundWorker,

                String.Format(
                    "{0} {1} seconds."
                    ,
                    PausingMessagePrefix,
                    sleepPeriodSeconds
                    ) );

            while (sleepPeriodSeconds > 0)
            {
                if (backgroundWorker.CancellationPending)
                {
                    doWorkEventArgs.Cancel = true;
                    return;
                }

                Thread.Sleep(1000);
                sleepPeriodSeconds--;
            }
        }
    }
コード例 #5
0
    ProcessGraphMLFilesAsync
    (
        String graphMLFolderPath
    )
    {
        Debug.Assert( !String.IsNullOrEmpty(graphMLFolderPath) );
        AssertValid();

        if (this.IsBusy)
        {
            throw new InvalidOperationException(
                "An asynchronous operation is already in progress."
                );
        }

        ProcessGraphMLFilesAsyncArgs processGraphMLFilesAsyncArgs =
            new ProcessGraphMLFilesAsyncArgs();

        processGraphMLFilesAsyncArgs.GraphMLFolderPath = graphMLFolderPath;

        m_BackgroundWorker = CreateBackgroundWorker();
        m_BackgroundWorker.RunWorkerAsync(processGraphMLFilesAsyncArgs);
    }