internal void Update(AvaloniaNativeMenuExporter exporter, IAvaloniaNativeFactory factory, NativeMenuItem item) { if (item != ManagedMenuItem) { throw new ArgumentException("The item does not match the menuitem being updated.", nameof(item)); } if (item.Menu != null) { if (_subMenu == null) { _subMenu = __MicroComIAvnMenuProxy.Create(factory); _subMenu.Initialise(exporter, item.Menu, item.Header); SetSubMenu(_subMenu); } _subMenu.Update(factory, item.Menu); } if (item.Menu == null && _subMenu != null) { _subMenu.Deinitialise(); _subMenu.Dispose(); SetSubMenu(null); } }
internal void Initialize(AvaloniaNativeMenuExporter exporter, NativeMenu managedMenu, string title) { _exporter = exporter; ManagedMenu = managedMenu; ((INotifyCollectionChanged)ManagedMenu.Items).CollectionChanged += OnMenuItemsChanged; if (!string.IsNullOrWhiteSpace(title)) SetTitle(title); }
internal void Initialise(AvaloniaNativeMenuExporter exporter, NativeMenu managedMenu, string title) { _exporter = exporter; ManagedMenu = managedMenu; ((INotifyCollectionChanged)ManagedMenu.Items).CollectionChanged += OnMenuItemsChanged; if (!string.IsNullOrWhiteSpace(title)) { using (var buffer = new Utf8Buffer(title)) { Title = buffer.DangerousGetHandle(); } } }