コード例 #1
0
        public override void SetUp()
        {
            base.SetUp();

            var bootstrapper = new AlfredBootstrapper();
            _alfred = bootstrapper.Create();

            _subsystem = new TestSubsystem(Container);
        }
コード例 #2
0
        public override void SetUp()
        {
            base.SetUp();

            _metricProviderFactory = new ValueMetricProviderFactory();
            _subsystem = new SystemMonitoringSubsystem(Container);

            var bootstrapper = new AlfredBootstrapper();
            _alfred = bootstrapper.Create();
        }
コード例 #3
0
        public override void SetUp()
        {
            base.SetUp();

            var bootstrapper = new AlfredBootstrapper();
            _alfred = bootstrapper.Create();
            _subsystem = new TestSubsystem(Container);
            _page = new TestPage(Container);

            _subsystem.AddAutoRegisterPage(_page);
            _alfred.Register(_subsystem);
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object" /> class.
        /// </summary>
        /// <param name="director">The user interface director.</param>
        /// <param name="alfred">The alfred instance.</param>
        /// <exception cref="ArgumentNullException"><paramref name="director" /> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="alfred" /> is <see langword="null" />.</exception>
        public ShellCommandManager([NotNull] IUserInterfaceDirector director, [NotNull] AlfredApplication alfred)
        {
            if (director == null)
            {
                throw new ArgumentNullException(nameof(director));
            }
            if (alfred == null)
            {
                throw new ArgumentNullException(nameof(alfred));
            }

            _uiDirector = director;
            _alfred = alfred;
        }
コード例 #5
0
        public void AtInitialStateInitializeIsVisible()
        {
            // Doing this again here to illustrate creation / configuration order more clearly
            var bootstrapper = new AlfredBootstrapper();
            _alfred = bootstrapper.Create();
            _module = new AlfredPowerModule(Container);

            RegisterTestModule(_alfred, _module);

            Assert.IsNotNull(_module.AlfredInstance, "Alfred was not set");
            Assert.IsTrue(_module.InitializeButton.IsVisible, "Initialize button was not visible while offline.");
            Assert.IsNotNull(_module.Widgets, "_module.Widgets was null");
            Assert.IsTrue(_module.Widgets.Contains(_module.InitializeButton),
                          "The Initialize button was not part of the UI while offline");
        }
コード例 #6
0
        public override void SetUp()
        {
            base.SetUp();

            var bootstrapper = new AlfredBootstrapper();
            _alfred = bootstrapper.Create();
            _alfred.Console = new SimpleConsole();

            _subsystem = new TestSubsystem(Container);
            _page = new AlfredModuleListPage(Container, "Test Page", "Test");
        }
コード例 #7
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="T:System.Object" /> class with the specified
        ///     user interface director and platform provider.
        /// </summary>
        /// <param name="container"> The container. </param>
        /// <param name="options"> Options for creating the application. </param>
        /// <param name="director"> The user interface director. </param>
        public ApplicationManager(
            [CanBeNull] IObjectContainer container,
            [NotNull] ApplicationManagerOptions options,
            [CanBeNull] IUserInterfaceDirector director = null)
        {
            Options = options;

            // Everything will need a container. Provide one.
            Container = container ?? CommonProvider.Container;

            // Use this container whenever a container is requested
            Container.RegisterAsProvidedInstance(typeof(IObjectContainer));

            // Register default mappings
            ConfigureContainer();

            // Create Alfred. It won't be online and running yet, but create it.
            _alfred = Container.Provide<AlfredApplication>(Container);
            _alfred.RegisterAsProvidedInstance(typeof(IAlfred), Container);

            // Give Alfred a way to talk to the user and the client a way to log events that are separate from Alfred
            _console = InitializeConsole();

            // Set the director. This will, in turn, set the shell
            UserInterfaceDirector = director;

            InitializeSubsystems();

            // Create an update pump on a dispatcher timer that will automatically get Alfred to regularly update any modules it has
            InitializeUpdatePump();
        }
コード例 #8
0
        public override void SetUp()
        {
            base.SetUp();

            var bootstrapper = new AlfredBootstrapper();
            _alfred = bootstrapper.Create();
            _module = new AlfredPowerModule(Container);

            RegisterTestModule(_alfred, _module);
        }
コード例 #9
0
        public void CoreModuleHasNoProviderText()
        {
            var bootstrapper = new AlfredBootstrapper(Container);
            _alfred = bootstrapper.Create();
            _module = new AlfredPowerModule(Container);

            var text = _module.AlfredStatusWidget.Text;
            Assert.IsNotNull(text, "Widget text was null");
            Assert.IsTrue(text.EndsWith("has not been set"),
                          $"Component did not indicate that Alfred was not set. Instead indicated: {text}");
        }
コード例 #10
0
        public AlfredApplication Create()
        {
            var alfred = new AlfredApplication(Container) { Console = Console };

            return alfred;
        }
コード例 #11
0
        public void OnStartup()
        {
            var bootstrapper = new AlfredBootstrapper();
            _alfred = bootstrapper.Create();

            _page = new AlfredModuleListPage(Container, "Time", "Time");
            _module = new AlfredTimeModule(Container);
            _page.Register(_module);
            _subsystem = new TestSubsystem(Container);
            _subsystem.AddAutoRegisterPage(_page);

            _alfred.Register(_subsystem);
        }
コード例 #12
0
        public override void SetUp()
        {
            base.SetUp();

            var bootstrapper = new AlfredBootstrapper(Container);
            _alfred = bootstrapper.Create();

            _subsystem = new MindExplorerSubsystem(Container, true);

            _page = _subsystem.MindExplorerPage;
        }