static bool GetValueIfRegistered(AsyncCallInfo callInfo, out object value) { Guid id; if (_asyncCallIds.TryGetValue(callInfo, out id)) { // Already registered. AsyncObservableState state = _observableStates[id]; value = state.GetValue(); return(true); } value = null; return(false); }
// Register a new observable static object RegisterObservable(AsyncCallInfo callInfo, IExcelObservable observable) { // Check it's not registered already Debug.Assert(!_asyncCallIds.ContainsKey(callInfo)); // Set up a new Id and ObservableState and keep track of things Guid id = Guid.NewGuid(); _asyncCallIds[callInfo] = id; AsyncObservableState state = new AsyncObservableState(id, callInfo, observable); _observableStates[id] = state; // Will spin up RTD server and topic if required, causing us to be called again... return(state.GetValue()); }
// Register a new observable static object RegisterObservable(AsyncCallInfo callInfo, IExcelObservable observable) { // Check it's not registered already Debug.Assert(!_asyncCallIds.ContainsKey(callInfo)); // Set up ObservableState and keep track of things // Caller might be null if not from worksheet ExcelReference caller = XlCall.Excel(XlCall.xlfCaller) as ExcelReference; Guid id = Guid.NewGuid(); _asyncCallIds[callInfo] = id; AsyncObservableState state = new AsyncObservableState(id, callInfo, caller, observable); _observableStates[id] = state; // Will spin up RTD server and topic if required, causing us to be called again... return(state.GetValue()); }
// Register a new observable static object RegisterObservable(AsyncCallInfo callInfo, IExcelObservable observable) { // Check it's not registered already Debug.Assert(!_asyncCallIds.ContainsKey(callInfo)); // Set up a new Id and ObservableState and keep track of things Guid id = Guid.NewGuid(); _asyncCallIds[callInfo] = id; AsyncObservableState state = new AsyncObservableState(id, callInfo, observable); _observableStates[id] = state; // Will spin up RTD server and topic if required, causing us to be called again... return state.GetValue(); }