Open sgkoishi opened 2 years ago
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; }
}
Bug report
Expected & Actual Behavior
Mouse:
PLUGINS
,TopLevel
shows up.TopLevel
,Second
shows up.Second
Third
shows up somewhere nearSecond
.Third
shows up in the top left corner of the screen, and disappear instantly.Second
also disappears, onlyTopLevel
remains.Keyboard:
Right Arrow Key
when selectingTopLevel
,Second
shows up and being selected.Right Arrow Key
when selectingSecond
,Third
shows up somewhere nearSecond
.Third
shows up in the top left corner of the screen, and disappear instantly.Second
andTopLevel
also disappears.Corresponding plugin source:
Log/Screenshots
No exception thrown.