/// <summary>
        /// Inishizes a new instance of this class form the private constructor and then starts
        /// a new background thread for it to run in.
        /// </summary>
        /// <param name="nDisplay">The CDrawer display box we use to render</param>
        /// <param name="nPath">The path we will want to load an image from</param>
        /// <param name="nMaze">The parent form</param>
        /// <param name="ObjectReturn">The a out for the parent so you can call back to this object if necassary</param>
        /// <returns>The thread started for if you would like to keep track of it</returns>
        static public Thread StartNewThreadedLoader(CDrawer nDisplay, string nPath, MazeSolver nMaze, out BackGroundLoader ObjectReturn)
        {
            ObjectReturn = new BackGroundLoader(nDisplay, nPath, nMaze);
            Thread CurrentThread = new Thread(new ParameterizedThreadStart(StartThread));

            CurrentThread.IsBackground = true;
            CurrentThread.Start(ObjectReturn);
            return(CurrentThread);
        }
예제 #2
0
 /// <summary>
 /// Constructor This is called indirectly by StartNewThreadedSolver
 /// Read thet for the params as there are a lot of them and it is a mimic of this
 /// </summary>
 /// <param name="nStart">Set Start point</param>
 /// <param name="nEnd">Set End point</param>
 /// <param name="nDisplay">Set Display to update</param>
 /// <param name="nSpaces">Set Maze Map to use</param>
 /// <param name="nParent">Set Parent to update backto</param>
 /// <param name="InishSpeed">Set insihal speed to Sinc with parent at start</param>
 public BackGroundMazeSolver(Point nStart, Point nEnd, CDrawer nDisplay, SpaceStates[,] nSpaces, MazeSolver nParent, int InishSpeed)
 {
     _Speed = InishSpeed;
     SpeedUpdateCallBack = new VoidIntUpdate(SpeedUpdate);
     Start   = nStart;
     End     = nEnd;
     Display = nDisplay;
     Spaces  = nSpaces;
     Parent  = nParent;
     Count   = 0;
 }
 /// <summary>
 /// The private constructor that is only to be called indirectly when creating a new thread so this is
 /// kind of vage ref StartNewThreadedLoader for more information as it is the public indirect caller
 /// </summary>
 /// <param name="nDisplay">the display</param>
 /// <param name="nPath">the image Path</param>
 /// <param name="nMaze">The parent Form might template this for future use</param>
 BackGroundLoader(CDrawer nDisplay, string nPath, MazeSolver nMaze)
 {
     Display = nDisplay;
     Path    = nPath;
     Maze    = nMaze;
 }
예제 #4
0
        /// <summary>
        /// Ish this class and gives it its own thread
        /// call in place of constructor
        /// you know think this is one of the first that ive not had a public constructor
        /// </summary>
        /// <param name="nStart">Set readonly point</param>
        /// <param name="nEnd">Set readonly End point</param>
        /// <param name="nDisplay">Set readonly Display to update</param>
        /// <param name="nSpaces">Set insh Maze Map to use</param>
        /// <param name="nParent">Set readonly Parent to update backto</param>
        /// <param name="InishSpeed">Set insh speed to Sinc with parent at start</param>
        /// <param name="ObjectReturn">This class we created</param>
        /// <returns>The thread created by this if youd like to keep track of</returns>
        static public Thread StartNewThreadedSolver(Point Start, Point End, CDrawer Display, SpaceStates[,] Spaces, MazeSolver Parent, int inishSpeed, out BackGroundMazeSolver ObjectReturn)
        {
            ObjectReturn = new BackGroundMazeSolver(Start, End, Display, Spaces, Parent, inishSpeed);
            Thread CurrentThread = new Thread(new ParameterizedThreadStart(StartThread), 600000);

            CurrentThread.IsBackground = true;
            CurrentThread.Start(ObjectReturn);
            return(CurrentThread);
        }