Exemplo n.º 1
0
        [STAThread] //Runs faster with the tag, but seems to have some issue with exiting
        static void Main(string[] args)
        {
            string xmlInputFile;
            string mapOutputDirectory;
            string textOutputDir;
            string xmlBackup;

#if DEBUG
            Console.WriteLine("calling check license");
#endif

            CheckLicense();
            frmInput f = new frmInput();

#if DEBUG
            Console.WriteLine("calling LoadArgs");
#endif
            LoadArgs(args, out xmlInputFile, out mapOutputDirectory, out textOutputDir, out xmlBackup);
#if DEBUG
            Console.WriteLine("Calling DoBackUpLoad");
#endif
            BackUpParams backupParms = DoBackUpLoad(args, mapOutputDirectory, textOutputDir);
#if DEBUG
            Console.WriteLine("Calling DoRun");
#endif
            f.doRun(xmlInputFile, mapOutputDirectory, textOutputDir, xmlBackup, backupParms);

            //ESRI.ArcGIS.ADF.COMSupport.AOUninitialize.Shutdown();
            System.Environment.Exit(0);

            //thisProc.Kill();
            //Console.WriteLine("End of program");
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run( new frm Input());
            //Console.WriteLine("I'm in is licensed");
            if (ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop))
            {
                //Console.WriteLine("Inside binding");
                ESRI.ArcGIS.RuntimeManager.BindLicense(ESRI.ArcGIS.ProductCode.EngineOrDesktop);
                //Console.WriteLine("Bound and checked out license");
            }

            if (args.Length < 4)
            {
                usage();
                Environment.Exit(-1);
            }


            frmInput f = new frmInput();


            string xmlInputFile       = args[0];
            string mapOutputDirectory = args[1];
            string textOutputDir      = args[2];
            string xmlBackup          = args[3];

            f.doRun(xmlInputFile, mapOutputDirectory, textOutputDir, xmlBackup);

            //Console.WriteLine("Finished doRun");

            //Tried disposing form
            //f.Dispose();
            //if (f.IsDisposed)
            //{
            //    Console.WriteLine("Disposed form!");
            //}


            //Tried multiple types of exits
            //Do we need to force an exit here?
            //Environment.FailFast(null);
            //Console.WriteLine("Trying return");
            //return;
            //Console.WriteLine("Trying Application.Exit()");
            //Application.Exit();
            //Console.WriteLine("Trying Environment.Exit(0)");
            //Environment.Exit(0);


            //Tried garbage collection
            //GC.Collect();
            //Console.WriteLine("Waiting for finalizers");
            //GC.WaitForPendingFinalizers();

            //Tried sleeping
            //System.Threading.Thread.Sleep(5000);

            //Process thisProc = Process.GetCurrentProcess();
            //ProcessThreadCollection myThreads = thisProc.Threads;
            //foreach (ProcessThread pt in myThreads)
            //{
            //    DateTime startTime = pt.StartTime;
            //    TimeSpan cpuTime = pt.TotalProcessorTime;
            //int priority = pt.BasePriority;
            //    ThreadState ts = pt.ThreadState;

            //    Console.WriteLine("thread:  {0}", pt.Id);
            //    Console.WriteLine("    started: {0}", startTime.ToString());
            //    Console.WriteLine("    CPU time: {0}", cpuTime);
            //    Console.WriteLine("    priority: {0}", priority);
            //    Console.WriteLine("    thread state: {0}", ts.ToString());

            //    if (priority == 10)
            //    {
            //        Console.WriteLine("Disposing Thread!!!!");
            //        pt.Dispose();
            //    }
            //}

            Application.Exit();
            Environment.Exit(0);

            //thisProc.Kill();



            //Console.WriteLine("End of program");
        }