Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Stopping construction in one function, changing a parameter in the Main method, and then continuing the Main method

$
0
0

Hello All,

In one of my C# classes, I have path-counter object (paths) that decrements from the number of specified paths that I request upon execution of my GUI, fed as a parameter into mystatic void Main() method.  In another function (Track()), the paths get built and are then fed intoMain() for printing and the like.
Is there a way that I could do the following, from the Track() function:

if (certain condition is met)
{
     cease building that path;
     start building the next path (thereby decrementing paths by 1 in Main());
}

-----------------------------------------------------------------------

Code snippet (necessary parts highlighted in yellow):
        public static void Main(int numberofpaths) 
        {
            MOVE testRun = new MOVE();
            StreamWriter output_file3 = new StreamWriter("PATHS.txt");
            int paths = Convert.ToInt32(numberofpaths);   
            int pathCnt = 0; 
            output_file3.WriteLine("WRITES SOMETHING");
            while (paths > 0)
            {
                testRun.ChooseStart();
               paths--;
                pathCnt++;
                int moveCount = LIST_1.Count();           //Counts the number of items in the list object
                for (int items = 0; items < itemCount; items++)
                {
                    output_file3.WriteLine("WRITES SOMETHING", LIST_1, LIST_2);
                }
                CLEAR LIST_1;
                CLEAR LIST_2;
            }
            output_file3.Flush();
            output_file3.Close();
        }

public void ChooseStart()
{
   Do something;
}

public void Track(double startLocfromChoose)    //Takes parameter from ChooseStart, renames it, and uses it
        {
              Do some things;

if (condition is met)
               {
                    cease building this path;
                    start buidling next path (decrementpaths by 1 in Main()) and start Main() again;
                }

        }

I haven't found any reasonable direction for this so far.  Any advice would help.  Thanks.

-AD-

               

AndrewDen


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>