Partager via


.NET Sidebar Gadget Creator Update #2

I had quite the breakthrough today. First off, I totally rewrote major portions of the .NET Sidebar Gadget Creator. It is now a wizard (photos below) that leads you through the steps to create a Vista Sidebar that uses .NET. Here are some of the changes (then I'll explain my breakthrough):

  • You can now create any .NET type. You have the "option" of embedding a UserControl as the UI but it isn't required. Have a cool class you want to use. This makes it easy.
  • A .gadget file is automatically created for you. More often than not, you will need to fiddle around with the final result, but just in case, I went ahead and added this feature anyway
  • Reworked the entire act of copying to temp directory and registering assemblies...this is the breakthrough

As one reader pointed out, they noticed that I was simply copying the .NET assembly to the temp folder, creating the COM Interop registry keys to point to that location and having sidebar/Trident load it up from there. Was that the ideal solution? No way. He was right. It was the wrong way to do it. The benefit was that it allowed you to uninstall your gadget from the Sidebar UI, but left the file in the temp directory and orphaned registry keys.

Here's the breakthrough. What if I told you that your .NET assemblies are not copyed over. They remain in your gadget directory. What if I also told you, you don't have to worry about registration. Yeah, so. You didn't with previous versions either right since my tool did it for you. Well, what if I told you that my tool also doesn't have to worry about registering your assemblies for COM interop? You heard right. Nothing about your assembly ever gets registered into the registry (i.e. I don't register your assembly for COM interop). However, you will still be loaded just fine and if you are a UserControl based object, you will be embedded. Additionally, you can still be safely uninstalled and all the gadget files will be deleted just fine.

If you have a clue as to how I do this...feel free to submit your best guesses. I'm going to put the finishing touches on the tool and send it out. After that, I'll have a series of tutorials and an examination of the code (as well as my solution to how I solved this problem).

Here's some pics:

Comments

  • Anonymous
    November 19, 2007
    The comment has been removed

  • Anonymous
    November 19, 2007
    The comment has been removed

  • Anonymous
    November 19, 2007
    The comment has been removed

  • Anonymous
    February 06, 2008
    Hello, i have for a cople of days now tried to figure out which kind of usercontrol there has to be in the dll. It would be cool if you could show the code for the bouncing ball example, or discribe how to create the dll library. Thx. in advance K. Sorry for my bad eng.

  • Anonymous
    February 10, 2008
    OK, so i found a solution to my last question. However i can't figure out the error i am getting now, every time i try to install this gadget i get the error: cannot create an instance of type my_namspace.my_class This only happens to some of my .net gadgets, while others runs fine. I am not using any external stuff like Direct X or simmelar. Can't figure out why i am getting an error, and the error is not saying much. I found that the error happens when the generated JavaScript is calling : myControl = AxSBHost.EmbedControl("Tiny_game, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null","Tiny_game.Class1") Hope somone will help me. Please.

  • Anonymous
    February 10, 2008
    If anyone should need the answar to my last Q, here is some of the C# code for the dll file: My_namespace {  using System;  using System.Windows.Forms;  using ...  ...  [ComVisible(true)]  public Class1 : UserControl  {    public Class1()    {      Init();    }      /*    Make an text label and add it to the control of     this usercontrol.    Call invalidate, so the userconrol will be redrawn    */    public void Init()    {      Label l = new Label();      l.Text = "Hello World";      this.Controls.add(l);      //Courses the control to redraw itself      this.Invalidate();    }  } }

  • Anonymous
    February 11, 2008
    It seems nobody wants to answar my question in here, which is OK. But i was wundering if there is any place else that deals with this kind of stuff???? :-)

  • Anonymous
    July 27, 2008
    The comment has been removed

  • Anonymous
    October 14, 2008
    Hi, When running more then one type of .NET Gadget I receive the following error: cannot create an instance of type [my namespace my control] Does any one else experience this? I see it happened to Kasper too? Did you manage to resolve this?

  • Anonymous
    September 04, 2012
    So how can I download this Gadget Creator? I can't see a download link. Or are you just teasing us?