public Node(IInvoker invoker, int weight) { this.invoker = invoker; this.weight = weight; this.effectiveWeight = weight; this.currentWeight = 0; }
protected async override Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { IInvoker invoker = JavaScope.GetJavaInvoker(context); var methodName = MethodName.Get(context) ?? throw new ArgumentNullException(Resources.MethodName); JavaObject javaObject = TargetObject.Get(context); string className = TargetType.Get(context); if (javaObject == null && string.IsNullOrWhiteSpace(className)) { throw new InvalidOperationException(Resources.InvokationObjectException); } List <object> parameters = GetParameters(context); var types = GetParameterTypes(context, parameters); JavaObject instance = null; try { instance = await invoker.InvokeMethod(methodName, className, javaObject, parameters, types, cancellationToken); } catch (Exception e) { Trace.TraceError($"The method could not be invoked: {e}"); throw new InvalidOperationException(Resources.InvokeMethodException, e); } return(asyncCodeActivityContext => { Result.Set(asyncCodeActivityContext, instance); }); }
public Client(Server server, IInvoker invoker) { Server = server; _receiver = this; _router = new Router(_receiver); _invoker = invoker; }
public void Setup() { iInvoker = new MockInvoker(); iWaitHandleInvoker = new AutoResetEvent(false); iPersistence = new MockPersistence { LastNotificationVersion = 0 }; iServer = new MockNotificationServer(); iNotificationVersion1 = new NotificationVersion() { Uri = "http://notifications/1", Version = 1 }; iNotificationVersion2 = new NotificationVersion() { Uri = "http://notifications/2", Version = 2 }; iServerResponseV1 = new NotificationServerResponse() { Notifications = new NotificationVersion[] { iNotificationVersion1 } }; iServerResponseV2 = new NotificationServerResponse() { Notifications = new NotificationVersion[] { iNotificationVersion1, iNotificationVersion2 } }; iView = new MockNotificationView(iInvoker); }
protected override async Task <Action <NativeActivityContext> > ExecuteAsync(NativeActivityContext context, CancellationToken ct) { string javaPath = JavaPath.Get(context); if (javaPath != null) { javaPath = Path.Combine(javaPath, "bin", "java.exe"); if (!File.Exists(javaPath)) { throw new ArgumentException(Resources.InvalidJavaPath, Resources.JavaPathDisplayName); } } _invoker = new JavaInvoker(javaPath); try { await _invoker.StartJavaService(); } catch (Exception e) { Trace.TraceError($"Error initializing Java Invoker: {e.ToString()}"); throw new InvalidOperationException(string.Format(Resources.JavaInitiazeException, e.ToString())); } ct.ThrowIfCancellationRequested(); return(ctx => { ctx.ScheduleAction(Body, _invoker, OnCompleted, OnFaulted); }); }
public override IExporter Export(IInvoker invoker) { var url = invoker.GetUrl(); var key = ServiceKey(url); var exporter = new DubboExporter(invoker, key, Exporters); Exporters.TryAdd(key, exporter); var isStubSupportEvent = url.GetParameter(Constants.StubEventKey, Constants.DefaultStubEvent); var isCallbackService = url.GetParameter(Constants.IsCallbackService, false); if (isStubSupportEvent && !isCallbackService) { var stubServiceMethods = url.GetParameter(Constants.StubEventMethodsKey, ""); if (string.IsNullOrEmpty(stubServiceMethods)) { if (Logger.WarnEnabled) { Logger.Warn(new Exception("consumer [" + url.GetParameter(Constants.InterfaceKey, "") + "], has set stubproxy support event ,but no stub methods founded.")); } } else { _stubServiceMethods.TryAdd(url.ServiceName, stubServiceMethods); } } OpenServer(url); OptimizeSerialization(url); return(exporter); }
public override IInvoker Refer(URL url) { OptimizeSerialization(url); var id = url.GetId(); var name = url.ServiceName; IInvoker invoker = null; lock (_invokers) { if (_invokers.TryGetValue(name, out var list)) { invoker = list.FirstOrDefault(c => c.InvokerId == id); if (invoker != null) { return(invoker); } } else { list = new List <IInvoker>(); _invokers.TryAdd(name, list); } var type = TypeMatch.MatchType(name); invoker = new DubboInvoker(type, url, GetClients(url), null); invoker.InvokerId = id; list.Add(invoker); } return(invoker); }
public InvokeBinder(D data, IInvoker dataInvoker, V view, IInvoker viewInvoker) { ViewInvoker = viewInvoker; View = view; DataInvoker = dataInvoker; Data = data; }
public static string GetCallInfo(this IInvoker aInvoker, System.Delegate aDelegate, object[] aArgs) { string targetString = string.Empty; string methodString = string.Empty; string argString = string.Empty; try { targetString = aDelegate.Target.ToString(); } catch { } try { methodString = aDelegate.Method.ToString(); } catch { } try { for (int i = 0; i < aArgs.Length; i++) { if (aArgs[i] != null) { argString += string.Format("{0}::{1}", aArgs[i].GetType().ToString(), aArgs[i].ToString()); } else { argString += "UNKNOWN::NULL"; } if (i < aArgs.Length - 1) { argString += ", "; } } } catch { } return(string.Format("{0}.{1}({2});", targetString, methodString, argString)); }
protected async override Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { IInvoker invoker = JavaScope.GetJavaInvoker(context); var fieldName = FieldName.Get(context) ?? throw new ArgumentNullException(Resources.FieldName); var javaObject = TargetObject.Get(context); var className = TargetType.Get(context); if (javaObject == null && className == null) { throw new InvalidOperationException(Resources.InvokationObjectException); } JavaObject instance; try { instance = await invoker.InvokeGetField(javaObject, fieldName, className, cancellationToken); } catch (Exception e) { Trace.TraceError($"Could not get java field: {e}"); throw new InvalidOperationException(Resources.GetFieldException, e); } return(asyncCodeActivityContext => { Result.Set(asyncCodeActivityContext, instance); }); }
public MultiViewSwitcher(IInvoker aInvoker, ViewGroup aHiddenContainer, ViewGroup aVisibleContainer, IList <View> aViews, View aInitialView, MultiViewPageIndicator aViewPageIndicator) : base() { iInvoker = aInvoker; iVisibleContainer = aVisibleContainer; iHiddenContainer = aHiddenContainer; iViewPageIndicator = aViewPageIndicator; iViewPageIndicator.EventPagePrevious += EventPagePreviousHandler; iViewPageIndicator.EventPageNext += EventPageNextHandler; iViews = aViews; iViewPageIndicator.Count = iViews.Count; iViewPageIndicator.SelectedIndex = aViews.IndexOf(aInitialView); iSwipeGestureDetector = new SwipeGestureDetector(iVisibleContainer.Context); iSwipeGestureDetector.EventSwipe += EventSwipeHandler; iGestureDetector = new GestureDetector(iSwipeGestureDetector); foreach (View v in iViews) { v.SetOnTouchListener(this); if (v != aInitialView) { iHiddenContainer.AddView(v); } else { iVisibleContainer.AddView(v); iCurrentView = v; } } }
public RuntimeController(IFunction function, ICompiler compiler, IInvoker invoker, IConfiguration configuration) { _function = function; _compiler = compiler; _invoker = invoker; _configuration = configuration; }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="xml"></param> /// <param name="catalog"></param> /// <param name="exports"></param> Document( Func <Document, XDocument> xml, ComposablePartCatalog catalog, ExportProvider exports) { Contract.Requires <ArgumentNullException>(xml != null); // configure composition this.configuration = GetConfiguration(catalog, exports); this.container = new CompositionContainer(configuration.HostCatalog, true, new CompositionContainer(configuration.GlobalCatalog, true, configuration.Exports)); this.container.GetExportedValue <DocumentEnvironment>().SetHost(this); // required services this.invoker = container.GetExportedValue <IInvoker>(); this.trace = container.GetExportedValue <ITraceService>(); // initialize xml this.xml = xml(this); this.xml.AddAnnotation(this); // parallel initialization of common interfaces Parallel.ForEach(this.xml.DescendantNodesAndSelf(), i => { Enumerable.Empty <object>() .Concat(i.Interfaces <IOnInit>()) .Concat(i.Interfaces <IOnLoad>()) .ToLinkedList(); }); // initial invocation entry this.invoker.Invoke(() => { }); }
protected override void Execute(CodeActivityContext context) { IInvoker invoker = JavaScope.GetJavaInvoker(context); var javaObject = JavaObject.Get(context) ?? throw new ArgumentNullException(Resources.JavaObject); Result.Set(context, javaObject.Convert <T>()); }
protected async override Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { IInvoker invoker = JavaScope.GetJavaInvoker(context); var className = TargetType.Get(context); if (string.IsNullOrWhiteSpace(className)) { throw new ArgumentNullException(nameof(TargetType)); } List <object> parameters = GetParameters(context); JavaObject instance = null; try { instance = await invoker.InvokeConstructor(className, parameters, parameters.Select(param => param?.GetType()).ToList(), cancellationToken); } catch (Exception e) { Trace.TraceError($"Constrcutor could not be invoker: {e.ToString()}"); throw new InvalidOperationException(Resources.ConstructorException, e); } return(asyncCodeActivityContext => { Result.Set(asyncCodeActivityContext, instance); }); }
public FrameworkFormEx() { Load += new EventHandler(FormEx_Load); m_invoker = new ControlInvoker(this); Usage = new UsageBuilder(UsageEventName); HUsage.ClosingApp += HUsage_ClosingApp; }
public SongcastMonitor(IInvoker aInvoker, Receiver[] aReceiverList) { iLock = new object(); iInvoker = aInvoker; iReceiverList = new List <Receiver>(aReceiverList); iSubnetList = new List <ISubnet>(); }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="xml"></param> /// <param name="catalog"></param> /// <param name="exports"></param> Document( Func<Document, XDocument> xml, ComposablePartCatalog catalog, ExportProvider exports) { Contract.Requires<ArgumentNullException>(xml != null); // configure composition this.configuration = GetConfiguration(catalog, exports); this.container = new CompositionContainer(configuration.HostCatalog, true, new CompositionContainer(configuration.GlobalCatalog, true, configuration.Exports)); this.container.GetExportedValue<DocumentEnvironment>().SetHost(this); // required services this.invoker = container.GetExportedValue<IInvoker>(); this.trace = container.GetExportedValue<ITraceService>(); // initialize xml this.xml = xml(this); this.xml.AddAnnotation(this); // parallel initialization of common interfaces Parallel.ForEach(this.xml.DescendantNodesAndSelf(), i => { Enumerable.Empty<object>() .Concat(i.Interfaces<IOnInit>()) .Concat(i.Interfaces<IOnLoad>()) .ToLinkedList(); }); // initial invocation entry this.invoker.Invoke(() => { }); }
public HelperKinsky(string[] aArgs, IInvoker aInvoker) : base(aArgs) { iInvoker = aInvoker; iEventServer = new EventServerUpnp(); iListenerNotify = new SsdpListenerMulticast(); IModelFactory factory = new ModelFactory(); iTopologyHouse = new Linn.Topology.House(iListenerNotify, iEventServer, factory); iSenders = new ModelSenders(iListenerNotify, iEventServer); iHouse = new House(iTopologyHouse, iInvoker, iSenders); OptionPage optionPage = new OptionPage("Startup Room"); iOptionStartupRoom = new OptionStartupRoom(iHouse); optionPage.Add(iOptionStartupRoom); AddOptionPage(optionPage); //optionPage = new OptionPage("Cloud Servers"); iOptionCloudServers = new OptionListUri("cloudservers", "Server locations", "List of locations for cloud media servers", new List <Uri>()); //optionPage.Add(iOptionCloudServers); //AddOptionPage(optionPage); iOptionLastSelectedRoom = new OptionString("lastroom", "Last Selected Room", "The last room selected", string.Empty); AddOption(iOptionLastSelectedRoom); iOptionLastLocation = new OptionBreadcrumbTrail("lastlocation", "Last Location", "The last location visited by the browser", BreadcrumbTrail.Default); AddOption(iOptionLastLocation); iBookmarkManager = new BookmarkManager(Path.Combine(DataPath.FullName, "Bookmarks.xml")); Stack.SetStack(this); }
public PaymentController(IInvoker invoker, IUnitOfWork unitOfWork, IMapper mapper, ILogger <PaymentController> logger) { _invoker = invoker; _unitOfWork = unitOfWork; _mapper = mapper; _logger = logger; }
public PartialApplication(Func <object[], object> target, params object[] suppliedArguments) : this((MulticastDelegate)target) { var customDelegate = target; _invoker = new DelegateInvoker(customDelegate); _suppliedArguments.AddRange(suppliedArguments); }
public SerialPortWatcher(IInvoker invoker, IOutputDevice output) : base(invoker, output) { foreach (var port in ComPort.GetComPorts()) { Devices.Add(port); } }
internal ToolTipFiring(NeuralNetworkVisualizerControl control, Control controlToToolTip, ISelectionResolver selectionResolver, IInvoker invoker) { _control = control; _controlToToolTip = controlToToolTip; _selectionResolver = selectionResolver; _invoker = invoker; lastToolTipLocation = new Position(0, 0); }
public OrderValidation(IRepositoryFactory <OrderEntity> orderFactory, string connectionString, Dispatcher dispatcher, ILogger logger, IInvoker invoker) { ConnString = connectionString; OrderRepository = orderFactory.CreateRepository(ConnString, "OrderRepository"); this.logger = logger; this.invoker = invoker; this.dispatcher = dispatcher; }
public static AsyncCallback CreateInvokeCallback(this IInvoker invoker, AsyncCallback callback) { return(delegate(IAsyncResult result) { IAsyncResult rtmp = invoker.BeginInvoke(callback, null, result); invoker.EndInvoke(rtmp); }); }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="element"></param> /// <param name="invoker"></param> internal UIBinding(XElement element, IInvoker invoker, ModelItem modelItem) : this(element, invoker) { Contract.Requires <ArgumentNullException>(element != null); Contract.Requires <ArgumentNullException>(invoker != null); this.modelItem = modelItem; }
private void TestProperty(IInvoker <TestClass, int> invoker, [CallerMemberName] string name = null) { var x = invoker.GetValue(testReference); Assert.AreEqual(value, x, $"{name} Fail Get Operation"); invoker.SetValue(testReference, x + 1); Assert.AreEqual(value + 1, invoker.GetValue(testReference), $"{name} Fail Set Operation"); }
private void TestInlineProperty(IInvoker <TestClass, int> invoker, [CallerMemberName] string name = null) { var width = invoker.GetValue(testReference); Assert.AreEqual(value, width, $"{name} Fail Get Operation"); invoker.SetValue(testReference, width + 1); Assert.AreEqual(value + 1, testReference.Group.Struct.Width, $"{name} Fail Set Operation"); }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="element"></param> /// <param name="invoker"></param> internal UIBinding(XElement element, IInvoker invoker, ModelItem modelItem) : this(element, invoker) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(invoker != null); this.modelItem = modelItem; }
public AndroidImageCache(int aMaxSize, int aDownscaleImageSize, int aThreadCount, IImageLoader <Bitmap> aImageLoader, IInvoker aInvoker, FlingStateManager aFlingStateManager, int aPendingRequestLimit) : base(aMaxSize, aDownscaleImageSize, aThreadCount, aImageLoader, aPendingRequestLimit) { Assert.Check(aInvoker != null); iInvoker = aInvoker; iFlingStateManager = aFlingStateManager; iFlingStateManager.EventFlingStateChanged += EventFlingStateChangedHandler; }
public void Setup() { _invoker = new TestInvoker(); _configuration = new TestConfigurationService(); _configuration.Setup("http://playground.tesonet.lt/v1/", "tokens", "servers"); _authentification = new AuthentificationService(_configuration, _invoker); _cancellationTokenSource = new CancellationTokenSource(); }
public ControlDrawing(IControlCanvas controlCanvas, IElementSelectionChecker selectionChecker, ISelectableElementRegister selectableElementRegister, ISelectionResolver selectionResolver, IInvoker invoker) { this.ControlCanvas = controlCanvas; _selectionChecker = selectionChecker; _selectableElementRegister = selectableElementRegister; _selectionResolver = selectionResolver; _invoker = invoker; }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="element"></param> /// <param name="invoker"></param> public UIBinding(XElement element, IInvoker invoker) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(invoker != null); this.element = element; this.invoker = invoker; this.state = new Lazy<UIBindingState>(() => element.AnnotationOrCreate<UIBindingState>()); }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="element"></param> /// <param name="invoker"></param> /// <param name="binding"></param> internal UIBinding(XElement element, IInvoker invoker, Binding binding) : this(element, invoker,binding.ModelItem) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(invoker != null); Contract.Requires<ArgumentNullException>(binding != null); this.binding = binding; }
public UIBindingNode(XElement element, IInvoker invoker) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(invoker != null); this.invoker = invoker; this.uiBinding = new Lazy<UIBinding>(() => CreateUIBinding()); }
public override void Add(IInvoker targetInvoker, EventHandler handlerFunction, object handlerHost) { if (handlerHost is Activity) { base.Add (targetInvoker, (object sender, EventArgs e) => ((Activity)handlerHost).RunOnUiThread (() => handlerFunction (sender, e)), handlerHost); } else if (handlerHost is Fragment) { base.Add (targetInvoker, (object sender, EventArgs e) => ((Fragment)handlerHost).Activity.RunOnUiThread (() => handlerFunction (sender, e)), handlerHost); } else { base.Add (targetInvoker, handlerFunction, handlerHost); } }
public void Add(IInvoker targetInvoker, EventHandler handlerFunction) { if (!IsInvokerMapped (targetInvoker)) { Map [targetInvoker] = new List<EventHandler> (); } if (!InvokerHasHandler (targetInvoker, handlerFunction)) { Map [targetInvoker].Add (handlerFunction); targetInvoker.Invoked += handlerFunction; } }
internal FunctionController( CloudStorageAccount account, IFunctionLookup functionLookup, IFunctionInstanceLookup functionInstanceLookup, IHeartbeatValidityMonitor heartbeatMonitor, IInvoker invoker) { _account = account; _functionLookup = functionLookup; _functionInstanceLookup = functionInstanceLookup; _heartbeatMonitor = heartbeatMonitor; _invoker = invoker; }
public ElementEventListener( XElement element, EventListenerAttributes attributes, IInvoker invoker) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(attributes != null); Contract.Requires<ArgumentNullException>(invoker != null); this.invoker = invoker; this.attributes = attributes; this.handler = new Lazy<IEventHandler>(() => GetHandler()); this.observer = new Lazy<EventTarget>(() => GetObserver()); }
public override void Add(IInvoker targetInvoker, EventHandler handlerFunction, object handlerHost) { if (handlerHost is UIViewController) { base.Add(targetInvoker, (object sender, EventArgs e) => ((UIViewController)handlerHost).InvokeOnMainThread(() => handlerFunction(sender, e)), handlerHost); } else if (handlerHost is UIView) { base.Add(targetInvoker, (object sender, EventArgs e) => ((UIView)handlerHost).InvokeOnMainThread(() => handlerFunction(sender, e)), handlerHost); } else { base.Add(targetInvoker, handlerFunction, handlerHost); } }
public EventTarget( XNode node, IEventFactory events, ITraceService trace, IInvoker invoker) : base(node) { Contract.Requires<ArgumentNullException>(node != null); Contract.Requires<ArgumentNullException>(events != null); Contract.Requires<ArgumentNullException>(trace != null); Contract.Requires<ArgumentNullException>(invoker != null); this.node = node; this.events = events; this.trace = trace; this.invoker = invoker; this.state = node.AnnotationOrCreate<EventTargetState>(); }
public InvokerWrapper(IInvoker invoker, IInvokeFilter[] filters, ResultHandler resultHandler = null) { _invoker = invoker; _filters = filters; _resultHandler = resultHandler ?? SeifApplication.AppEnv.GlobalConfiguration.ConsumerConfiguration.GetResultHandler(); }
public Watcher(FileWithPosition file, LogEntryParser parser = null, IInvoker invoker = null) : base(file,parser,invoker) { }
public LogFileReaderBase(FileWithPosition file, LogEntryParser parser = null, IInvoker invoker = null) { this.File = file; this.parser = parser ?? new LogEntryParser(); this.invoker = invoker ?? new DirectInvoker(); }
public bool IsInvokerMapped(IInvoker targetInvoker) { return Map.ContainsKey (targetInvoker); }
public Poller(FileWithPosition file, long duration, LogEntryParser parser = null, IInvoker invoker = null) : base(file,parser,invoker) { this.duration = duration; }
public bool InvokerHasHandler(IInvoker targetInvoker, EventHandler handlerFunction) { return (IsInvokerMapped(targetInvoker) && Map [targetInvoker].Contains (handlerFunction)); }
/// <summary> /// Initializes a new instance of the <see cref="T:System.Object"/> class. /// </summary> public InterfaceCall() { _instanceOne = new MyClass(); _instanceTwo = new MyAnotherClass(); }
public HomeController(IInvoker invoker) { this.invoker = invoker; }
public MockProgress(IInvoker invoker) { this.invoker = invoker; }
public HomeController(IInvoker invoker) { _invoker = invoker; }
public AccountController(IInvoker invoker) { this.invoker = invoker; }
public static MockProgress getProgress(IInvoker invoker) { return new MockProgress(invoker); }