Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am experiencing problems when i use Autoloader together with IExtensionApplication.
If i load the dll with netload everything works fine, but if i load it with the Autoloader in a bundle it fails, and i cant fix it by using netload afterwords. If i remove the IExtensionApplication spesific code, the Autoloader works fine again.
Does anyone know why this happens?
public class AV_Ribbon : IExtensionApplication
{
private const string BIKUBE_TAB_ID = "AV_BIKUBE_TAB_ID";
public void Initialize()
{
BikubeRibbon();
}
public void Terminate()
{
}
[CommandMethod("BikubeRibbon")]
public void BikubeRibbon()
{
Autodesk.Windows.RibbonControl ribCntrl =
Autodesk.AutoCAD.Ribbon.RibbonServices.RibbonPaletteSet.RibbonControl;
//can also be Autodesk.Windows.ComponentManager.Ribbon;
RibbonTab ribTab = new RibbonTab();
ribTab.Title = "Bikube";
ribTab.Id = BIKUBE_TAB_ID;
ribCntrl.Tabs.Add(ribTab);
LeggTilPublPanel(ribTab);
//ribTab.IsActive = true; //Bytter til denne Tab-en ved innlasting
}
private void LeggTilPublPanel(RibbonTab ribTab)
{
RibbonPanelSource ribPanelSource = new RibbonPanelSource();
ribPanelSource.Title = "Publisering";
RibbonPanel ribPanel = new RibbonPanel();
ribPanel.Source = ribPanelSource;
ribTab.Panels.Add(ribPanel);
RibbonButton ribButton = new RibbonButton();
ribButton.Size = RibbonItemSize.Large;
ribButton.Text = "Publiser";
ribButton.Orientation = System.Windows.Controls.Orientation.Vertical;
ribButton.LargeImage = GetBitmap(new Bitmap(Properties.Resources.BikubePublisering_ikon_40x40));
ribButton.ShowText = true;
ribButton.CommandParameter = "PubliserTilBikube "; //HUSK: mellomrom etter kommando
ribButton.CommandHandler = new AdskCommandHandler();
ribPanelSource.Items.Add(ribButton);
}
private BitmapImage GetBitmap(Bitmap image)
{
MemoryStream stream = new MemoryStream();
image.Save(stream, ImageFormat.Png);
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.StreamSource = stream;
bmp.EndInit();
return bmp;
}
}
class AdskCommandHandler : System.Windows.Input.ICommand
{
public bool CanExecute(object parameter)
{
return true;
}
public event EventHandler CanExecuteChanged;
public void Execute(object parameter)
{
//is from Ribbon Button
RibbonButton ribBtn = parameter as RibbonButton;
if (ribBtn != null)
{
//execute the command
acApp.DocumentManager.MdiActiveDocument
.SendStringToExecute(
(string)ribBtn.CommandParameter, true, false, true);
}
}
}
Solved! Go to Solution.