Solved

How to write c# code to call a method in .NET dll

Posted on 2014-04-06
3
553 Views
Last Modified: 2014-04-07
Hi,

I need help writing the c# code for the the following method:
http://msdn.microsoft.com/en-us/library/hh418696.aspx

I need help understanding how to write code to receive the ACTION part of the method. In particular:

initialized
Type: System..::..Action
Called when the node is initialized.

shutdown
Type: System..::..Action
Called when the node is shutdown.

error
Type: System..::..Action<(Of <(<'Exception>)>)>
Called if an exception is raised in the node lifecycle management.

Here is my code so far:

using Microsoft.Dss.Hosting;
string ManifestToLoad = Settings.Default.Manifest;
DssEnvironment.Initialize(50000, 50001, ManifestToLoad);

I really need to know if there has been and error during the loading of the Manifest. Please let me know if you need more info.

Thank you!
0
Comment
Question by:SkyMagic
3 Comments
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
Comment Utility
You need to create 3 delegates that will be used as callbacks for each of the 3 scenarios required by the method signature. In other words, try modifying your call to something like this:

DssEnvironment.Initialize(50000, 50001, ManifestToLoad, OnIntialized, OnShutdown, OnError);

Open in new window


Then define those three methods within your class:

private void OnIntialized()
{
    MessageBox.Show("Initialized");
}

private void OnShutdown()
{
    MessageBox.Show("Shutdown");
}

private void OnError(Exception ex)
{
    MessageBox.Show("Error: " + ex.Message);
}

Open in new window

0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
that is basically nothing else than a function (or often just a "delegate" function code):
http://msdn.microsoft.com/en-us/library/bb534741
0
 

Author Closing Comment

by:SkyMagic
Comment Utility
Thank you!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now