Beispiel #1
0
        // This method is called on a worker thread (via asynchronous
        // delegate invocation).  This is where we call the operation (as
        // defined in the deriving class's DoWork method).
        public void InternalStart()
        {
            // isRunning is set during Start to avoid a race condition
            try
            {
                PrintMessage("Generating Graph....");
                BuildCompleteGraph();

                // When a cancel occurs, the recursive DoSearch drops back
                // here asap, so we'd better acknowledge cancellation.
                if (CancelRequested)
                {
                    PrintMessage("Cancelling...");
                    SimulatorViewer.Graph = intGraph;
                    AcknowledgeCancel();
                }
                else
                {
                    PrintMessage("Rendering Graph...");
                    SimulatorViewer.Graph = graph;
                    OnReturnResult();
                }
            }
            catch (CancelRunningException)
            {
                AcknowledgeCancel();
            }
            catch (Exception e)
            {
                // Raise the Failed event.  We're in a catch handler, so we
                // had better try not to throw another exception.
                try
                {
                    if (e is System.OutOfMemoryException)
                    {
                        e = new PAT.Common.Classes.Expressions.ExpressionClass.OutOfMemoryException("");
                    }
                    SimulatorViewer.Graph = intGraph;
                    FailOperation(e);
                }
                catch
                {
                }

                // The documentation recommends not catching
                // SystemExceptions, so having notified the caller we
                // rethrow if it was one of them.
                if (e is SystemException)
                {
                    throw;
                }
            }


            lock (this)
            {
                // If the operation wasn't cancelled (or if the UI thread
                // tried to cancel it, but the method ran to completion
                // anyway before noticing the cancellation) and it
                // didn't fail with an exception, then we complete the
                // operation - if the UI thread was blocked waiting for
                // cancellation to complete it will be unblocked, and
                // the Completion event will be raised.
                if (!cancelAcknowledgedFlag && !failedFlag)
                {
                    CompleteOperation();
                }
            }
        }
Beispiel #2
0
        // This method is called on a worker thread (via asynchronous
        // delegate invocation).  This is where we call the operation (as
        // defined in the deriving class's DoWork method).
        public void InternalStart()
        {
            // isRunning is set during Start to avoid a race condition
            try
            {

                PrintMessage("Generating Graph....");
                BuildCompleteGraph();

                // When a cancel occurs, the recursive DoSearch drops back
                // here asap, so we'd better acknowledge cancellation.
                if (CancelRequested)
                {
                    PrintMessage("Cancelling...");
                    SimulatorViewer.Graph = intGraph;
                    AcknowledgeCancel();
                }
                else
                {
                    PrintMessage("Rendering Graph...");
                    SimulatorViewer.Graph = graph;
                    OnReturnResult();
                }
            }
            catch (CancelRunningException)
            {
                AcknowledgeCancel();
            }
            catch (Exception e)
            {
                // Raise the Failed event.  We're in a catch handler, so we
                // had better try not to throw another exception.
                try
                {
                    if (e is System.OutOfMemoryException)
                    {
                        e = new PAT.Common.Classes.Expressions.ExpressionClass.OutOfMemoryException("");
                    }
                    SimulatorViewer.Graph = intGraph;
                    FailOperation(e);
                }
                catch
                {
                }

                // The documentation recommends not catching
                // SystemExceptions, so having notified the caller we
                // rethrow if it was one of them.
                if (e is SystemException)
                {
                    throw;
                }
            }

            lock (this)
            {
                // If the operation wasn't cancelled (or if the UI thread
                // tried to cancel it, but the method ran to completion
                // anyway before noticing the cancellation) and it
                // didn't fail with an exception, then we complete the
                // operation - if the UI thread was blocked waiting for
                // cancellation to complete it will be unblocked, and
                // the Completion event will be raised.
                if (!cancelAcknowledgedFlag && !failedFlag)
                {
                    CompleteOperation();
                }
            }
        }
        // This method is called on a worker thread (via asynchronous
        // delegate invocation).  This is where we call the operation (as
        // defined in the deriving class's DoWork method).
        public void InternalStart()
        {
            // isRunning is set during Start to avoid a race condition
            try
            {
                try
                {
#if ACADEMIC
                    HasUpdate = UpdateManager.IsUpdateAvailable(Common.Ultility.Ultility.PUBLISH_URL);
#else
                    HasUpdate = UpdateManager.IsUpdateAvailable(Common.Ultility.Ultility.PUBLISH_URL_COM);
#endif
                }
                catch (Exception ex)
                {
                }

                // When a cancel occurs, the recursive DoSearch drops back
                // here asap, so we'd better acknowledge cancellation.
                if (CancelRequested)
                {
                    AcknowledgeCancel();
                }
                else
                {
                    OnReturnResult();
                }
            }
            catch (CancelRunningException)
            {
                AcknowledgeCancel();
            }
            catch (Exception e)
            {
                // Raise the Failed event.  We're in a catch handler, so we
                // had better try not to throw another exception.
                try
                {
                    if (e is System.OutOfMemoryException)
                    {
                        e = new PAT.Common.Classes.Expressions.ExpressionClass.OutOfMemoryException("");
                    }

                    FailOperation(e);
                }
                catch
                {
                }

                // The documentation recommends not catching
                // SystemExceptions, so having notified the caller we
                // rethrow if it was one of them.
                if (e is SystemException)
                {
                    throw;
                }
            }


            lock (this)
            {
                // If the operation wasn't cancelled (or if the UI thread
                // tried to cancel it, but the method ran to completion
                // anyway before noticing the cancellation) and it
                // didn't fail with an exception, then we complete the
                // operation - if the UI thread was blocked waiting for
                // cancellation to complete it will be unblocked, and
                // the Completion event will be raised.
                if (!cancelAcknowledgedFlag && !failedFlag)
                {
                    CompleteOperation();
                }
            }
        }