예제 #1
0
        public T execute <T>(Func <T> callback)
        {
            object returnData        = null;
            var    executionComplete = new AutoResetEvent(false);

            IEThread.invoke(
                () => {
                try
                {
                    returnData = callback();
                }
                catch (Exception ex)
                {
                    ex.log("in WatiN_IE execute<T>");
                }
                executionComplete.Set();
            });
            if (executionComplete.WaitOne(maxExecutionWaitTime).isFalse())
            {
                "in WatiN_IE executeOnThread, maxExecutionWaitTime ({0} ms} was reached for action".error(maxExecutionWaitTime);
            }

            if (returnData is T)
            {
                return((T)returnData);
            }

            return(default(T));
        }
예제 #2
0
        public WatiN_IE execute(MethodInvoker callback)
        {
            var executionComplete = new AutoResetEvent(false);

            IEThread.invoke(
                () => {
                try
                {
                    callback();
                }
                catch (Exception ex)
                {
                    ex.log("in WatiN_IE execute");
                }
                executionComplete.Set();
            });
            if (executionComplete.WaitOne(maxExecutionWaitTime).isFalse())
            {
                "in WatiN_IE executeOnThread, maxExecutionWaitTime ({0} ms} was reached for action".error(maxExecutionWaitTime);
            }
            return(this);
        }