Freddy
Freddy

Reputation: 970

launching multiple forms from one application

I have 4 old upload modules. These upload modules make use of a dll someone written a long time ago. This project is lost and I don't really want do decompile the dll.

I would like to have one upload module where they can select one of these 4 upload modules.

They all have this code in the program.cs:

[STAThread]
static void Main()
{
  new APACMiscUM();
}

This class triggers the dll.

namespace ApacMiscUploadModule
{
    class APACMiscUM : UploadModule.UploadModule
    {
        public override void applicationStart()
        {
            showMessage("Upload Module", Color.Green);
            Connection = new SqlConnection("X");
        }
        public override void fileSelected()
        { ... }
    }
}

When the new object is created (APACMiscUM) the dll (UploadModule.UploadModule) creates the interface. How can I activate this form after clicking a button on a new form?

ADDITIONAL INFO:

enter image description here enter image description here

Upvotes: 0

Views: 63

Answers (2)

denniebee
denniebee

Reputation: 501

Copy the upload-modules (APACMiscUM.cs, APACUM.cs, EMEASeiUM.cs and EMEAUM.cs) to a windows form project. Reference the upload-dll. Place four buttons on the form. Create code like this:

    private void button1_Click(object sender, EventArgs e)
    {
        new APACMiscUM();
    }

    private void button2_Click(object sender, EventArgs e)
    {
        new APACUM();
    }

    private void button3_Click(object sender, EventArgs e)
    {
        new EMEASeiUM();
    }

    private void button4_Click(object sender, EventArgs e)
    {
        new EMEAUM();
    }

It is fairly straightforward.

Upvotes: 1

fhnaseer
fhnaseer

Reputation: 7277

Save the object created fromAPACMiscUM. Call object methods, simple enough I guess.

[STAThread]
static void Main()
{
  var classObject = new APACMiscUM();
  var someReturnTyoe = classObject.SomeMethod(SomeArgument)
}

Upvotes: 1

Related Questions