I can not create a Ribbon. I already tested with the example that is in developers.primaverabss and github (which are different) and none of them creates the Ribbon.
public class ConstroiRibbon : Plataforma
{
// exemplo no evento DepoisDeCriarMenus
public ConstroiRibbon()
{
PSO.Dialogos.MostraAviso("Entrou aqui");
}
const string cIDTAB = "10000";
const string cIDGROUP = "100001";
const string cIDBUTTON1 = "1000011";
const string cIDBUTTON2 = "1000012";
private StdBSPRibbon RibbonEvents;
/// <summary>
/// This event will execute for all ribbon changes.
/// </summary>
/// <param name="e"></param>
public override void DepoisDeCriarMenus(ExtensibilityEventArgs e)
{
// Register the Ribbon events.
RibbonEvents = this.PSO.Ribbon;
RibbonEvents.Executa += RibbonEvents_Executa;
// Create a new TAB.
this.PSO.Ribbon.CriaRibbonTab("Ferreira & Sanches", cIDTAB, 10);
// Create a new Group.
this.PSO.Ribbon.CriaRibbonGroup(cIDTAB, "Modulo FS", cIDGROUP);
// Create a new 32x32 Button.
this.PSO.Ribbon.CriaRibbonButton(cIDTAB, cIDGROUP, cIDBUTTON1, "FS Button", true, FSRibbon.Properties.Resources.LogoFS);
this.PSO.Ribbon.CriaRibbonButton(cIDTAB, cIDGROUP, cIDBUTTON2, "Primavera Button", true, FSRibbon.Properties.Resources.Wallpaper_PBSS_9_1920x1080_16_9);
}
/// <summary>
/// Ribbon events.
/// </summary>
/// <param name="Id"></param>
/// <param name="Comando"></param>
private void RibbonEvents_Executa(string Id, string Comando)
{
try
{
switch (Id)
{
case cIDBUTTON1:
PSO.Dialogos.MostraAviso("Executar Botão FS");
break;
case cIDBUTTON2:
PSO.Dialogos.MostraAviso("Executar Botão Primavera");
break;
}
}
catch (System.Exception ex)
{
PSO.Dialogos.MostraAviso("Fail to execute the command.", StdBSTipos.IconId.PRI_Informativo, ex.Message);
}
}
}
public class PrimaveraRibbon : Plataforma
{
//Exemplo no evento DepoisDeAbreirEmpresa
#region Private Variables
private StdBSPRibbon RibbonEvents;
#endregion
#region Override
public override void DepoisDeAbrirEmpresa(ExtensibilityEventArgs e)
{
base.DepoisDeAbrirEmpresa(e);
PSO.Dialogos.MostraAviso("Passou Aqui");
RegisterAddin();
}
#endregion
#region Private Events
private void RibbonEvents_Executa(string Id, string Comando)
{
try
{
// Trace.
this.PSO.Diagnosticos.Trace("The user has clicked the extensibility button.");
// Trace to file.
this.PSO.Diagnosticos.TraceFicheiro(@"C:\erp.log", "The user has clicked the extensibility button.");
//You must change the application path.
Process.Start(@"C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\Common7\IDE\devenv.exe");
}
catch (System.Exception ex)
{
PSO.Dialogos.MostraAviso("The file don't exist.",StdBSTipos.IconId.PRI_Informativo,ex.Message);
}
}
#endregion
#region Register the new tab inside PRIMAVERA Ribbon.
public void RegisterAddin()
{
// Register the Ribbon button.
RibbonEvents = this.PSO.Ribbon;
RibbonEvents.Executa += RibbonEvents_Executa;
// Register the add-in.
CriateTab();
CreateGroup();
CreateGroupButton32(RibbonConstants.CIDBOTAO1, "Visual Studio", Resource.VS2017_256x256);
}
#endregion
#region Private methods
private void CriateTab()
{
this.PSO.Ribbon.CriaRibbonTab("PRIMAVERA", RibbonConstants.cIDTAB, 10);
}
private void CreateGroup()
{
this.PSO.Ribbon.CriaRibbonGroup(RibbonConstants.cIDTAB, "Extensibility", RibbonConstants.CIDGROUP);
}
private void CreateGroupButton32(string buttonId, string buttonDescription, Image buttonImage )
{
this.PSO.Ribbon.CriaRibbonButton(RibbonConstants.cIDTAB, RibbonConstants.CIDGROUP, buttonId, buttonDescription,true, buttonImage);
}
#endregion
}