How do I subscribe to INetworkLoaderProgress using .NET?

788
1
Jump to solution
08-09-2014 07:16 AM
KirkKuykendall
Occasional Contributor III

I'm using INetworkLoader3 to build a geometric network.  I'd like to show progress on the UI.

It appears INetworkLoaderProgress is designed for this purpose, but I don't see how to use it.

Also I see INetworkLoaderProgress_Sinkhelper class (not interface), but again, no examples of using it.

Can someone post some code showing how to do this?

Thanks!

0 Kudos
1 Solution

Accepted Solutions
ErinBrimhall
Occasional Contributor II

Hi Kirk,

I do not have a network dataset or the supporting objects to test this, but I believe what you want to do is cast your INetworkLoader3 object as INetworkLoaderProgress_Events and subscribe to the Step and PutMessage events.  Inside the event-handlers is where you could presumably add your logic for updating the UI with progress info for the user.

For example:

INetworkLoader networkLoader = new NetworkLoaderClass();

(networkLoader as INetworkLoaderProgress_Event).Step += NetworkLoader_Step;

(networkLoader as INetworkLoaderProgress_Event).PutMessage += NetworkLoader_PutMessage;

protected void NetworkLoader_Step()

{

     // Update UI here.

}

protected void NetworkLoader_PutMessage(esriNetworkLoaderProgress progress, string message)

{

     // Update UI here.

}

View solution in original post

0 Kudos
1 Reply
ErinBrimhall
Occasional Contributor II

Hi Kirk,

I do not have a network dataset or the supporting objects to test this, but I believe what you want to do is cast your INetworkLoader3 object as INetworkLoaderProgress_Events and subscribe to the Step and PutMessage events.  Inside the event-handlers is where you could presumably add your logic for updating the UI with progress info for the user.

For example:

INetworkLoader networkLoader = new NetworkLoaderClass();

(networkLoader as INetworkLoaderProgress_Event).Step += NetworkLoader_Step;

(networkLoader as INetworkLoaderProgress_Event).PutMessage += NetworkLoader_PutMessage;

protected void NetworkLoader_Step()

{

     // Update UI here.

}

protected void NetworkLoader_PutMessage(esriNetworkLoaderProgress progress, string message)

{

     // Update UI here.

}

0 Kudos