private void InitializeButton() { // _logger.Info( "InitializeButton" ); #if false if (_button != null) { Remove(); } if (UseBlizzyIfPossible && BlizzysToolbarButton.IsAvailable) { _button = new BlizzysToolbarButton ( BlizzyNamespace, BlizzyButtonId, BlizzyToolTip, BlizzyText, BlizzyTexturePath, BlizzyVisibility ); } else { _button = new AppLauncherButton(LauncherTexture, LauncherVisibility); } _button.Open += OnButtonOn; _button.Close += OnButtonOff; _button.RightClick += OnRightClick; _button.Add(); #else if (toolbarControl == null) { toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(null, null, ApplicationLauncher.AppScenes.FLIGHT, MODID, "airparkButton", "AirPark/PluginData/Icon/AirPark", "AirPark/PluginData/Icon/AirPark", MODNAME ); toolbarControl.AddLeftRightClickCallbacks(LeftButtonToggle, RightButton); } #endif }
/// <summary> /// Initializes the toolbar button. /// </summary> private void InitializeButton() { if (_button != null) { _button.Open -= Button_Open; _button.Close -= Button_Close; _button.Remove(); _button = null; } if (Config.UseBlizzysToolbar && BlizzysToolbarButton.IsAvailable) { _button = new BlizzysToolbarButton(); } else { _button = new AppLauncherButton(); } _button.Open += Button_Open; _button.Close += Button_Close; _button.Add(); }