public IConstructionReturnMessage Activate(IConstructionCallMessage ctorCall) { ServerIdentity identity = RemotingServices.CreateContextBoundObjectIdentity(ctorCall.ActivationType); RemotingServices.SetMessageTargetIdentity(ctorCall, identity); ConstructionCall call = ctorCall as ConstructionCall; if (call == null || !call.IsContextOk) { identity.Context = Context.CreateNewContext(ctorCall); Context oldContext = Context.SwitchToContext(identity.Context); try { return(m_NextActivator.Activate(ctorCall)); } finally { Context.SwitchToContext(oldContext); } } else { return(m_NextActivator.Activate(ctorCall)); } }
public virtual void Activate(ActivationPurpose purpose) { if (_activator != null) { _activator.Activate(purpose); } }
// Messages will be intercepted here and redirected // to another object. public override IMessage Invoke(IMessage msg) { if (msg is IConstructionCallMessage) { IActivator remActivator = (IActivator)RemotingServices.Connect(typeof(IActivator), "tcp://localhost:1234/RemoteActivationService.rem"); IConstructionReturnMessage crm = remActivator.Activate((IConstructionCallMessage)msg); return(crm); } else { methodOverloaded = RemotingServices.IsMethodOverloaded((IMethodMessage)msg); _mthBase = RemotingServices.GetMethodBaseFromMethodMessage((IMethodMessage)msg); MethodCallMessageWrapper mcm = new MethodCallMessageWrapper((IMethodCallMessage)msg); mcm.Uri = RemotingServices.GetObjectUri((MarshalByRefObject)target); MarshalByRefObject objRem = (MarshalByRefObject)Activator.CreateInstance(GetProxiedType()); RemotingServices.ExecuteMessage((MarshalByRefObject)objRem, (IMethodCallMessage)msg); IMessage rtnMsg = null; try { rtnMsg = _sink.SyncProcessMessage(msg); } catch (Exception e) { Console.WriteLine(e.Message); } return(rtnMsg); } }
public IConstructionReturnMessage Activate(IConstructionCallMessage ctorCall) { IActivator activator = (IActivator)RemotingServices.Connect(typeof(IActivator), this._activationUrl); ctorCall.Activator = ctorCall.Activator.NextActivator; IConstructionReturnMessage constructionReturnMessage; try { constructionReturnMessage = activator.Activate(ctorCall); } catch (Exception e) { return(new ConstructionResponse(e, ctorCall)); } ObjRef objRef = (ObjRef)constructionReturnMessage.ReturnValue; if (RemotingServices.GetIdentityForUri(objRef.URI) != null) { throw new RemotingException("Inconsistent state during activation; there may be two proxies for the same object"); } object obj; Identity orCreateClientIdentity = RemotingServices.GetOrCreateClientIdentity(objRef, null, out obj); RemotingServices.SetMessageTargetIdentity(ctorCall, orCreateClientIdentity); return(constructionReturnMessage); }
protected override object GetInstance( IResolvingContext context, Type concreteType, IContainer fromContainer) { return(_activator.Activate(concreteType, fromContainer, context)); }
private IDisposable BindNavigation() { var model = _navigationActivator.Activate(ref _navigationController); Model.NavigationModel = model; return(model.WhenAnyValue(m => m.SelectedTabIndex) .Select(index => (ContentKind)index) .SubscribeOn(TaskPoolScheduler.Default) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(kind => { switch (kind) { case ContentKind.Settings: Model.ContentIndex = 1; InitSettings(); break; default: Model.ContentIndex = 0; InitMessenger(kind); break; } })); }
public object GetOrCreateInstance( Type concreteType, IActivator activator, IResolvingContext context, string registrationName) { if (!Monitor.TryEnter(_syncRoot, TimeSpan.FromSeconds(5))) { throw new InvalidOperationException("Potentially deadlock"); } try { if (HasInstance(concreteType, registrationName)) { return(GetInstance(concreteType, registrationName)); } else { var instance = activator.Activate(concreteType, _parent, context);; PutInstance(concreteType, instance, registrationName); return(instance); } } finally { Monitor.Exit(_syncRoot); } }
private async Task Activate(IActivator activator) { Hide(); await activator.Activate(); Close(); }
public void Activate(ActivationPurpose activationPurpose) { if (null != activator) { activator.Activate(activationPurpose); } }
public void Activate(Db4objects.Db4o.Activation.ActivationPurpose purpose) { if (_activator != null) { _activator.Activate(purpose); } }
public virtual void Activate(ActivationPurpose purpose) { if (_activator == null) { return; } _activator.Activate(purpose); }
public void Activate(ActivationPurpose purpose) { if (null == _activator) { return; } _activator.Activate(purpose); }
private void Update() { //Debug.Log(Vector3.Distance(transform.position, target.transform.position)); if (Vector3.Distance(transform.position, target.transform.position) <= distance) { activator.Activate(); } }
private IDisposable BindCatalog(Section section) { _catalogActivator.Deactivate(ref _catalogController); var model = _catalogActivator.Activate(section, ref _catalogController); Model.CatalogModel = model; return(Disposable.Empty); }
public void Start() { _activator.Activate(new IPackageInfo[0], _log); EventAggregator.SendMessage(new ServiceStarted { ActivatorTypeName = _activator.GetType().AssemblyQualifiedName }); Console.WriteLine("Started service " + _activator); }
private IDisposable BindEditor() { Model.EditorModel = EditorModel.Hidden(); return(SubscribeToTarget(target => { _editorActivator.Deactivate(ref _editorController); var model = _editorActivator.Activate(target, ref _editorController); Model.EditorModel = model; })); }
private void SetFinalStageButtonStatus() { if (Utilities.AllButtonsInactive(buttons)) { buttonActivator.Activate(); } else { buttonActivator.Deactivate(); } }
private void InitSettings() { var messengerModel = _messengerActivator.Deactivate(ref _messengerController); Model.MessengerModel = messengerModel; _settingsActivator.Deactivate(ref _settingsController); var settingsModel = _settingsActivator.Activate(ref _settingsController); Model.SettingsModel = settingsModel; }
private IDisposable BindInformer() { Model.InformerModel = InformerModel.Hidden(); return(SubscribeToTarget(target => { _informerActivator.Deactivate(ref _informerController); var model = _informerActivator.Activate(target, ref _informerController); Model.InformerModel = model; })); }
private void InitMessenger(ContentKind kind) { var section = (Section)kind; var settingsModel = _settingsActivator.Deactivate(ref _settingsController); Model.SettingsModel = settingsModel; _messengerActivator.Deactivate(ref _messengerController); var messengerModel = _messengerActivator.Activate(section, ref _messengerController); Model.MessengerModel = messengerModel; }
private void GoToWorkspacePage() { if (Model.WorkspaceModel == null) { var model = _workspaceActivator.Activate(ref _workspaceController); Model.WorkspaceModel = model; } Model.PageIndex = (int)Page.Workspace; _authenticationController?.Dispose(); Model.StartupModel = null; Model.AuthenticationModel = null; }
private void ActivatedCAO(IConstructionCallMessage ccm, string url) { // Connect to remote activation service. string rem = url + @"/RemoteActivationService.rem"; IActivator remActivator = (IActivator)RemotingServices.Connect(typeof(IActivator), rem); IConstructionReturnMessage crm = remActivator.Activate(ccm); // // The return message's ReturnValue property is the ObjRef for // the remote object. We need to unmarshal it into a local proxy // to which we forward messages. ObjRef objRef = (ObjRef)crm.ReturnValue; _targetTcp = (MarshalByRefObject)RemotingServices.Unmarshal(objRef); }
// Token: 0x06005BEC RID: 23532 RVA: 0x00141C28 File Offset: 0x0013FE28 internal static IConstructionReturnMessage DoRemoteActivation(IConstructionCallMessage ctorMsg) { IActivator activator = null; string url = (string)ctorMsg.Properties["Remote"]; try { activator = (IActivator)RemotingServices.Connect(typeof(IActivator), url); } catch (Exception arg) { throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Activation_ConnectFailed"), arg)); } ctorMsg.Properties.Remove("Remote"); return(activator.Activate(ctorMsg)); }
public TEntity BuildEntity(TRowResult input) { var target = _activator.Activate(); var accessor = ObjectAccessor.Create(target); var timestamps = new ConcurrentDictionary <string, long>(); ProcessMap(_map, accessor, input.Columns, timestamps); RowkeyProcessor.PopulateEntity(target, _map.RowKey, input.Row, accessor); if (target is ITimestamp ts) { ts.Set(new Dictionary <string, long>(timestamps)); } return(target); }
public double FeedForward(double[] inputs) { if (inputs.Length + 1 != this.weights.Length) { throw new ArgumentException("The wrong number of inputs has been used.", "inputs"); } double sum = 0; for (int i = 0; i < inputs.Length; i++) { sum += inputs[i] * weights[i]; } // Add bias term sum += weights.Last(); return(activator.Activate(sum)); }
public IConstructionReturnMessage Activate(IConstructionCallMessage ctorCall) { #if !DISABLE_REMOTING IConstructionReturnMessage response; // Create the object by calling the remote activation service IActivator remoteActivator = (IActivator)RemotingServices.Connect(typeof(IActivator), _activationUrl); ctorCall.Activator = ctorCall.Activator.NextActivator; try { response = remoteActivator.Activate(ctorCall); } catch (Exception ex) { return(new ConstructionResponse(ex, ctorCall)); } // Create the client identity for the remote object ObjRef objRef = (ObjRef)response.ReturnValue; if (RemotingServices.GetIdentityForUri(objRef.URI) != null) { throw new RemotingException("Inconsistent state during activation; there may be two proxies for the same object"); } object proxy; // We pass null for proxyType because we don't really to attach the identity // to a proxy, we already have one. Identity identity = RemotingServices.GetOrCreateClientIdentity(objRef, null, out proxy); RemotingServices.SetMessageTargetIdentity(ctorCall, identity); return(response); #else return(null); #endif }
public virtual void Activate(ActivationPurpose purpose) { _activator.Activate(purpose); _activated = true; }
public void Activate(ActivationPurpose purpose) { activator?.Activate(purpose); }