Hearthstone-Deck-Tracker
Hearthstone-Deck-Tracker copied to clipboard
Nested MenuItem of plugin disappears
Bug report
Expected & Actual Behavior
Mouse:
- Click
PLUGINS
,TopLevel
shows up. - Mouse over
TopLevel
,Second
shows up. - Mouse over
Second
- Expected:
Third
shows up somewhere nearSecond
. - Actual:
Third
shows up in the top left corner of the screen, and disappear instantly.Second
also disappears, onlyTopLevel
remains.
- Expected:
Keyboard:
- Press
Right Arrow Key
when selectingTopLevel
,Second
shows up and being selected. - Press
Right Arrow Key
when selectingSecond
,- Expected:
Third
shows up somewhere nearSecond
. - Actual:
Third
shows up in the top left corner of the screen, and disappear instantly.Second
andTopLevel
also disappears.
- Expected:
Corresponding plugin source:
using System;
using System.Windows.Controls;
using Hearthstone_Deck_Tracker.Plugins;
public class Plugin : IPlugin
{
public void OnLoad() { }
public void OnUnload() { }
public void OnButtonPress() { }
public void OnUpdate() { }
public string Name => "Test Nested MenuItem";
public string Description => "test";
public string ButtonText => "test";
public string Author => "test";
public Version Version => new Version(1, 0, 0, 0);
public MenuItem MenuItem
{
get
{
var m1 = new MenuItem { Header = "TopLevel" };
var m2 = new MenuItem { Header = "Second" };
m1.Items.Add(m2);
var m3 = new MenuItem { Header = "Third" };
m2.Items.Add(m3);
return m1;
}
}
}
Log/Screenshots
No exception thrown.
Do you get the same behaviour if you initialise the menu structure once (i.e. in the Plugin constructor or IPlugin.OnLoad
) rather than rebuilding a new menu tree every time MenuItem get
is called?
Do you get the same behaviour if you initialise the menu structure once (i.e. in the Plugin constructor or
IPlugin.OnLoad
) rather than rebuilding a new menu tree every timeMenuItem get
is called?
Likely it's not related: The IPlugin::get_MenuItem
is not called multiple times, but only once inside Hearthstone_Deck_Tracker.Plugins.PluginWrapper::Load() : bool
right after the IPlugin::OnLoad
. So, it only returns one instance by only being called once (unless the plugin OnLoad
is called multiple times, which I guess it should expect different MenuItems in that case).
Confirmed nothing changed, the MenuItem still disappears.
using Hearthstone_Deck_Tracker.Plugins;
using System;
using System.Windows.Controls;
public class Plugin : IPlugin
{
public void OnLoad()
{
this.MenuItem = new MenuItem { Header = "TopLevel" };
var m2 = new MenuItem { Header = "Second" };
this.MenuItem.Items.Add(m2);
var m3 = new MenuItem { Header = "Third" };
m2.Items.Add(m3);
}
public void OnUnload() { }
public void OnButtonPress() { }
public void OnUpdate() { }
public string Name => "Test Nested MenuItem";
public string Description => "test";
public string ButtonText => "test";
public string Author => "test";
public Version Version => new Version(1, 0, 0, 0);
public MenuItem MenuItem { get; private set; }
}