Solved

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

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Starting up a Project

707 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