Kean Walmsley

July 2009

Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Twitter Updates

    follow me on Twitter



    « A good resource for finding out about the newer features in C# | Main | The story of the (Office 2007) Ribbon »

    April 16, 2008

    Showing a balloon notification using the InfoCenter API in AutoCAD 2009

    This post is the latest in the series of closer looks at the new APIs in AutoCAD 2009. It dips into the InfoCenter API, a .NET API allowing you to customize and drive the InfoCenter feature inside AutoCAD.

    To make use of this API you need to add Project References to two managed assemblies from the AutoCAD 2009 root folder: AcInfoCenterConn.dll and AdInfoCenter.dll.

    Here's some C# code that will display a balloon notification to your users:

    using Autodesk.AutoCAD.ApplicationServices;

    using Autodesk.AutoCAD.Runtime;

    using Autodesk.AutoCAD.AcInfoCenterConn;


    namespace InfoCenterApp

    {

      public class Commands

      {

        [CommandMethod("icb")]

        public void infoCenterBalloon()

        {

          InfoCenterManager icm =

            AcInfoCenterConn.InfoCenterManager;


          Autodesk.InfoCenter.PaletteMgr pm =

            icm.PaletteManager;


          pm.ShowBalloon(

            "Custom Application Notification",

            "Kean has some information for you...",

            null, // Don't provide an icon

            new System.Uri(

              "http://blogs.autodesk.com/through-the-interface"

            ),

            5,   // Show the balloon for 5 seconds

            1    // Make it relatively slow to fade in

          );

        }

      }

    }

    Here's what you see when you run the ICB command:

    Custom balloon notification

    TrackBack

    TrackBack URL for this entry:
    http://www.typepad.com/services/trackback/6a00d83452464869e200e551dd83f18834

    Listed below are links to weblogs that reference Showing a balloon notification using the InfoCenter API in AutoCAD 2009:

    Comments

    Cool, I've been wanting to do that for a while now. Will it work in 2008? I see the DLL's are there.

    Sorry - this is a new API in 2009. I'll post something on TrayItem.ShowBubbleWindow() sometime next week, I hope.

    Kean

    it works in A2008, however, the balloon notificaction is justified to the left hand side of the screen with the 'communication dish' icon residing over the 'draw' menu even though the communication area is on the right hand side

    Thanks, Mark.

    Actually, yes - now that I've tried it in 2008, I see the balloon there, too (and on the right, as in 2009 - not sure what's different about your configuration).

    Our internal design docs implied this was 2009 only, but it seems it was there as an undocumented/unsupported API in 2008.

    Regards,

    Kean

    Well - it seems it's even documented (and therefore supported) for 2008.

    Kean

    Verify your Comment

    Previewing your Comment

    This is only a preview. Your comment has not yet been posted.

    Working...
    Your comment could not be posted. Error type:
    Your comment has been posted. Post another comment

    The letters and numbers you entered did not match the image. Please try again.

    As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

    Having trouble reading this image? View an alternate.

    Working...

    Post a comment

    Feed & Share

    Search