tips

SharpDevelop can convert VB to C#

Interface

You can only inherit from 1 class in C# (unlike C++), so to ensure you rovide functionality, you use Interface.

The class you reference will have the interefaces that are mandatory - you now need to include them.

I2 Development

You need to add (at least) the following control to your project.

  • linkdata.ocx
  • i2.notebook.support

Visual Studio

When you have the project compiled up - you need to register the DLL output,

You can do this using VS

VS

  • right click project
  • properties
    • build
    • scroll down and ensure Register Com for Interop is ticked.

Manually

Look for the regasm.exe this registers a DLL for GAC.

c:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe /u "c:\i2-Dev\Basic-VB.ConvertedToC#\bin\x86\Debug\BasicPlugin.dll"


rem c:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe /u "c:\i2-Dev\Basic-VB.ConvertedToC#\bin\x86\Debug\BasicPlugin.dll"
rem c:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe  "c:\i2-Dev\Basic-VB.ConvertedToC#\bin\x86\Debug\BasicPlugin.dll"

Embedded resources

Add Resource to the Project

  • Project

    • Properties
    • Resource
    • Click to Add
  • Open Resources

  • Add Exsting

    • Select and Accept
  • Embedding

  • Select the resources
  • Build Action
  • Embedded Resource

List Resource

Use this code

System.Reflection.Assembly thisExe;
           thisExe = System.Reflection.Assembly.GetExecutingAssembly();
           string[] resources = thisExe.GetManifestResourceNames();
           string list = "";

           // Build the string of resources.
           foreach (string resource in resources)
               list += resource + "\r\n";

To Add a resource

using System.IO;
using System.Reflection;

Assembly myAssembly = Assembly.GetExecutingAssembly();
           Stream myStream = myAssembly.GetManifestResourceStream("Console.Resources.img2.jpg");
           //Bitmap image = new Bitmap(myStream);
           Image i = new Bitmap(myStream);