public ProfilerFilter(WorkContext workContext, IAuthorizer authorizer, IShapeFactory shapeFactory, IProfilerService profiler)
 {
     this.workContext = workContext;
     this.shapeFactory = shapeFactory;
     this.authorizer = authorizer;
     this.profiler = profiler;
 }
Exemple #2
0
 public ProfiledOrchardEventBus(IIndex <string, IEnumerable <IEventHandler> > eventHandlers, IExceptionPolicy exceptionPolicy, IProfilerService profiler)
 {
     _eventHandlers   = eventHandlers;
     _exceptionPolicy = exceptionPolicy;
     _profiler        = profiler;
     T = NullLocalizer.Instance;
 }
 public ProfilerFilter(WorkContext workContext, IAuthorizer authorizer, IShapeFactory shapeFactory, IProfilerService profiler)
 {
     this.workContext  = workContext;
     this.shapeFactory = shapeFactory;
     this.authorizer   = authorizer;
     this.profiler     = profiler;
 }
 public ProfilingContentPartDriverCoordinator(IEnumerable <IContentPartDriver> drivers, IContentDefinitionManager contentDefinitionManager, IProfilerService profiler)
 {
     _drivers = drivers;
     _contentDefinitionManager = contentDefinitionManager;
     Logger    = NullLogger.Instance;
     _profiler = profiler;
 }
 public TeamSetupViewModel(IMatchViewModel matchViewModel, IDialogService dialogService, INavigationService navigationService, IProfilerService profilerService)
 {
     MatchViewModel      = matchViewModel;
     m_dialogService     = dialogService;
     m_navigationService = navigationService;
     m_profilerService   = profilerService;
     StartCommand        = new AsyncCommand(_ => NavigateToMatch(), _ => Players.Any(p => p.IsPlaying));
     AddPlayerCommand    = new Command(AddPlayerOrPlayers, () => !string.IsNullOrEmpty(NewPlayerName));
     Players             = new ObservableCollection <PlayerViewModel>();
 }
 private static bool TryInvoke(IEventHandler eventHandler, string interfaceName, string methodName, IDictionary<string, object> arguments, out IEnumerable returnValue, IProfilerService profiler) {
     Type type = eventHandler.GetType();
         foreach (var interfaceType in type.GetInterfaces()) {
             if (String.Equals(interfaceType.Name, interfaceName, StringComparison.OrdinalIgnoreCase)) {
                 return TryInvokeMethod(eventHandler, interfaceType, methodName, arguments, out returnValue, profiler);
             }
         }
         returnValue = null;
         return false;
     }
        public ProfilerIpcClient(string endpointAddress)
        {
            DuplexChannelFactory <IProfilerService> factory = new DuplexChannelFactory <IProfilerService>(
                new InstanceContext(this),
                new NetNamedPipeBinding(),
                new EndpointAddress(endpointAddress));

            this.service = factory.CreateChannel();
            this.service.RegisterClient(Process.GetCurrentProcess().Id);
        }
 public PlayerViewModel(Player player, IHandleTeamSetup teamSetupHandler, IHandleMatch matchHandler, IDialogService dialogService,
                        IProfilerService profilerService)
 {
     m_player                     = player;
     m_teamSetupHandler           = teamSetupHandler;
     m_matchHandler               = matchHandler;
     m_dialogService              = dialogService;
     m_profilerService            = profilerService;
     DeletePlayerCommand          = new Command(_ => m_teamSetupHandler?.OnPlayerDeleted(this));
     OpenInformationCommand       = new AsyncCommand(_ => OpenInformation());
     MarkedForSubstitutionCommand = new Command(MarkForSubstitution);
 }
Exemple #9
0
        public ItemsViewModel(IProfilerService profilerService)
        {
            _profilerService = profilerService;

            Title            = "Browse";
            Items            = new ObservableCollection <Item>();
            LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand());

            MessagingCenter.Subscribe <NewItemPage, Item>(this, "AddItem", async(obj, item) =>
            {
                var newItem = item as Item;
                Items.Add(newItem);
                await DataStore.AddItemAsync(newItem);
            });
        }
        public ProfilingContentDisplay(
            Lazy <IEnumerable <IContentHandler> > handlers,
            IShapeFactory shapeFactory,
            Lazy <IShapeTableLocator> shapeTableLocator,
            RequestContext requestContext,
            IVirtualPathProvider virtualPathProvider,
            IWorkContextAccessor workContextAccessor,
            IProfilerService profiler)
        {
            _innerContentDisplay = new DefaultContentDisplay(
                handlers,
                shapeFactory,
                shapeTableLocator,
                requestContext,
                virtualPathProvider,
                workContextAccessor);

            _profiler = profiler;
        }
        public ProfilingContentDisplay(
            Lazy<IEnumerable<IContentHandler>> handlers,
            IShapeFactory shapeFactory,
            Lazy<IShapeTableLocator> shapeTableLocator, 
            RequestContext requestContext,
            IVirtualPathProvider virtualPathProvider,
            IWorkContextAccessor workContextAccessor,
            IProfilerService profiler)
        {

            _innerContentDisplay = new DefaultContentDisplay(
                handlers,
                shapeFactory,
                shapeTableLocator,
                requestContext,
                virtualPathProvider,
                workContextAccessor);

            _profiler = profiler;
        }
 public DefaultOrchardEventBus(Func<IEnumerable<IEventHandler>> eventHandlers, IExceptionPolicy exceptionPolicy, IProfilerService profiler) {
         _eventHandlers = eventHandlers;
         _exceptionPolicy = exceptionPolicy;
         _profiler = profiler;
         T = NullLocalizer.Instance;
     }
Exemple #13
0
        private static bool TryInvokeMethod(IEventHandler eventHandler, Type interfaceType, string messageName, string interfaceName, string methodName, IDictionary <string, object> arguments, out IEnumerable returnValue, IProfilerService profiler)
        {
            var key            = eventHandler.GetType().FullName + "_" + messageName + "_" + String.Join("_", arguments.Keys);
            var cachedDelegate = _delegateCache.GetOrAdd(key, k => {
                var method = GetMatchingMethod(eventHandler, interfaceType, methodName, arguments);
                return(method != null
                    ? Tuple.Create(method.GetParameters(), DelegateHelper.CreateDelegate <IEventHandler>(eventHandler.GetType(), method))
                    : null);
            });

            if (cachedDelegate != null)
            {
                var args   = cachedDelegate.Item1.Select(methodParameter => arguments[methodParameter.Name]).ToArray();
                var result = cachedDelegate.Item2(eventHandler, args);

                returnValue = result as IEnumerable;
                if (result != null && (returnValue == null || result is string))
                {
                    returnValue = new[] { result }
                }
                ;
                return(true);
            }

            returnValue = null;
            return(false);
        }
Exemple #14
0
        private static bool TryInvoke(IEventHandler eventHandler, string messageName, string interfaceName, string methodName, IDictionary <string, object> arguments, out IEnumerable returnValue, IProfilerService profiler)
        {
            var matchingInterface = eventHandler.GetType().GetInterface(interfaceName);

            return(TryInvokeMethod(eventHandler, matchingInterface, messageName, interfaceName, methodName, arguments, out returnValue, profiler));
        }
Exemple #15
0
        private bool TryNotifyHandler(IEventHandler eventHandler, string messageName, string interfaceName, string methodName, IDictionary <string, object> eventData, out IEnumerable returnValue, IProfilerService profiler)
        {
            try {
                return(TryInvoke(eventHandler, messageName, interfaceName, methodName, eventData, out returnValue, profiler));
            }
            catch (Exception exception) {
                if (!_exceptionPolicy.HandleException(this, exception))
                {
                    throw;
                }

                returnValue = null;
                return(false);
            }
        }
Exemple #16
0
 public DialogService(IProfilerService profilerService)
 {
     m_profilerService = profilerService;
 }
 protected override void Awake()
 {
     base.Awake();
     _profilerService = SRServiceManager.GetService<IProfilerService>();
 }
Exemple #18
0
 public ShapeProfiling(IProfilerService profiler)
 {
     this.profiler = profiler;
 }
        private static bool TryInvokeMethod(IEventHandler eventHandler, Type interfaceType, string methodName, IDictionary<string, object> arguments, out IEnumerable returnValue, IProfilerService profiler) {
            MethodInfo method = _interfaceMethodsCache.GetOrAdd(String.Concat(eventHandler.GetType().Name + "_" + interfaceType.Name, "_", methodName, "_", String.Join("_", arguments.Keys)), GetMatchingMethod(eventHandler, interfaceType, methodName, arguments));

                if (method != null) {
                    var parameters = new List<object>();
                    foreach (var methodParameter in method.GetParameters()) {
                        parameters.Add(arguments[methodParameter.Name]);
                    }
                    var key= "EventBus:"+eventHandler.GetType().FullName +"."+ methodName;
                    profiler.StepStart(key,String.Format("EventBus: {0}",eventHandler.GetType().FullName +"."+ methodName),true);
                    var result = method.Invoke(eventHandler, parameters.ToArray());
                    profiler.StepStop(key);
                    returnValue = result as IEnumerable;
                    if (returnValue == null && result != null)
                        returnValue = new[] { result };
                    return true;
                }
                returnValue = null;
                return false;
            }
 public TestCompositePerfViewModel(IProfilerService profilerService)
 {
     _profilerService = profilerService;
 }
 public ShapeProfiling(IProfilerService profiler)
 {
     this.profiler = profiler;
 }
Exemple #22
0
 public NavigationService(IDialogService dialogService, IProfilerService profilerService)
 {
     m_dialogService      = dialogService;
     m_profilerService    = profilerService;
     m_navigationRegister = new Dictionary <IViewModel, Page>();
 }
 protected override void Awake()
 {
     base.Awake();
     _profilerService = SRServiceManager.GetService <IProfilerService>();
 }
Exemple #24
0
 public MainViewModel(IProfilerService profilerService)
 {
     _profilerService = profilerService;
 }
 public ProfilingContentPartDriverCoordinator(IEnumerable<IContentPartDriver> drivers, IContentDefinitionManager contentDefinitionManager, IProfilerService profiler) {
     _drivers = drivers;
     _contentDefinitionManager = contentDefinitionManager;
     Logger = NullLogger.Instance;
     _profiler = profiler;
 }