static int _runFinder(IFinder finder, IHeuristic h, IMap map, bool window, bool noshow, int blocksize, int sleep)
        {
            if (!noshow)
            {
                if (sleep > 0)
                {
                    finder.SleepUITimeInMs = sleep;
                }

                var viewer =
                    window ?
                    ViewerFactory.GetOpenGlViewerImplementation(blocksize)
                    : ViewerFactory.GetConsoleViewerImplementation();


                viewer.SetFinder(finder);
                viewer.Run(map, h);
            }
            else
            {
                if (finder.Find(map, h))
                {
                    var path = map.GetPath();

                    AbstractViewer.ShowEndLog(finder, path, new Pathfinder.Abstraction.FinderEventArgs
                    {
                        Finded             = true,
                        GridMap            = map,
                        ExpandedNodesCount = map.GetMaxExpandedNodes(),
                        PassedTimeInMs     = finder.GetProcessedTime(),
                        Step = 0
                    });

                    var result = FileTool.GetTextRepresentation(map, false, path);

                    if (!window)
                    {
                        Console.WriteLine(result);
                    }
                    else
                    {
                        MapViewWindow.OpenGlWindow(result, blocksize);
                    }
                }
                else
                {
                    Console.WriteLine("Cant find a path");
                }
            }



            return(0);
        }
        private void EndWraper(object sender, EventArgs _e)
        {
            Console.Clear();
            var e = (FinderEventArgs)_e;

            if (e.Finded)
            {
                Path     = GridMap.GetPath();
                drawPath = true;
            }
            AbstractViewer.ShowEndLog(_finder, Path, e);
        }