Solved

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

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Upgrade code from VS 2010 to VS 2015 7 31
Converting PHP triple des decrypt to c# 9 62
Shared files and folders migration 2 24
c#, case, if 4 16
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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 …

685 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