public void _SetUp()
        {
            var ctx = TestProvider.GetSqlContext();

            this.Repositories = TestProvider.GetRepositoryHub(ctx);
            this.Services     = TestProvider.GetServiceHub(this.Repositories);
        }
Esempio n. 2
0
        public override int Handle(StartOptions command)
        {
            var virgilHub = ServiceHub.Create(ServiceHubConfig.UseAccessToken(ApiConfig.VirgilToken));

            ServiceLocator.Setup(virgilHub);

            var eventAggregator = this.bootstrapper.Container.Resolve <IEventAggregator>();

            eventAggregator.Subscribe(new Listener());

            var appState = this.bootstrapper.Container.Resolve <ApplicationState>();

            appState.Restore();

            if (!appState.HasAccount)
            {
                Console.WriteLine("    There is no Virgil Card stored");
                return(1);
            }

            var folderSettings = this.bootstrapper.Container.Resolve <FolderSettingsStorage>();

            if (folderSettings.FolderSettings.IsEmpty())
            {
                Console.WriteLine("    There is no folder to bropbox link configured");
                return(1);
            }

            var validationErrors = folderSettings.FolderSettings.Validate();

            if (validationErrors.Any())
            {
                foreach (var validationError in validationErrors)
                {
                    Console.WriteLine("    " + validationError);
                }
                return(1);
            }

            ExceptionNotifier.Current.OnDropboxSessionExpired(() =>
            {
                eventAggregator.Publish(new DropboxSessionExpired());
                Console.WriteLine("    Dropbox session has expired");
                Environment.Exit(1);
            });

            var folderLinkFacade = this.bootstrapper.Container.Resolve <FolderLinkFacade>();

            Task.Factory.StartNew(() => folderLinkFacade.Rebuild());

            Console.WriteLine("    Virgil sync is running");

            while (true)
            {
                Console.ReadLine();
            }
        }
Esempio n. 3
0
 public void Uninstall()
 {
     AxisPluginService.Ins.Dispose();
     //释放数据工厂
     AxisData.Factory.Release();
     //取消服务注册
     _services.ForEach(t => ServiceHub.Unregister(t.Id));
     _services.Clear();
 }
Esempio n. 4
0
        /// <summary>
        /// Setups the instance of <see cref="SimpleChat"/> and runs the message loop.
        /// </summary>
        public static async Task Launch()
        {
            serviceHub = ServiceHub.Create(Constants.VirgilSimpleChatAccessToken);

            var emailAddress = Param <string> .Mandatory("Enter Email Address").WaitInput();

            var chatMember = await Authorize(emailAddress);

            var messagingClient = new IPMessagingClient(chatMember.Identity);
            var simpleChat      = new SimpleChat(messagingClient, chatMember);

            Console.WriteLine("\nWelcome to DARKSIDE chat. Feel free to post here your DARK thoughts.\n");

            await simpleChat.StartMessaging();
        }
        public void TestRelationQuery()
        {
            ParseObject parent = new ServiceHub {
            }.CreateObjectWithoutData("Foo", "abcxyz");

            ParseRelation <ParseObject> relation = parent.GetRelation <ParseObject>("child");
            ParseQuery <ParseObject>    query = relation.Query;

            // Client side, the query will appear to be for the wrong class.
            // When the server recieves it, the class name will be redirected using the 'redirectClassNameForKey' option.
            Assert.AreEqual("Foo", query.GetClassName());

            IDictionary <string, object> encoded = query.BuildParameters();

            Assert.AreEqual("child", encoded["redirectClassNameForKey"]);
        }
Esempio n. 6
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            this.DispatcherUnhandledException += this.OnDispatcherUnhandledException;

            var virgilHub = ServiceHub.Create(ServiceHubConfig.UseAccessToken(ApiConfig.VirgilToken));

            Virgil.SDK.Domain.ServiceLocator.Setup(virgilHub);

            var updater = new Updater();

            updater.Start();

            this.Bootstrapper = new Bootstrapper();
            this.Bootstrapper.Initialize();

            this.AppState = this.Bootstrapper.IoC.Get <ApplicationState>();
            this.AppState.Restore();

            this.FolderSettings = this.Bootstrapper.IoC.Get <FolderSettingsStorage>();
            this.MainWindow     = new TrayWindow
            {
                DataContext = this.Bootstrapper.IoC.Get <OperationStatusViewModel>()
            };

            ExceptionNotifier.Current.OnDropboxSessionExpired(() =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    this.Bootstrapper.IoC.Get <IEventAggregator>().Publish(new DropboxSessionExpired());
                });
            });

            this.ShowUI();
        }
 public MessageController(ServiceHub serviceHub)
 {
     this._serviceHub = serviceHub;
 }
Esempio n. 8
0
 private ServerHandler(ServiceHub serviceHub)
 {
     ServiceHub = serviceHub;
 }
        public bool ResolveHub(string uri)
        {
            try
            {
                CurrentHub = new ServiceHub();
                CurrentHub.DestinationAddress = uri;
                return true;
            }
            catch (Exception ex)
            {
                //BaseServiceException = ex;
                //BaseServiceMessage = "The command failed.  Please see the BaseServiceException for details.";

            }
            return false;
        }
Esempio n. 10
0
 private void InitializeHubs(Uri address)
 {
     EntityManager em = new EntityManager();
     List<Hub> hubs = em.GetHubsByGateway(address);
     foreach(var hub in hubs)
     {
         IServiceHub currentHub = new ServiceHub();
         currentHub.Name = hub.HubName;
         currentHub.OriginAddress = address.OriginalString;
         currentHub.DestinationAddress = address.OriginalString + hub.HubEndpoint;
         ServiceHubs.Add(currentHub);
         Console.WriteLine("Gateway: successfully created endpoint {0}.",
             currentHub.DestinationAddress);
         currentHub.InitializeSpokes(hub.HubId,
             currentHub.OriginAddress, currentHub.DestinationAddress);
     }
 }
Esempio n. 11
0
 public Current(AuthenticationHub authHub, ServiceHub serviceHub)
 {
     this.Authentication = authHub;
     this.Services       = serviceHub;
 }
Esempio n. 12
0
 /// <summary>
 /// Setups service locator to use virgil api configuration to access services.
 /// </summary>
 /// <param name="config">The configuration.</param>
 public static void Setup(ServiceHubConfig config)
 {
     services = ServiceHub.Create(config);
 }
Esempio n. 13
0
 /// <summary>
 /// Setups service locator to use configured virgil hub instance.
 /// </summary>
 /// <param name="virgilHub">The virgil hub.</param>
 public static void Setup(ServiceHub virgilHub)
 {
     services = virgilHub;
 }