ITrackCancel.CancelOnClick

373
2
06-16-2011 09:06 AM
SukhjitPal
New Contributor
Hi,
Here's what I am trying to do:

ITrackCancel myTrackCancel = new TrackCancelClass();
myTrackCancel.Reset();  //no problem here
myTrackCancel.CancelOnClick = false; // I get a System.NotImplementedException here

The exception message is "The method or operation is not implemented".

Has anybody experienced this before? Do I need to do anything to the myTrackCancel beforehand so I can set those bool values?

Thank You,
Sukhjit
0 Kudos
2 Replies
SandhyaYamarthi
New Contributor
Hi,
Here's what I am trying to do:

ITrackCancel myTrackCancel = new TrackCancelClass();
myTrackCancel.Reset();  //no problem here
myTrackCancel.CancelOnClick = false; // I get a System.NotImplementedException here

The exception message is "The method or operation is not implemented".

Has anybody experienced this before? Do I need to do anything to the myTrackCancel beforehand so I can set those bool values?

Thank You,
Sukhjit


Just try not to reset the TrackCancel object before setting its CancelOnClick property.

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//004200000235000000

ITrackCancel.Reset:
"Resets the manager after the associated operation is finished."
"The Reset method should be called just before a process that may be cancelled, such as a lengthy operation, begins. The Reset method sets the state of the CancelTracker to uncancelled and returns the internal counter, which is used to update the Progressor to zero."

See this example code where it doesn't implement the 'Reset' method:
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/d/00010000001w000000.ht...

Let me know if it doesn't help.
0 Kudos
SukhjitPal
New Contributor
Hi Sandhya!
Thanks a lot for your reply.

I figured out the solution shortly after my post 🙂 I came back to post the solution in case somebody else was struggling with the same issue and realized that you've replied to me already.

Here's what I did to solve my issue:

ITrackCancel myCancelTracker = new CancelTrackerClass();
myCancelTracker.CancelOnClick = true;
myCancelTracker.CancelOnKeyPress = true;

Both TrackCancelClass and CancelTrackerClass implement ITrackCancel but TrackCancelClass can only be used in Server Context. I needed to use CancelTrackerClass since I wanted to interrupt redrawing features on the map on click or on any key press.

It's so confusing since these two classes are named in such a similar way. I just wish esri people would've named them a little nicer so that I could tell a difference by just looking at the name.


Just try not to reset the TrackCancel object before setting its CancelOnClick property.

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//004200000235000000

ITrackCancel.Reset:
"Resets the manager after the associated operation is finished."
"The Reset method should be called just before a process that may be cancelled, such as a lengthy operation, begins. The Reset method sets the state of the CancelTracker to uncancelled and returns the internal counter, which is used to update the Progressor to zero."

See this example code where it doesn't implement the 'Reset' method:
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/d/00010000001w000000.ht...

Let me know if it doesn't help.
0 Kudos