Solved

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

Posted on 2014-04-06
3
556 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 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39982185
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]
ID: 39982195
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
ID: 39984599
Thank you!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
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 fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

911 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

16 Experts available now in Live!

Get 1:1 Help Now