1
DotNet / Re: Copy events in a new render window
« on: March 15, 2018, 05:26:07 pm »
I was responded to a ru.stackoverflow.com. I think this is a working solution.
Add my own event with Render Window event args.
Then add a listener for Render Window resized event. I wrote a method for this.
When I recreate window I call LinkEvents() method after window initializing.
Listener method is very simple.
When render window event works i call a my event Invoke with arguments. And it works.
Add my own event with Render Window event args.
public event EventHandler<SizeEventArgs> Resized;
Then add a listener for Render Window resized event. I wrote a method for this.
private void LinkEvents()
{
renderWindow.Resized += RenderWindow_Resized;
}
{
renderWindow.Resized += RenderWindow_Resized;
}
When I recreate window I call LinkEvents() method after window initializing.
Listener method is very simple.
private void RenderWindow_Resized(object sender, SizeEventArgs e) => Resized?.Invoke(sender, e);
When render window event works i call a my event Invoke with arguments. And it works.