Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2014-04-06
3
Medium Priority
?
581 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 2000 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 143

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Introduction to Processes

609 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