Page 1 of 1

ConnectEvent not being called in Noesis 2.2.2 / .NET 4.6.1 / Windows x64?

Posted: 24 Apr 2019, 21:33
by darthmaule2
I recently noticed my breakpoint in ConnectEvent wasn't getting called, so,
I downloaded the latest tutorials from github and made only 1 change to "Buttons", which was to override ConnectEvent and set a break point when it's called:
namespace Buttons
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            this.Initialized += OnInitialized;
            this.InitializeComponent();
        }

#if NOESIS
        private void InitializeComponent()
        {
            Noesis.GUI.LoadComponent(this, "MainWindow.xaml");  // My breakpoint here is hit
        }
#endif

        private void OnInitialized(object sender, EventArgs args)
        {
            this.DataContext = new ViewModel();
        }

        protected override bool ConnectEvent(object source, string eventName, string handlerName)
        {
            return base.ConnectEvent(source, eventName, handlerName);  // I set my breakpoint here but it's not hit
        } 
    }
}
... but ConnectEvent is never called (or at least my break point is never hit). Everything else seems to work fine in the example.

This is in Windows x64.

This was working previously, but I'm not sure when.

Re: ConnectEvent not being called in Noesis 2.2.2 / .NET 4.6.1 / Windows x64?

Posted: 25 Apr 2019, 13:55
by darthmaule2
ok that's not a good example... I added an event to the XAML and now ConnectEvent is getting called. But, it's still not working in my other application... I'll have to come up with a better minimal example :)

Re: ConnectEvent not being called in Noesis 2.2.2 / .NET 4.6.1 / Windows x64?

Posted: 25 Apr 2019, 14:12
by darthmaule2
Ahh, nevermind. I was not explicitly assigning a SelectionChanged event for my ListView, which I thought was a built-in event. I must have taken that out myself at some point. It's working now.

Re: ConnectEvent not being called in Noesis 2.2.2 / .NET 4.6.1 / Windows x64?

Posted: 25 Apr 2019, 16:45
by sfernandez
Sorry for the late answer, I was going to say that ConnectToEvent is only called if there is any event handler specified in the xaml like:
<Button Content="Start" Click="OnStartButtonClicked"/>
Glad you figure it out.