예제 #1
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(this);
            return;
        }
        // We don't want any weird behavior here.
        if (maxMessageDuration > messageDuration)
        {
            messageDuration = maxMessageDuration;
        }

        panelAnimator = broadCastPanel.GetComponent <Animator>();
    }
 private void Start()
 {
     instance            = this;
     messageText.enabled = false;
 }
예제 #3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

            var esConnection = EventStoreConfiguration.ConfigureEsConnection(
                Configuration["EventStore:ConnectionString"],
                Environment.ApplicationName);
            // services.AddSingleton<IEventStoreConnection>(esConnection);
            IEventSerdes  eventSerdes = new ContextEventSchema();
            IEventStorage storage     = new EventStorage(esConnection, eventSerdes);
            var           stories     = Stories.OfUseCases(
                new CustomerUseCases(new Repository <Customer.State>(storage))
                );

            services.AddSingleton(stories);

            var documentStore = RavendbDocumentStoreFactory.CreateDocStore(
                Configuration["RavenDb:Server"],
                Configuration["RavenDb:Database"]
                );
            var customerViewModelWriter =
                new RaventDbAtomicWriter <string, CustomerViewModel>(documentStore);

            services.AddSingleton <IAtomicWriter <string, CustomerViewModel> >(customerViewModelWriter);
            services.AddSingleton(new CustomerEventListener(customerViewModelWriter));
            services.AddSingleton <IListenTo <CustomerRegistered> >(x => x.GetService <CustomerEventListener>());
            services.AddSingleton <IListenTo <CustomerRegistered> >(x => x.GetService <CustomerEventListener>());
            services.AddSingleton <IListenTo <CustomerRelocated> >(x => x.GetService <CustomerEventListener>());
            services.AddSingleton <IListenTo <CustomerContactInfoChanged> >(x => x.GetService <CustomerEventListener>());

            var subscriptionIntegrator = new SubscriptionIntegrator(
                esConnection
                , new EsCheckpointStore(esConnection, "process-checkpoint")
                , "processMessenger"
                // , new ProcessMessenger(
                //     new ProcessOf<SampleProcessState>(
                //             new SampleStateRepository()
                //             , stories
                //         )
                // )
                //or:
                //   , new ProcessMessenger(
                //       new SampleProcess(
                //               new SampleStateRepository()
                //               , stories
                //           )
                //   )
                //or:
                , MessageBroadcaster <EventEnvelope> .Subscribe(
                    services.BuildServiceProvider()
                    , m => m.Payload)
                , eventSerdes
                );

            var eventStoreService = new EventStoreService(
                esConnection,
                subscriptionIntegrator);

            services.AddSingleton <IHostedService>(eventStoreService);

            services.AddSingleton <IQueryReader <CustomerViewModel> >(new RavenDbQueryReader <CustomerViewModel>(documentStore));


            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }
예제 #4
0
 public NoteItem(MessageBroadcaster messageBroadcaster, XElement noteElement)
 {
     _messageBroadcaster = messageBroadcaster;
     _noteElement = noteElement;
     _text = new EditableText(_noteElement.Value);
 }