Пример #1
0
 // Async observable support
 // This is the most general RTD registration
 public static object Observe(string callerFunctionName, object callerParameters, ExcelObservableSource observableSource)
 {
     return(Observe(callerFunctionName, callerParameters, ExcelObservableOptions.None, observableSource));
 }
Пример #2
0
 // Async observable support
 // This is the most general RTD registration
 public static object Observe(string callerFunctionName, object callerParameters, ExcelObservableSource observableSource)
 {
     return(AsyncObservableImpl.ProcessObservable(callerFunctionName, callerParameters, observableSource));
 }
Пример #3
0
 // Async observable support
 // This is the most general RTD registration
 // TODO: This should not be called from a ThreadSafe function. Check...?
 public static object Observe(string callerFunctionName, object callerParameters, ExcelObservableSource observableSource)
 {
     return AsyncObservableImpl.ProcessObservable(callerFunctionName, callerParameters, observableSource);
 }
Пример #4
0
        // This is the most general RTD registration
        // This should not be called from a ThreadSafe function. Checked in the callers.
        public static object ProcessObservable(string functionName, object parameters, ExcelObservableSource getObservable)
        {
            if (!SynchronizationManager.IsInstalled)
            {
                throw new InvalidOperationException("ExcelAsyncUtil has not been initialized. This is an unexpected error.");
            }
            if (!ExcelDnaUtil.IsMainThread)
            {
                throw new InvalidOperationException("ExcelAsyncUtil.Run / ExcelAsyncUtil.Observe may not be called from a ThreadSafe function.");
            }

            // CONSIDER: Why not same problems with all RTD servers?
            AsyncCallInfo callInfo = new AsyncCallInfo(functionName, parameters);

            // Shortcut if already registered
            Guid id;

            if (_asyncCallIds.TryGetValue(callInfo, out id))
            {
                // Already registered.
                Debug.Print("AsyncObservableImpl GetValueIfRegistered - Found Id: {0}", id);
                AsyncObservableState state = _observableStates[id];
                object value;
                // The TryGetValue call here is a big deal - it eventually calls Excel's RTD function
                // (or not, it the observable is complete).
                // The return value of TryGetValue indicates the special array-call where RTD fails, which we ignore here.
                bool unused = state.TryGetValue(out value);
                return(value);
            }

            // Not registered before - actually register as a new Observable
            IExcelObservable observable = getObservable();

            return(RegisterObservable(callInfo, observable));
        }
Пример #5
0
 public override object Observe(string callerFunctionName, object callerParameters, ExcelObservableOptions options, ExcelObservableSource observableSource)
 {
     return(ExcelAsyncUtil.Observe(callerFunctionName, callerParameters, options, observableSource));
 }
        // This is the most general RTD registration
        // This should not be called from a ThreadSafe function. Checked in the callers.
        public static object ProcessObservable(string functionName, object parameters, ExcelObservableSource getObservable)
        {
            if (!SynchronizationManager.IsInstalled)
            {
                throw new InvalidOperationException("ExcelAsyncUtil has not been initialized. This is an unexpected error.");
            }
            if (!ExcelDnaUtil.IsMainThread)
            {
                throw new InvalidOperationException("ExcelAsyncUtil.Run / ExcelAsyncUtil.Observe may not be called from a ThreadSafe function.");
            }

            // CONSIDER: Why not same problems with all RTD servers?
            AsyncCallInfo callInfo = new AsyncCallInfo(functionName, parameters);

            // Shortcut if already registered
            object value;

            if (GetValueIfRegistered(callInfo, out value))
            {
                return(value);
            }

            // Actually register as a new Observable
            IExcelObservable observable = getObservable();

            return(RegisterObservable(callInfo, observable));
        }
Пример #7
0
        // This is the most general RTD registration
        // TODO: This should not be called from a ThreadSafe function. Check...?
        public static object ProcessObservable(string functionName, object parameters, ExcelObservableSource getObservable)
        {
            // TODO: Check here that registration has happened.
            // CONSIDER: Why not same problems with all RTD servers?

            AsyncCallInfo callInfo = new AsyncCallInfo(functionName, parameters);

            // Shortcut if already registered
            object value;

            if (GetValueIfRegistered(callInfo, out value))
            {
                return(value);
            }

            // Actually register as a new Observable
            IExcelObservable observable = getObservable();

            return(RegisterObservable(callInfo, observable));
        }
Пример #8
0
 public virtual object Observe(string callerFunctionName, object callerParameters, ExcelObservableOptions options, ExcelObservableSource observableSource)
 {
     throw new NotImplementedException();
 }
Пример #9
0
        // This is the most general RTD registration
        // TODO: This should not be called from a ThreadSafe function. Check...?
        public static object ProcessObservable(string functionName, object parameters, ExcelObservableSource getObservable)
        {
            // TODO: Check here that registration has happened.
            // CONSIDER: Why not same problems with all RTD servers?

            AsyncCallInfo callInfo = new AsyncCallInfo(functionName, parameters);

            // Shortcut if already registered
            object value;
            if (GetValueIfRegistered(callInfo, out value))
            {
                return value;
            }

            // Actually register as a new Observable
            IExcelObservable observable = getObservable();
            return RegisterObservable(callInfo, observable);
        }