Click here to Skip to main content
15,908,834 members
Home / Discussions / C#
   

C#

 
GeneralRe: Begin printing at row x column y Pin
Roger CS15-Oct-07 4:15
Roger CS15-Oct-07 4:15 
QuestionThread & UI Pin
Archyami12-Oct-07 17:11
Archyami12-Oct-07 17:11 
AnswerRe: Thread & UI Pin
led mike12-Oct-07 20:26
led mike12-Oct-07 20:26 
AnswerRe: Thread & UI Pin
mav.northwind12-Oct-07 20:30
mav.northwind12-Oct-07 20:30 
GeneralRe: Thread & UI Pin
Archyami12-Oct-07 22:42
Archyami12-Oct-07 22:42 
QuestionDelegate awkwardness---is there a better way? Pin
Domenic Denicola12-Oct-07 16:35
Domenic Denicola12-Oct-07 16:35 
AnswerRe: Delegate awkwardness---is there a better way? Pin
PIEBALDconsult12-Oct-07 16:43
mvePIEBALDconsult12-Oct-07 16:43 
AnswerRe: Delegate awkwardness---is there a better way? Pin
S. Senthil Kumar12-Oct-07 22:45
S. Senthil Kumar12-Oct-07 22:45 
I think the basic problem you are facing is that you are trying to introduce state (the cancel variable) into the methods. Would it be possible to put each method in a class? Something like
abstract class Operation
{
   bool cancelIssued;
   void Cancel() { cancelIssued = true; }
   void Execute();
}

class A : Operation
{
   int a; string b;
   public A(int a, string b)
   {
      this.a = a;
      this.b = b;
   }

   public override void Execute() { MethodA(a, b); }

   void MethodA(int a, string b)
   {
      // process a
      if (this.cancelIssued)
         return;
      // process b
   }
}


This allows the user to do something like

A a = new A(1, "Foo")
Control.PerformOperation(a);
Control.PerformOperation(someOtherClassInstance);


a.Cancel()


from another thread.

Regards
Senthil [MVP - Visual C#]
_____________________________
My Blog | My Articles | My Flickr | WinMacro

GeneralRe: Delegate awkwardness---is there a better way? Pin
Domenic Denicola13-Oct-07 7:28
Domenic Denicola13-Oct-07 7:28 
QuestionExtracting files from inside a file archive Pin
Luminare12-Oct-07 16:16
Luminare12-Oct-07 16:16 
AnswerRe: Extracting files from inside a file archive Pin
Roger CS13-Oct-07 11:52
Roger CS13-Oct-07 11:52 
GeneralRe: Extracting files from inside a file archive Pin
Luminare14-Oct-07 10:48
Luminare14-Oct-07 10:48 
QuestionSystem.IO.Exception Pin
solutionsville12-Oct-07 13:53
solutionsville12-Oct-07 13:53 
AnswerRe: System.IO.Exception Pin
Dave Kreskowiak12-Oct-07 15:35
mveDave Kreskowiak12-Oct-07 15:35 
GeneralRe: System.IO.Exception Pin
solutionsville12-Oct-07 16:02
solutionsville12-Oct-07 16:02 
GeneralRe: System.IO.Exception Pin
Dave Kreskowiak12-Oct-07 17:00
mveDave Kreskowiak12-Oct-07 17:00 
GeneralRe: System.IO.Exception Pin
solutionsville12-Oct-07 17:07
solutionsville12-Oct-07 17:07 
GeneralRe: System.IO.Exception Pin
Dave Kreskowiak13-Oct-07 3:01
mveDave Kreskowiak13-Oct-07 3:01 
AnswerRe: System.IO.Exception Pin
solutionsville13-Oct-07 9:44
solutionsville13-Oct-07 9:44 
QuestionProblem with launching an external process Pin
Togakangaroo12-Oct-07 10:44
Togakangaroo12-Oct-07 10:44 
AnswerRe: Problem with launching an external process Pin
Ennis Ray Lynch, Jr.12-Oct-07 11:28
Ennis Ray Lynch, Jr.12-Oct-07 11:28 
AnswerRe: Problem with launching an external process Pin
Daniel Grunwald12-Oct-07 23:53
Daniel Grunwald12-Oct-07 23:53 
AnswerRe: Problem with launching an external process Pin
Togakangaroo15-Oct-07 4:34
Togakangaroo15-Oct-07 4:34 
AnswerRe: Problem with launching an external process Pin
Togakangaroo15-Oct-07 7:09
Togakangaroo15-Oct-07 7:09 
QuestionButton Questions Pin
C# Beginner Nick12-Oct-07 10:08
C# Beginner Nick12-Oct-07 10:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.