コード例 #1
0
        public void ShowListeners(ContextRouter router, ContextItem item,
                                  [Context(nameof(OtherContextRouter))]   ContextRouter otherRouter,
                                  [Context(nameof(ListenerListBox))]      ListBox listBox)
        {
            var listeners = otherRouter.GetAllListeners();

            listBox.BeginInvoke(() =>
            {
                listBox.Items.AddRange(listeners.Select(l => l.Name).OrderBy(n => n).ToArray());
            });
        }
コード例 #2
0
        public void ShowListenerParameters(ContextRouter router, ContextItem item,
                                           [Context(nameof(OtherContextRouter))]   ContextRouter otherRouter,
                                           [Context(nameof(ParametersListBox))]    ListBox listBox,
                                           [Context(nameof(SelectedListener))]     string name)
        {
            var listener = otherRouter.GetAllListeners().Single(l => l.Name == name);

            listBox.BeginInvoke(() =>
            {
                listBox.Items.Clear();
                listBox.Items.AddRange(listener.GetParameters().ToArray());
            });
        }
コード例 #3
0
        public void RegisterClassTest()
        {
            ContextRouter cr = new ContextRouter();

            AutoRegistration.AutoRegister <Logger>(cr);

            var listeners = cr.GetAllListeners();

            listeners.Count.Should().Be(1);
            listeners[0].Name.Should().Be(typeof(Logger).Name);

            var contexts = cr.GetTriggerContexts(typeof(Logger), "LogMe");

            contexts.Count.Should().Be(2);
            contexts[0].Should().Be("LogTextBox");
            contexts[1].Should().Be("LogInfo");
        }