public async Task HandleEventAsync(CreateEventData eventData)
        {
            var userDefaultCultureName = await SettingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage);

            if (userDefaultCultureName.IsNullOrWhiteSpace())
            {
                userDefaultCultureName = CultureInfo.CurrentUICulture.Name;
            }
            // 使用系统区域语言发布通知
            using (CultureHelper.Use(userDefaultCultureName, userDefaultCultureName))
            {
                var noticeNormalizerName      = NotificationNameNormalizer.NormalizerName(TenantNotificationNames.NewTenantRegistered);
                var tenantAdminUserIdentifier = new UserIdentifier(eventData.AdminUserId, eventData.AdminEmailAddress);

                // 管理用户订阅租户创建通知
                await NotificationSubscriptionManager.SubscribeAsync(eventData.Id, tenantAdminUserIdentifier, noticeNormalizerName.Name);

                var notificationData = new NotificationData();
                notificationData.WriteStandardData(
                    L("NewTenantRegisteredNotificationTitle"),
                    L("NewTenantRegisteredNotificationMessage", eventData.Name),
                    DateTime.Now, eventData.AdminEmailAddress);

                // 发布租户创建通知
                await NotificationDispatcher.DispatchAsync(noticeNormalizerName, notificationData,
                                                           eventData.Id, NotificationSeverity.Success);
            }
        }
Пример #2
0
    private void _initialize()
    {
        name = "(singleton)";
        DontDestroyOnLoad(gameObject);

        _stateFactory          = new NovaStateFactory();
        gameStateMachine       = new GameStateMachine(_stateFactory);
        sessionFlags           = new SessionFlags();
        notificationDispatcher = new NotificationDispatcher();

        networkManager          = gameObject.AddComponent <NetworkManager>();
        gameConfig              = Resources.Load <GameConfig>("GameConfig");
        Input.multiTouchEnabled = false; //TODO: This needs to go elsewere

        _postInit();
    }
Пример #3
0
 private void OnStartup(object sender, StartupEventArgs e)
 {
     var clipboard = new Domain.Clipboard(new Clipboard());
     var clipboardHistoryManager = new ClipboardHistoryManager(10);
     var clipboardBindingManager = new ClipboardBindingManager();
     var keyTracker             = new KeyTracker();
     var ctrlCHotkey            = new Hotkey(keyTracker, new KeyCombo(ModifierKeys.Control, Key.C));
     var ctrlVHotkey            = new Hotkey(keyTracker, new KeyCombo(ModifierKeys.Control, Key.V));
     var escHotkey              = new Hotkey(keyTracker, new KeyCombo(Key.Escape));
     var inputSimulator         = new InputSimulator();
     var notificationDispatcher = new NotificationDispatcher();
     var historyMenuViewModel   = new HistoryMenuViewModel(clipboardHistoryManager);
     var copypasta              = new CopypastaController(clipboard, clipboardHistoryManager, clipboardBindingManager,
                                                          ctrlVHotkey, ctrlCHotkey, escHotkey, keyTracker, inputSimulator, notificationDispatcher);
     var notifyIconWindow = new NotifyIconWindow(notificationDispatcher, historyMenuViewModel);
 }
Пример #4
0
        /// <summary>
        /// the constructor, you can have as much Announcers as you need to announce all the services you have
        /// </summary>
        public Announcer(String _ServiceGlobalUniqueName, Uri _ServiceUri, DiscoverableServiceType _ServiceType)
        {
            Debug.WriteLine("[Announcer] Service Announcer is starting up for Service "+_ServiceGlobalUniqueName+" !");

            _internalServiceGlobalUniqueName = _ServiceGlobalUniqueName;
            ServiceUri = _ServiceUri;
            ServiceType = _ServiceType;

            NotificationSettings NotificationSettings = new NotificationSettings();
            NotificationSettings.StartBrigde = true;
            _NotificationDispatcher = new NotificationDispatcher(new UUID("ServiceDiscovery_Announcement"), NotificationSettings);

            //// Start the Housekeeper Thread which gets rid of timeouted known services
            Thread Announcer_Thread = new Thread(new ThreadStart(AnnouncerThread));
            Announcer_Thread.Name = "Announcer.AnnouncerThread()";
            Announcer_Thread.Start();
            Debug.WriteLine("[Announcer] Service Announcer is up and running for Service " + _ServiceGlobalUniqueName + " !");
        }
Пример #5
0
        /// <summary>
        /// This is the constructor of the discovery class. Use the AddDiscoverableService method to
        /// add Services which shall be discovered.
        /// </summary>
        public Discovery()
        {
            Debug.WriteLine("[Discovery] Service Discovery is starting up!");
            KnownServices = new Dictionary<string, DiscoveredService>();

            NotificationSettings NotificationSettings = new NotificationSettings();
            NotificationSettings.StartBrigde = true;

            _NotificationDispatcher = new NotificationDispatcher(new UUID("ServiceDiscovery_Discovery"), NotificationSettings);

            // Start the Housekeeper Thread which gets rid of timeouted known services
            Thread Housekeeper_Thread = new Thread(new ThreadStart(HousekeeperThread));
            Housekeeper_Thread.IsBackground = true;
            Housekeeper_Thread.SetApartmentState(ApartmentState.STA);
            Housekeeper_Thread.Start();

            //_NotificationDispatcher.RegisterRecipient(new NSD(), this);
            Debug.WriteLine("[Discovery] Service Discovery is up and running!");
        }
    private static void CreateDependencies(string guestControllerHostUrl, string guestControllerSpoofedIpAddress, string mixApiHostUrl, string oneIdClientId, string mixClientToken, string clientVersion, ICoroutineManager coroutineManager, IKeychain keychain, AbstractLogger logger, string localStorageDirPath, string languageCode, out ISessionLogin sessionLogin, out ISessionRegister sessionRegister, out ISessionRestorer sessionRestorer, out ISessionReuser sessionReuser, out IOfflineSessionCreator offlineSessionCreator)
    {
        SystemStopwatchFactory    systemStopwatchFactory    = new SystemStopwatchFactory();
        SystemWwwFactory          wwwFactory                = new SystemWwwFactory();
        WwwCallFactory            wwwCallFactory            = new WwwCallFactory(logger, coroutineManager, systemStopwatchFactory, wwwFactory);
        FileSystem                fileSystem                = new FileSystem();
        DatabaseDirectoryCreator  databaseDirectoryCreator  = new DatabaseDirectoryCreator(fileSystem, localStorageDirPath);
        DocumentCollectionFactory documentCollectionFactory = new DocumentCollectionFactory();
        string sdkDatabasesDirectory = databaseDirectoryCreator.GetSdkDatabasesDirectory();
        DatabaseCorruptionHandler databaseCorruptionHandler = new DatabaseCorruptionHandler(logger, fileSystem, sdkDatabasesDirectory);
        SystemRandom    random       = new SystemRandom();
        SystemEpochTime epochTime    = new SystemEpochTime();
        Database        database     = new Database(keychain.LocalStorageKey, random, epochTime, databaseDirectoryCreator, documentCollectionFactory, databaseCorruptionHandler);
        MixWebCallQueue webCallQueue = new MixWebCallQueue();
        MixSessionStartWebCallEncryptor sessionStartEncryptor    = new MixSessionStartWebCallEncryptor();
        MixWebCallFactoryFactory        mixWebCallFactoryFactory = new MixWebCallFactoryFactory(logger, mixApiHostUrl, mixClientToken, wwwCallFactory, webCallQueue, epochTime, database);
        NotificationDispatcher          notificationDispatcher   = new NotificationDispatcher();
        NotificationQueue          notificationQueue             = new NotificationQueue(notificationDispatcher);
        SessionStatus              sessionStatus           = new SessionStatus(isPaused: true);
        NoOpSessionRefresher       sessionRefresher        = new NoOpSessionRefresher();
        JsonWebCallEncryptor       webCallEncryptor        = new JsonWebCallEncryptor();
        IMixWebCallFactory         webCallFactory          = mixWebCallFactoryFactory.Create(webCallEncryptor, string.Empty, string.Empty, sessionRefresher);
        RsaEncryptor               rsaEncryptor            = new RsaEncryptor();
        MixEncryptor               encryptor               = new MixEncryptor();
        MixWebCallEncryptorFactory webCallEncryptorFactory = new MixWebCallEncryptorFactory(encryptor);
        SessionRefresherFactory    sessionRefresherFactory = new SessionRefresherFactory(webCallQueue);
        MixSessionStarter          mixSessionStarter       = new MixSessionStarter(logger, rsaEncryptor, database, webCallEncryptorFactory, sessionStartEncryptor, mixWebCallFactoryFactory, keychain, coroutineManager, sessionRefresherFactory);
        IStopwatch pollCountdownStopwatch = systemStopwatchFactory.Create();
        GuestControllerClientFactory guestControllerClientFactory = new GuestControllerClientFactory(wwwCallFactory, guestControllerSpoofedIpAddress, database, guestControllerHostUrl, oneIdClientId, logger);
        SessionFactory sessionFactory = new SessionFactory(logger, coroutineManager, pollCountdownStopwatch, epochTime, databaseCorruptionHandler, notificationQueue, notificationDispatcher, sessionStatus, mixWebCallFactoryFactory, webCallEncryptorFactory, mixSessionStarter, keychain, sessionRefresherFactory, guestControllerClientFactory, random, encryptor, fileSystem, wwwCallFactory, localStorageDirPath, clientVersion, databaseDirectoryCreator, documentCollectionFactory, database);
        AgeBandBuilder ageBandBuilder = new AgeBandBuilder(logger, webCallFactory);

        Disney.Mix.SDK.Internal.RegistrationConfigurationGetter registrationConfigurationGetter = new Disney.Mix.SDK.Internal.RegistrationConfigurationGetter(logger, guestControllerClientFactory, ageBandBuilder);
        LegalMarketingErrorsBuilder legalMarketingErrorsBuilder = new LegalMarketingErrorsBuilder(registrationConfigurationGetter, languageCode, epochTime);

        sessionLogin          = new SessionLogin(logger, guestControllerClientFactory, mixSessionStarter, database, legalMarketingErrorsBuilder, sessionFactory);
        sessionRegister       = new SessionRegister(logger, guestControllerClientFactory, database, mixSessionStarter, sessionFactory);
        sessionRestorer       = new SessionRestorer(logger, guestControllerClientFactory, database, sessionFactory);
        sessionReuser         = new SessionReuser(logger, database, mixSessionStarter, sessionFactory);
        offlineSessionCreator = new OfflineSessionCreator(logger, sessionFactory, database);
    }
Пример #7
0
        public sonesExampleClass(String[] myArgs)
        {
            if (myArgs.Count() > 0)
            {
                foreach (String parameter in myArgs)
                {
                    if (parameter.ToUpper() == "--Q")
                        quiet = true;
                }
            }

            #region Init NotificationDispatcher
            var _NotificationSettings = new NotificationSettings()
            {
                StartDispatcher = false,
                StartBrigde = false
            };

            var _NotificationDispatcher = new NotificationDispatcher(UUID.NewUUID, _NotificationSettings);

            #endregion

            #region Create or open GraphDS

            var _GraphDSSharp = new GraphDSSharp()
            {
                DatabaseName = "sonesExample",
                Username = "******",
                Password = "******",
                NotificationSettings = _NotificationSettings,
                NotificationDispatcher = _NotificationDispatcher,
            };

            // Create a InMemory data storage
            _GraphDSSharp.CreateDatabase(true);

            #endregion

            #region Create GraphDB types

            _GraphDSSharp.CreateTypes(CheckResult, typeof(Document), typeof(Author), typeof(Tag));

            #endregion

            #region Create a document upload directory

            _GraphDSSharp.CreateDirectoryObject(new ObjectLocation("Uploads"));

            #endregion

            #region Insert some data

            _GraphDSSharp.Query("INSERT INTO Tag VALUES (Name = 'good')", CheckResult);
            _GraphDSSharp.Query("INSERT INTO Tag VALUES (Name = 'funny')", CheckResult);
            _GraphDSSharp.Query("INSERT INTO Tag VALUES (Name = 'science fiction')", CheckResult);

            _GraphDSSharp.Query("INSERT INTO Author VALUES (Name = 'Holger', EMail = '*****@*****.**')", CheckResult);
            _GraphDSSharp.Query("INSERT INTO Author VALUES (Name = 'Achim',  EMail = '*****@*****.**')", CheckResult);

            #endregion

            #region Start REST, WebDAV and WebAdmin services, send GraphDS notification

            var _HttpSecurity = new HTTPSecurity()
            {
                CredentialType = HttpClientCredentialType.Basic,
                UserNamePasswordValidator = new PassValidator()
            };

            // Start a REST service on localhost port 9975
            var _RESTService      = _GraphDSSharp.StartREST(IPAddress.Any, 9975, _HttpSecurity);

            // Start a WebDAV service on localhost port 9978
            var _WebDAVService    = _GraphDSSharp.StartWebDAV(IPAddress.Any, 9978, _HttpSecurity);

            // Send GraphDS notification
            _NotificationDispatcher.SendNotification(typeof(NGraphDSReady),
                    new NGraphDSReady.Arguments() { Message = "sonesExample up'n'ready!" },
                    NotificationPriority.Normal,
                    true);

            #endregion

            #region Some helping lines...
            if (!quiet)
            {
                Console.WriteLine();
                Console.WriteLine("This small example demonstrates how to start a sones GraphDB");
                Console.WriteLine("Instance and it's several services:");
                Console.WriteLine("   * If you want to suppress console output add --Q as a");
                Console.WriteLine("     parameter.");
                Console.WriteLine("   * REST Service is started at http://localhost:9975");
                Console.WriteLine("      * access it directly like in this example: ");
                Console.WriteLine("           http://localhost:9975/gql?DESCRIBE%20TYPES");
                Console.WriteLine("      * if you want JSON Output add ACCEPT: application/json ");
                Console.WriteLine("        to the client request header (or application/xml or");
                Console.WriteLine("        application/text)");
                Console.WriteLine("   * we recommend to use the AJAX WebShell. ");
                Console.WriteLine("        Browse to http://localhost:9975/WebShell and use");
                Console.WriteLine("        the username \"test\" and password \"test\"");
                Console.WriteLine("   * Additionally a WebDAV service is started on port 9978.");
                Console.WriteLine();
            }
            #endregion

            #region Start the GraphDS command line interface

            if (!quiet)
                _GraphDSSharp.OpenCLI();
            else
                while (true)
                {
                    Thread.Sleep(1000);
                }

            #endregion

            #region Shutdown

            _GraphDSSharp.Shutdown();

            #endregion
        }
Пример #8
0
 protected AlohaController(INotificationDispatcher notificationDispatcher)
 {
     _notificationDispatcher = (NotificationDispatcher)notificationDispatcher;
 }