Пример #1
0
 public GridFsBlobStore(MongoDatabase database, ICounterService counterService)
 {
     _database       = database;
     _counterService = counterService;
     LoadFormatsFromDatabase();
     Logger = NullLogger.Instance;
 }
        public GridFsBlobStore(MongoDatabase database, ICounterService counterService)
        {
            _database = database;
            _counterService = counterService;

            LoadFormatsFromDatabase();
        }
Пример #3
0
        public MainWindowViewModel(ICounterService counterService)
        {
            Model           = new Counter(0);
            _counterService = counterService;

            ResetCounter = new DelegateCommand(ExecuteResetCounter, CanExecuteResetCounter);
        }
Пример #4
0
 public HelloController(EgitimDbContext db, ICounterService _counterService, ITicket ticket, IOptions <MusteriOptions> options)
 {
     _db     = db;
     _ticket = ticket;
     this._counterService = _counterService;
     MusteriOptions       = options.Value;
 }
Пример #5
0
 public ChecklistFragment(IEventService eventService, ISettingsService settingsService, ICounterService counterService, ISQLiteDependencies sQLiteDependencies)
 {
     _eventService          = eventService;
     _settingsService       = settingsService;
     _counterService        = counterService;
     _sqLiteAsyncConnection = sQLiteDependencies.AsyncConnection;
 }
Пример #6
0
        public async static Task Main(string[] args)
        {
            ICounterService actor = ActorProxy.Create <ICounterService>(ActorId.CreateRandom(), new Uri("fabric:/CounterActorApp/CounterServiceActorService"));

            Stopwatch diagnostic = Stopwatch.StartNew();
            int       i          = 0;

            while (i <= 200)
            {
                try
                {
                    int retval = await actor.GetCountAsync(CancellationToken.None);

                    Console.WriteLine($"value: {retval}");
                }
                catch (Exception)
                {
                }
                Console.WriteLine($"event {i} ... from last event: {diagnostic.ElapsedMilliseconds} milli");

                diagnostic.Restart();
                i += 1;
            }
            Console.Read();
        }
Пример #7
0
 public StatusFragment(Resources resources, IEventService eventService, ISettingsService settingsService, ICounterService counterService)
 {
     _resources       = resources;
     _eventService    = eventService;
     _settingsService = settingsService;
     _counterService  = counterService;
 }
        public GridFsBlobStore(MongoDatabase database, ICounterService counterService)
        {
            _database       = database;
            _counterService = counterService;

            LoadFormatsFromDatabase();
        }
Пример #9
0
 public KanaController(IPdfExportService pdfExportService, ICounterService counterService, string kanaType)
 {
     this.pdfExportService = pdfExportService;
     this.counterService   = counterService;
     this.kanaType         = kanaType;
     this.BaseFactory      = new THelper();
 }
Пример #10
0
 private static async Task ServerStreamingCallExample(ICounterService client)
 {
     await foreach (var count in client.CountdownAsync())
     {
         Console.WriteLine($"Countdown: {count}");
     }
 }
Пример #11
0
 public WelcomePageViewModel(ICounterService counterService, IEventAggregator eventAggregator)
 {
     WelcomeText          = "Welcome Guy";
     AddCountCommand      = new DelegateCommand(Increment, CanExecuteAddCommand).ObservesProperty(() => Amount);
     this.counterService  = counterService;
     this.eventAggregator = eventAggregator;
     this.Count           = counterService.GetCount();
 }
Пример #12
0
 public CounterCommand(ITwitchClient twitchClient, ICounterService counterService) : base(new List <string>
 {
     "counter", "count"
 })
 {
     _twitchClient   = twitchClient;
     _counterService = counterService;
 }
Пример #13
0
        public UserNotificationStore(IUserNotificationRepository repository, ICounterService counters, IClock clock)
        {
            this.repository = repository;
            this.counters   = counters;
            this.clock      = clock;

            collector = new StatisticsCollector(repository, 5000);
        }
Пример #14
0
 public SearchForenameService(ICandidateRepo candidateRepo, IFileService fileService, ICounterService counterService, IValidationService validationServic)
 {
     CandidateRepo     = candidateRepo;
     FileService       = fileService;
     CounterService    = counterService;
     CandidateNames    = new Dictionary <string, int>();
     ValidationService = validationServic;
 }
Пример #15
0
 public Experience1ViewModel(
     INavigationService <MainViews> nav,
     ICounterService counterService)
 {
     CounterService      = counterService;
     NavigateHomeCommand = new DelegateCommand(() => nav.View = MainViews.HomeView);
     CounterCommand      = new DelegateCommand(CounterService.Click);
 }
Пример #16
0
 public HomeController(
     IUsersService usersService,
     IConfiguration configuration,
     ICounterService counterService)
 {
     this.usersService   = usersService;
     this.configuration  = configuration;
     this.counterService = counterService;
 }
Пример #17
0
 public void Setup()
 {
     CandidateRepo         = new CandidateRepo();
     FileService           = new FileService();
     CounterService        = new CounterService();
     ValidationService     = new NamePatternValidationService();
     SearchForenameService = new SearchForenameService(CandidateRepo, FileService, CounterService, ValidationService);
     SearchCharacter       = 'a';
 }
Пример #18
0
 public IndexService(ICounterService counterService, IMonthlySubscriptionService monthlySubscriptionService,
                     IVipTicketService vipTicketService, ICommentService commentService, IFreeTipsService freeTipsService, IHtmlService htmlService)
 {
     _counterService             = counterService;
     _monthlySubscriptionService = monthlySubscriptionService;
     _vipTicketService           = vipTicketService;
     _commentService             = commentService;
     _freeTipsService            = freeTipsService;
     _htmlService = htmlService;
 }
Пример #19
0
 public HomeController(
     ILogger <HomeController> logger,
     ICounterService counterService,
     IFetchDataViewModel fetchDataViewModel
     )
 {
     _logger             = logger;
     _counterService     = counterService;
     _fetchDataViewModel = fetchDataViewModel;
 }
Пример #20
0
        public async Task Invoke(HttpContext httpContext, ICounterService counterService, CounterServiceFactory serviceFactory)
        {
            cnt++;

            httpContext.Response.ContentType = "text/html;charset=utf-8";

            await httpContext.Response.WriteAsync(
                $"Request #{cnt} - CountSvc: {counterService.GetVal} - SvcFactory: {serviceFactory._counterSercive.GetVal}")
            .ConfigureAwait(false);
        }
Пример #21
0
 public GetWinsCommand(ITwitchClient twitchClient, ICounterService counterService,
                       ITwitchApiHelper twitchApiHelper) : base(new List <string>
 {
     "wins"
 })
 {
     _twitchClient    = twitchClient;
     _counterService  = counterService;
     _twitchApiHelper = twitchApiHelper;
 }
Пример #22
0
 public CaseArchiveService(
     ILogger <CaseArchiveService> _logger,
     ICounterService _counterService,
     IRepository _repo,
     IUserContext _userContext)
 {
     logger         = _logger;
     repo           = _repo;
     userContext    = _userContext;
     counterService = _counterService;
 }
Пример #23
0
 public HomeController(
     IUsersService usersService,
     IConfiguration configuration,
     ICounterService counterService,
     ILogger <HomeController> logger)
 {
     this.usersService   = usersService;
     this.configuration  = configuration;
     this.counterService = counterService;
     this.logger         = logger;
 }
Пример #24
0
        public void SetUp()
        {
            var db = TestHelper.CreateNew(ConfigurationManager.ConnectionStrings["system"].ConnectionString);

            sut        = new IdentityManager(counterService = new CounterService(db));
            sutOffline = new IdentityManager(offlineCounterService = new OfflineCounterService(db));
            sut.RegisterIdentitiesFromAssembly(Assembly.GetExecutingAssembly());
            sutOffline.RegisterIdentitiesFromAssembly(Assembly.GetExecutingAssembly());
            _mappingCollection     = db.GetCollection <BsonDocument>("map_testid");
            _mappingFlatCollection = db.GetCollection <BsonDocument>("map_testflatid");
            db.Drop();
        }
Пример #25
0
        public MainView()
        {
            counterService = DependencyService.Get<ICounterService> ();

            Orientation = StackOrientation.Vertical;
            HorizontalOptions = LayoutOptions.Center;
            CreateControls ();

            Children.Add (TopEntry);
            Children.Add (TopBtn);
            Children.Add (GridForLbl);
        }
Пример #26
0
        /// <summary>
        /// Standard Constructor
        /// </summary>
        /// <param name="db">The database where I want to store information</param>
        /// <param name="collectionName">The name of the collection that will be used
        /// to store information of the file</param>
        /// <param name="baseDirectory">Base directory on filesystem where binary blob
        /// will be stored</param>
        /// <param name="counterService">Counter service to generate new <see cref="BlobId"/></param>
        public FileSystemBlobStore(
            IMongoDatabase db,
            String collectionName,
            String baseDirectory,
            ICounterService counterService)
        {
            _baseDirectory            = baseDirectory;
            _blobDescriptorCollection = db.GetCollection <FileSystemBlobDescriptor>(collectionName);
            _directoryManager         = new DirectoryManager(_baseDirectory);

            _counterService = counterService;
        }
Пример #27
0
 public ThreadService(IThreadRepository threadRepository, IFirebaseThreadRepository fbThreadRepository, IReferralService referralService, IMessageService messageService, IChannelService channelService, IAgentService agentService, ICounterService counterService, ICounterRepository counterRepository, IMessageRepository messageRepository)
 {
     _threadRepository   = threadRepository;
     _fbThreadRepository = fbThreadRepository;
     _messageRepository  = messageRepository;
     _counterRepository  = counterRepository;
     _counterService     = counterService;
     _channelService     = channelService;
     _agentService       = agentService;
     _referralService    = referralService;
     _messageService     = messageService;
 }
Пример #28
0
 public DocumentResolutionService(
     ILogger <DocumentResolutionService> _logger,
     IRepository _repo,
     IUserContext _userContext,
     ICounterService _counterService,
     IWorkTaskService _worktaskService)
 {
     logger          = _logger;
     repo            = _repo;
     userContext     = _userContext;
     counterService  = _counterService;
     worktaskService = _worktaskService;
 }
Пример #29
0
 public UserEventPublisher(ICounterService counters, ISemanticLog log, ILogStore logStore,
                           IEventStore eventStore,
                           ISubscriptionStore subscriptionStore,
                           ITemplateStore templateStore,
                           IUserEventProducer userEventProducer)
 {
     this.subscriptionStore = subscriptionStore;
     this.counters          = counters;
     this.eventStore        = eventStore;
     this.log               = log;
     this.logStore          = logStore;
     this.templateStore     = templateStore;
     this.userEventProducer = userEventProducer;
 }
 /// <summary>
 /// Standard Constructor
 /// </summary>
 /// <param name="db">The database where I want to store information</param>
 /// <param name="collectionName">The name of the collection that will be used
 /// to store information of the file</param>
 /// <param name="baseDirectory">Base directory on filesystem where binary blob
 /// will be stored</param>
 /// <param name="counterService">Counter service to generate new <see cref="BlobId"/></param>
 /// <param name="documentStoreConfiguration">Global configuration to grab storage user name and password
 /// </param>
 public FileSystemBlobStore(
     IMongoDatabase db,
     String collectionName,
     String baseDirectory,
     ICounterService counterService,
     DocumentStoreConfiguration documentStoreConfiguration) : this(
         db,
         collectionName,
         baseDirectory,
         counterService,
         documentStoreConfiguration.StorageUserName,
         documentStoreConfiguration.StoragePassword)
 {
 }
Пример #31
0
 public ChannelController(IChannelService channelService, INodeService nodeService, IThreadService threadService, ICounterService counterService, ICustomerService userService, ICustomerService cusstomerService, IMessageService messageService, IFacebookService facebookService, IAgentService agentService, IOptions <AppSettings> appSettings, IBackgroundJobClient backgroundJobClient, ILoggingService logService)
 {
     _channelService      = channelService;
     _threadService       = threadService;
     _customerService     = cusstomerService;
     _messageService      = messageService;
     _facebookService     = facebookService;
     _nodeService         = nodeService;
     _appSettings         = appSettings;
     _agentService        = agentService;
     _userService         = userService;
     _counterService      = counterService;
     _backgroundJobClient = backgroundJobClient;
     _logService          = logService;
 }
Пример #32
0
 // GET: Home
 public HomeController(IApplicationContext context, IEmailService emailService, ISearchService searchService, IShowAdvertService showAdvertService, ICounterService counterService, IOfferService offerService, ICalcService calcService, IGetNextPreviousService getNextPreviousService, INewestAdvertService newestAdvertService, IFilterIndexService filterIndexService, IGetFiltredAdvertsService getFiltredAdvertsService, IAdvertCitiesService advertCitiesService, IMaxPriceService maxPriceService)
 {
     _context                  = context;
     _emailService             = emailService;
     _searchService            = searchService;
     _showAdvertService        = showAdvertService;
     _counterService           = counterService;
     _offerService             = offerService;
     _calcService              = calcService;
     _getNextPreviousService   = getNextPreviousService;
     _newestAdvertService      = newestAdvertService;
     _filterIndexService       = filterIndexService;
     _getFiltredAdvertsService = getFiltredAdvertsService;
     _advertCitiesService      = advertCitiesService;
     _maxPriceService          = maxPriceService;
 }
        public void SetUp()
        {
            BlobStore = Substitute.For<IBlobStore>();
            IdentityGenerator = Substitute.For<IIdentityGenerator>();
            _handleWriter = Substitute.For<IDocumentWriter>();
            DocumentReader = Substitute.For<IMongoDbReader<DocumentDescriptorReadModel, DocumentDescriptorId>>();
            DocumentDeletedReader = Substitute.For<IMongoDbReader<DocumentDeletedReadModel, String>>();

            QueueDispatcher = Substitute.For<IQueueManager>();
            CounterService = Substitute.For<ICounterService>();
            var bus = Substitute.For<IInProcessCommandBus>();
            var configuration =  new DocumentStoreTestConfiguration();
            Controller = new DocumentsController(
                BlobStore,
               configuration, 
                IdentityGenerator, 
                DocumentReader,
                DocumentDeletedReader,
                bus, 
                _handleWriter,
                QueueDispatcher,
                CounterService,
                null)
            {
                Request = new HttpRequestMessage
                {
                    RequestUri = new Uri("http://localhost/api/products")
                },
                Logger = new ConsoleLogger(),
                Configuration = new HttpConfiguration(),
                RequestContext =
                {
                    RouteData = new HttpRouteData(
                        route: new HttpRoute(),
                        values: new HttpRouteValueDictionary {{"controller", "file"}})
                }
            };

            //  Controller.Configuration.MapHttpAttributeRoutes();

            Controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
        }
Пример #34
0
        public ItemCounterPartHandler(ICounterService counters, IAuthenticationService auth, IOrchardServices services)
        {
            OnRemoved<ItemCounterPart>((ctx, part) => counters.RemoveAllCounters(part.ContentItem.Id));

            OnGetDisplayShape<ItemCounterPart>((ctx, part) =>
            {
                var settings = part.Settings.GetModel<ItemCounterPartTypePartSettings>();
                var type = part.Record == null ? settings.Type : part.Type;

                // Incrementing visit counters here
                var user = auth.GetAuthenticatedUser();
                var site = services.WorkContext.CurrentSite;
                var countUser = 0;
                var countSite = 0;
                var countSession = 0;
                if (user != null){
                    countUser = ctx.DisplayType != "Detail" ? 
                        counters.GetCounter(part.ContentItem.Id, user.Id, CounterType.Visits, CounterStoreType.Database) 
                        : counters.Increment(part.ContentItem.Id, user.Id, CounterType.Visits, CounterStoreType.Database);
                }
                if (site != null){
                     countSite = ctx.DisplayType != "Detail" ?
                        counters.GetCounter(part.ContentItem.Id, site.Id, CounterType.Visits, CounterStoreType.Database)
                        : counters.Increment(part.ContentItem.Id, site.Id, CounterType.Visits, CounterStoreType.Database);
                }
                if (site != null && services.WorkContext.HttpContext != null){
                    countSession = ctx.DisplayType != "Detail" ?
                        counters.GetCounter(part.ContentItem.Id, site.Id, CounterType.Visits, CounterStoreType.Session)
                        : counters.Increment(part.ContentItem.Id, site.Id, CounterType.Visits, CounterStoreType.Session);
                }

                /* Setting appropriate counter */
                part.Count = (type == VisitCounterType.PerSite)
                                 ? countSite
                                 : (type == VisitCounterType.PerUser &&
                                    user != null)
                                       ? countUser
                                       : countSession;
            });
        }
 public DocumentsController(
     IBlobStore blobStore,
     DocumentStoreConfiguration configService,
     IIdentityGenerator identityGenerator,
     IMongoDbReader<DocumentDescriptorReadModel, DocumentDescriptorId> documentDescriptorReader,
     IMongoDbReader<DocumentDeletedReadModel, String> documentDeletedReader,
     IInProcessCommandBus commandBus,
     IDocumentWriter handleWriter,
     IQueueManager queueDispatcher,
     ICounterService counterService,
     IDocumentFormatTranslator documentFormatTranslator)
 {
     _blobStore = blobStore;
     _configService = configService;
     _identityGenerator = identityGenerator;
     _documentDescriptorReader = documentDescriptorReader;
     _documentDeletedReader = documentDeletedReader;
     _handleWriter = handleWriter;
     _queueDispatcher = queueDispatcher;
     _counterService = counterService;
     _documentFormatTranslator = documentFormatTranslator;
     CommandBus = commandBus;
 }
Пример #36
0
        public CountersHandler(ICounterService counters, IAuthenticationService auth, IOrchardServices services)
        {
            
            OnRemoved<AutoroutePart>((ctx, part) => counters.RemoveAllCounters(part.ContentItem.Id));

            OnGetDisplayShape<AutoroutePart>((ctx, part) =>
            {
                if (ctx.DisplayType != "Detail") return;

                // Avoiding double incrementing counter for route parts and itemcounter parts
                if (part.Is<ItemCounterPart>()) return;

                // Incrementing visit counters here
                var user = auth.GetAuthenticatedUser();
                var site = services.WorkContext.CurrentSite;
                if (user != null)
                    counters.Increment(part.ContentItem.Id, user.Id, CounterType.Visits, CounterStoreType.Database);
                if (site != null)
                    counters.Increment(part.ContentItem.Id, site.Id, CounterType.Visits, CounterStoreType.Database);
                if (site != null && services.WorkContext.HttpContext != null)
                    counters.Increment(part.ContentItem.Id, site.Id, CounterType.Visits, CounterStoreType.Session);
            });
        }
Пример #37
0
 public HomeController(ICounterService counterService)
 {
     this.counterService = counterService;
 }
Пример #38
0
 public CounterController(ICounterService counterService)
 {
     _counterService = counterService;
 }
Пример #39
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string counterid = Request["id"];
              _srv = ServiceFactory.GetCounterService();
              if (Application["Counter_" + counterid] == null)
              {

            _counter = _srv.CounterSelect( 5 );
            Application["Counter_" + counterid] = _counter.Count;

              }
              int value = Convert.ToInt32( Application["Counter_" + counterid]);

              if (Session["CounterTemp_" + counterid] == null)
              {

            if(_counter == null)
              _counter = _srv.CounterSelect( 5 );
            value++;
            _counter.Count = value;
            // Save counter to an application var (the locks are there to make sure noone else changes it at the same time)
            Application.Lock();
            Application["Counter_" + counterid] = value.ToString();
            Application.UnLock();

            // Save counter to a text file
            _srv.CounterUpdate( _counter );

            // Set a session variable so this counter doesn//t fire again in the current session
            Session.Add("CounterTemp_" + counterid, "True");
              }

              // ***** CREATE OUTPUT GRAPHIC FOR THE COUNTER *****

              // Load digits graphic (must be in 0 through 9 format in graphic w/ all digits of set width)
              System.Drawing.Image i = System.Drawing.Image.FromFile(Server.MapPath((Request.QueryString["src"])));

              // Get digit dynamics from the graphic
              int dgwidth = i.Width/10;
              int dgheight = i.Height;

              // Get number of digits to display in the output graphic
              int digits = Convert.ToInt32(Request["digits"]);

              // Create output object
              Bitmap imgOutput = new Bitmap(dgwidth*digits, dgheight, PixelFormat.Format24bppRgb);
              Graphics g = Graphics.FromImage(imgOutput);

              int j;
              int dg;
              string srt = ("00000000000000" + value.ToString());
              srt = srt.Substring( srt.Length - digits, digits );
              for (j = 0; j < digits; j++)
              {
            // Extract digit from value
            //dg =  Convert.ToInt32(Math.Truncate((double)(value/(10 ^ (digits - j - 1)))) - Math.Truncate((double)(value/(10 ^ (digits - j))))*10);

            dg = Convert.ToInt32( srt.Substring( j, 1 ) );
            // Add digit to the output graphic
            g.DrawImage(i, new
                         Rectangle(j*dgwidth, 0, dgwidth, dgheight),
                    new Rectangle
                      (dg*dgwidth,
                       0,
                       dgwidth,
                       dgheight),
                    GraphicsUnit.Pixel);

              }

              // Set the content type and return output image
              Response.ContentType = "image/jpeg";
              imgOutput.Save(Response.OutputStream, ImageFormat.Jpeg);

              // Clean up
              g.Dispose();
              imgOutput.Dispose();
        }