Ejemplo n.º 1
0
        public static int Main(string[] args)
        {
            Gtk.Application.Init();
            MainView mainForm = new MainView();
            MainPresenter mainPresenter = new MainPresenter();

            // Clean up temporary files.
            string tempFolder = Path.Combine(Path.GetTempPath(), "ApsimX");
            if (Directory.Exists(tempFolder))
                Directory.Delete(tempFolder, true);
            Directory.CreateDirectory(tempFolder);
            Environment.SetEnvironmentVariable("TMP", tempFolder, EnvironmentVariableTarget.Process);
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(Manager.ResolveManagerAssembliesEventHandler);

            try
            {
                mainPresenter.Attach(mainForm, args);
                mainForm.MainWidget.ShowAll();
                if (args.Length == 0 || Path.GetExtension(args[0]) != ".cs")
                    Gtk.Application.Run();
            }
            catch (Exception err)
            {
                File.WriteAllText("errors.txt", err.ToString());
                return 1;
            }
            return 0;
        }
Ejemplo n.º 2
0
        public static int Main(string[] args)
        {
            LoadTheme();
#if NETCOREAPP
            Task.Run(() => Intellisense.CodeCompletionService.Init());
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
#endif

            Gtk.Application.Init();
#if NETFRAMEWORK
            Gtk.Settings.Default.SetLongProperty("gtk-menu-images", 1, "");
#else
            Gtk.Settings.Default.SetProperty("gtk-overlay-scrolling", new GLib.Value(0));
#endif
            IntellisensePresenter.Init();
            MainView      mainForm      = new MainView();
            MainPresenter mainPresenter = new MainPresenter();

            try
            {
                mainPresenter.Attach(mainForm, args);
                mainForm.MainWidget.ShowAll();
                if (args.Length == 0 || Path.GetExtension(args[0]) != ".cs")
                {
                    Gtk.Application.Run();
                }
            }
            catch (Exception err)
            {
                File.WriteAllText("errors.txt", err.ToString());
                return(1);
            }
            return(0);
        }
Ejemplo n.º 3
0
        public static void UITestSetup()
        {
            Configuration.Settings.DarkTheme = false;

            Gtk.Application.Init();
            Gtk.Settings.Default.SetLongProperty("gtk-menu-images", 1, "");
            IntellisensePresenter.Init();
            mainForm        = new MainView();
            MasterPresenter = new MainPresenter();

            MasterPresenter.Attach(mainForm, null);
            mainForm.MainWidget.ShowAll();
        }
Ejemplo n.º 4
0
        public static int Main(string[] args)
        {
            Gtk.Application.Init();
            Gtk.Settings.Default.SetLongProperty("gtk-menu-images", 1, "");
            MainView      mainForm      = new MainView();
            MainPresenter mainPresenter = new MainPresenter();

            // Clean up temporary files.
            string tempFolder = Path.Combine(Path.GetTempPath(), "ApsimX");

            if (Directory.Exists(tempFolder))
            {
                // This may fail if another ApsimX instance is running. If so,
                // we just ignore the exception and leave the cleanup for another day.
                try
                {
                    Directory.Delete(tempFolder, true);
                }
                catch (Exception)
                {
                }
            }
            // Ensure the system has time to complete the deletion before we go ahead and recreate the folder
            while (Gtk.Application.EventsPending())
            {
                Gtk.Application.RunIteration();
            }
            Directory.CreateDirectory(tempFolder);
            if (!Path.GetTempPath().Contains("ApsimX"))
            {
                Environment.SetEnvironmentVariable("TMP", tempFolder, EnvironmentVariableTarget.Process);
            }
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(Manager.ResolveManagerAssembliesEventHandler);

            try
            {
                mainPresenter.Attach(mainForm, args);
                mainForm.MainWidget.ShowAll();
                if (args.Length == 0 || Path.GetExtension(args[0]) != ".cs")
                {
                    Gtk.Application.Run();
                }
            }
            catch (Exception err)
            {
                File.WriteAllText("errors.txt", err.ToString());
                return(1);
            }
            return(0);
        }
Ejemplo n.º 5
0
        static int Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            MainView      mainForm      = new MainView();
            MainPresenter mainPresenter = new MainPresenter();

            // Clean up temporary files.
            string tempFolder = Path.Combine(Path.GetTempPath(), "ApsimX");

            if (Directory.Exists(tempFolder))
            {
                // This may fail if another ApsimX instance is running. If so,
                // we just ignore the exception and leave the cleanup for another day.
                try
                {
                    Directory.Delete(tempFolder, true);
                }
                catch (Exception)
                {
                }
            }
            Directory.CreateDirectory(tempFolder);
            Environment.SetEnvironmentVariable("TMP", tempFolder, EnvironmentVariableTarget.Process);
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(Manager.ResolveManagerAssembliesEventHandler);

            try
            {
                mainPresenter.Attach(mainForm, args);
                if (args.Length == 0 || Path.GetExtension(args[0]) != ".cs")
                {
                    Application.Run(mainForm);
                }
            }
            catch (Exception err)
            {
                File.WriteAllText("errors.txt", err.ToString());
                return(1);
            }

            return(0);
        }
Ejemplo n.º 6
0
        static int Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            MainView      mainForm      = new MainView();
            MainPresenter mainPresenter = new MainPresenter();

            try
            {
                mainPresenter.Attach(mainForm, args);
                if (args.Length == 0 || Path.GetExtension(args[0]) != ".cs")
                {
                    Application.Run(mainForm);
                }
            }
            catch (Exception err)
            {
                File.WriteAllText("errors.txt", err.ToString());
                return(1);
            }

            return(0);
        }
Ejemplo n.º 7
0
        public static int Main(string[] args)
        {
            Gtk.Application.Init();
            Gtk.Settings.Default.SetLongProperty("gtk-menu-images", 1, "");
            MainView      mainForm      = new MainView();
            MainPresenter mainPresenter = new MainPresenter();

            try
            {
                mainPresenter.Attach(mainForm, args);
                mainForm.MainWidget.ShowAll();
                if (args.Length == 0 || Path.GetExtension(args[0]) != ".cs")
                {
                    Gtk.Application.Run();
                }
            }
            catch (Exception err)
            {
                File.WriteAllText("errors.txt", err.ToString());
                return(1);
            }
            return(0);
        }
Ejemplo n.º 8
0
        static int Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            MainView mainForm = new MainView();
            MainPresenter mainPresenter = new MainPresenter();

            // Clean up temporary files.
            string tempFolder = Path.Combine(Path.GetTempPath(), "ApsimX");
            if (Directory.Exists(tempFolder))
                // This may fail if another ApsimX instance is running. If so,
                // we just ignore the exception and leave the cleanup for another day.
                try
                {
                    Directory.Delete(tempFolder, true);
                }
                catch (Exception)
                {
                }
            Directory.CreateDirectory(tempFolder);
            Environment.SetEnvironmentVariable("TMP", tempFolder, EnvironmentVariableTarget.Process);
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(Manager.ResolveManagerAssembliesEventHandler);

            try
            {
                mainPresenter.Attach(mainForm, args);
                if (args.Length == 0 || Path.GetExtension(args[0]) != ".cs")
                    Application.Run(mainForm);
            }
            catch (Exception err)
            {
                File.WriteAllText("errors.txt", err.ToString());
                return 1;
            }

            return 0;
        }