/// <summary> /// Remove the buttons /// </summary> private void RemoveButtons( ) { if (button != null) { button.ButtonOn -= OnIconOpen; button.ButtonOff -= OnIconClose; button.Remove( ); button = null; } }
/// <summary> /// Add the buttons /// </summary> private void AddButtons( ) { button = new UnifiedButton( ); button.UseBlizzyIfPossible = true; if (BlizzysToolbarButton.IsAvailable) { var texturePath = "TacFuelBalancer/icon-tac-fuel-small.png"; if (!GameDatabase.Instance.ExistsTexture(texturePath)) { var texture = TextureHelper.FromResource("Tac.icons.icon-tac-fuel-small.png", 24, 24); var ti = new GameDatabase.TextureInfo(null, texture, false, true, true); ti.name = texturePath; GameDatabase.Instance.databaseTexture.Add(ti); } // this.Log( "Load : Blizzy texture" ); button.BlizzyNamespace = "Tac"; button.BlizzyButtonId = "FB"; button.BlizzyToolTip = "TAC Fuel Balancer"; button.BlizzyText = "TAC Fuel Balancer"; button.BlizzyTexturePath = texturePath; button.BlizzyVisibility = new GameScenesVisibility(GameScenes.FLIGHT); // this.Log( "Load : Set Blizzy Stuff" ); } var StockTexture = TextureHelper.FromResource("Tac.icons.icon-tac-fuel.png", 38, 38); /* if( StockTexture != null ) * this.Log( "Load : Stock texture" ); * else * this.Log( "Load : cant load texture" );*/ button.LauncherTexture = StockTexture; button.LauncherVisibility = ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW; // this.Log( "Load : Set Stock Stuff" ); button.ButtonOn += OnIconOpen; button.ButtonOff += OnIconClose; button.Add( ); }