예제 #1
0
        public static void Initialize()
        {
            if (Platform.Instance == null)
            {
                try
                {
                    var platform = new Eto.GtkSharp.Platform();

                    platform.LoadAssembly(typeof(EtoInitializer).Assembly);

                    new Eto.Forms.Application(platform).Attach();
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"{ex}");
                }
#if Mac
                if (EtoEnvironment.Platform.IsMac)
                {
                    var plat = Platform.Instance;
                    if (!plat.IsMac)
                    {
                        // use some Mac handlers even when using Gtk platform as base
                        plat.Add <Cursor.IHandler>(() => new Eto.Mac.Forms.CursorHandler());
                    }
                }
#endif
            }
        }
예제 #2
0
        public static void Main(string[] args)
        {
            var platform = new Eto.GtkSharp.Platform();

            platform.Add(typeof(Plot.IHandler), () => new Eto.OxyPlot.Gtk.PlotHandler());
            new Application(platform).Run(new MainForm());
        }
예제 #3
0
        public static void Main(string[] args)
        {
            var platform = new Eto.GtkSharp.Platform();

            var app = new MainApplication(platform);

            app.Run(args);
        }
예제 #4
0
        static void Main()
        {
            var platform = new Eto.GtkSharp.Platform();

            platform.Add <GLSurface.IHandler>(() => new Eto.OpenTK.Gtk.GtkGlSurfaceHandler());

            new Application(platform).Run(new MainForm());
        }
예제 #5
0
파일: Startup.cs 프로젝트: mhusen/Eto
		//[STAThread]
		static void Main(string[] args)
		{
			var generator = new Eto.GtkSharp.Platform();
			
			var app = new TestApplication(generator);
			app.TestAssemblies.Add(typeof(Startup).Assembly);
			app.Run();
		}
예제 #6
0
        public static void Main(string[] args)
        {
            Platform plat = new Eto.GtkSharp.Platform();

            plat.Add <DragDropController.IDragDropController>(() => { return(new DragDropGTK()); });

            new App(args, new Application(Platforms.Gtk2));
        }
예제 #7
0
        public static void Main(string[] args)
        {
            var platform = new Eto.GtkSharp.Platform();

            platform.Add <CustomEtoButton.IHandler>(() => new CustomEtoButtonHandler());

            new Application(platform).Run(new Main());
        }
예제 #8
0
        public static void Main(string[] args)
        {
            VeldridSurface.InitializeOpenTK();

            var platform = new Eto.GtkSharp.Platform();

            new Application(platform).Run(new MainForm());
        }
예제 #9
0
        static void Main(string[] args)
        {
            var platform = new Eto.GtkSharp.Platform();

            platform.Add <VideoView.IVideoView>(() => new VideoViewGtkHandler());

            Core.Initialize();
            new Application(platform).Run(new MainForm());
        }
예제 #10
0
파일: Program.cs 프로젝트: johny5w/Pulsar4x
        public static void Main(string[] args)
        {
            //this MUST be the first line in the program or any text + the opengl window will cause it to segfault
            OpenTK.Toolkit.Init();
            var platform = new Eto.GtkSharp.Platform();

            platform.Add <RenderCanvas.IHandler>(() => new GtkGLSurfaceHandler());
            new Pulsar4XApplication(platform).Run();
        }
예제 #11
0
파일: Startup.cs 프로젝트: zzlvff/Eto
        //[STAThread]
        static void Main(string[] args)
        {
            var platform = new Eto.GtkSharp.Platform();

            var app = new TestApplication(platform);

            app.TestAssemblies.Add(typeof(Startup).Assembly);
            app.Run();
        }
예제 #12
0
        //[STAThread]
        static void Main(string[] args)
        {
#if DEBUG
            Debug.Listeners.Add(new ConsoleTraceListener());
#endif
            var generator = new Eto.GtkSharp.Platform();

            var app = new TestApplication(generator);
            app.Run();
        }
예제 #13
0
		//[STAThread]
		static void Main(string[] args)
		{
#if DEBUG
			Debug.Listeners.Add(new ConsoleTraceListener());
#endif
			var generator = new Eto.GtkSharp.Platform();
			
			var app = new TestApplication(generator);
			app.Run();
		}
예제 #14
0
        static void Main()
        {
            // set renderers

            string WinR, LinuxR, MacR;

            WinR   = "WinForms"; // WPF, WinForms, GTK
            LinuxR = "GTK";      // GTK, WinForms
            MacR   = "XamMac2";  // XamMac, WinForms, GTK

            Eto.Platform platform = null;

            if (RunningPlatform() == Platform.Windows)
            {
                switch (WinR)
                {
                case "WinForms":
                    platform = new Eto.WinForms.Platform();
                    platform.Add <ScintillaControl.IScintillaControl>(() => new WinForms.ScintillaControlHandler());
                    break;
                }
            }
            else if (RunningPlatform() == Platform.Linux)
            {
                switch (LinuxR)
                {
                case "WinForms":
                    platform = new Eto.WinForms.Platform();
                    platform.Add <ScintillaControl.IScintillaControl>(() => new WinForms.ScintillaControlHandler());
                    break;

                case "GTK":
                    platform = new Eto.GtkSharp.Platform();
                    platform.Add <ScintillaControl.IScintillaControl>(() => new GTK.ScintillaControlHandler());
                    break;
                }
            }
            else if (RunningPlatform() == Platform.Mac)
            {
                switch (MacR)
                {
                case "XamMac2":
                    platform = new Eto.Mac.Platform();
                    platform.Add <ScintillaControl.IScintillaControl>(() => new Mac.ScintillaControlHandler());
                    break;
                }
            }

            // test control

            new Application(platform).Run(new TestForm());
        }
예제 #15
0
        private static void Main(string[] args)
        {
            var plat = new Eto.GtkSharp.Platform();

            //var plat = new Eto.Wpf.Platform();
            app              = new Eto.Forms.Application(plat);
            app.Initialized += (sender, e) =>
            {
                new Tray().Show();
                new MainWindow().Show();
            };
            app.Run();
        }
예제 #16
0
        public static void Main(string[] args)
        {
            var runningPlatform = Helpers.DetectPlatform.GetRunningPlatform();

            if (runningPlatform == Helpers.DetectPlatform.Platform.Windows)
            {
                var wpfPlatform = new Eto.Wpf.Platform();
                wpfPlatform.Add <WebView.IHandler>(() => new Controls.WebViewHandlerLite());
                new Application(wpfPlatform).Run(new frmMain());
            }
            else if (runningPlatform == Helpers.DetectPlatform.Platform.Linux)
            {
                var gtkPlatform = new Eto.GtkSharp.Platform();
                new Application(gtkPlatform).Run(new frmMain());
            }
            else
            {
                Console.WriteLine("Unsupported Platform");
            }
        }
예제 #17
0
        public static void Main(string[] args)
        {
            Toolkit opentk = Core.InitOpenTK();

            var platform = new Eto.GtkSharp.Platform();

            platform.Add <GLSurface.IHandler>(() => new GtkGlSurfaceHandler());

            Style.Add <View>(
                "hidecursor",
                view =>
            {
                Gdk.Window window = view.ToNative().GdkWindow;

                var pixmap = new Gdk.Pixmap(null, 1, 1, 1);
                var cursor = new Gdk.Cursor(pixmap, pixmap, Gdk.Color.Zero, Gdk.Color.Zero, 0, 0);

                Gdk.EventMask mask = Gdk.EventMask.PointerMotionMask | Gdk.EventMask.ButtonPressMask;

                // Doesn't successfully limit mouse motion when running in
                // Windows, but that's an edge case anyway, so no big deal.
                Gdk.Pointer.Grab(window, true, mask, window, cursor, 0);
            });

            Style.Add <View>(
                "showcursor",
                view =>
            {
                Gdk.Pointer.Ungrab(0);
            });

            var application = new Application(platform);

            application.UnhandledException += Core.UnhandledExceptionHandler;

            using (opentk)
            {
                application.Run(new MainForm());
            }
        }
예제 #18
0
        public static void Main(string[] args)
        {
            //initialize OpenTK

            OpenTK.Toolkit.Init();

            // set global settings

            Settings.CultureInfo         = "en";
            Settings.EnableGPUProcessing = false;
            Settings.OldUI = false;

            Exception loadsetex = null;

            try
            {
                Settings.LoadSettings("dwsim_newui.ini");
            }
            catch (Exception ex)
            {
                loadsetex = ex;
            }

            if (GlobalSettings.Settings.EnableGPUProcessing)
            {
                // initialize gpu if enabled
                try
                {
                    //set CUDA params
                    CudafyModes.Compiler = eGPUCompiler.All;
                    CudafyModes.Target   = (eGPUType)Settings.CudafyTarget;
                    Cudafy.Translator.CudafyTranslator.GenerateDebug = false;
                    DWSIM.Thermodynamics.Calculator.InitComputeDevice();
                    Console.WriteLine("GPU initialized successfully: " + Settings.SelectedGPU + "(" + CudafyModes.Target.ToString() + ")");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("GPU initialization failed: " + ex.ToString());
                    var ex1 = ex;
                    while (ex1.InnerException != null)
                    {
                        Console.WriteLine("GPU initialization failed (IEX): " + ex1.InnerException.ToString());
                        if (ex1.InnerException is ReflectionTypeLoadException)
                        {
                            foreach (var tlex in ((ReflectionTypeLoadException)(ex1.InnerException)).LoaderExceptions)
                            {
                                Console.WriteLine("GPU initialization failed (TLEX): " + tlex.Message);
                            }
                        }
                        ex1 = ex1.InnerException;
                    }
                }
            }

            Eto.Platform platform = null;

            try
            {
                if (Settings.RunningPlatform() == Settings.Platform.Windows)
                {
                    switch (GlobalSettings.Settings.WindowsRenderer)
                    {
                    case Settings.WindowsPlatformRenderer.WinForms:
                        DWSIM.UI.Desktop.WinForms.StyleSetter.SetStyles();
                        platform = new Eto.WinForms.Platform();
                        platform.Add <FlowsheetSurfaceControl.IFlowsheetSurface>(() => new WinForms.FlowsheetSurfaceControlHandler());
                        platform.Add <FlowsheetSurfaceControl_OpenGL.IFlowsheetSurface_OpenGL>(() => new WinForms.FlowsheetSurfaceControlHandler_OpenGL());
                        platform.Add <Eto.OxyPlot.Plot.IHandler>(() => new Eto.OxyPlot.WinForms.PlotHandler());
                        platform.Add <Eto.Forms.Controls.Scintilla.Shared.ScintillaControl.IScintillaControl>(() => new Eto.Forms.Controls.Scintilla.WinForms.ScintillaControlHandler());
                        break;

                    case Settings.WindowsPlatformRenderer.WPF:
                        DWSIM.UI.Desktop.WPF.StyleSetter.SetTheme("aero", "normalcolor");
                        DWSIM.UI.Desktop.WPF.StyleSetter.SetStyles();
                        platform = new Eto.Wpf.Platform();
                        platform.Add <FlowsheetSurfaceControl.IFlowsheetSurface>(() => new WPF.FlowsheetSurfaceControlHandler());
                        platform.Add <FlowsheetSurfaceControl_OpenGL.IFlowsheetSurface_OpenGL>(() => new WPF.FlowsheetSurfaceControlHandler_OpenGL());
                        platform.Add <Eto.OxyPlot.Plot.IHandler>(() => new Eto.OxyPlot.WPF.PlotHandler());
                        platform.Add <Eto.Forms.Controls.Scintilla.Shared.ScintillaControl.IScintillaControl>(() => new Eto.Forms.Controls.Scintilla.WPF.ScintillaControlHandler());
                        break;

                    case Settings.WindowsPlatformRenderer.Gtk2:
                        DWSIM.UI.Desktop.GTK.StyleSetter.SetStyles();
                        platform = new Eto.GtkSharp.Platform();
                        platform.Add <FlowsheetSurfaceControl.IFlowsheetSurface>(() => new GTK.FlowsheetSurfaceControlHandler());
                        platform.Add <FlowsheetSurfaceControl_OpenGL.IFlowsheetSurface_OpenGL>(() => new GTK.FlowsheetSurfaceControlHandler_OpenGL());
                        platform.Add <Eto.OxyPlot.Plot.IHandler>(() => new Eto.OxyPlot.Gtk.PlotHandler());
                        platform.Add <Eto.Forms.Controls.Scintilla.Shared.ScintillaControl.IScintillaControl>(() => new Eto.Forms.Controls.Scintilla.GTK.ScintillaControlHandler());
                        break;
                    }
                    new Application(platform).Run(new MainForm());
                }
                else if (Settings.RunningPlatform() == Settings.Platform.Linux)
                {
                    switch (GlobalSettings.Settings.LinuxRenderer)
                    {
                    case Settings.LinuxPlatformRenderer.Gtk2:
                        DWSIM.UI.Desktop.GTK.StyleSetter.SetStyles();
                        platform = new Eto.GtkSharp.Platform();
                        platform.Add <FlowsheetSurfaceControl.IFlowsheetSurface>(() => new GTK.FlowsheetSurfaceControlHandler());
                        platform.Add <FlowsheetSurfaceControl_OpenGL.IFlowsheetSurface_OpenGL>(() => new GTK.FlowsheetSurfaceControlHandler_OpenGL());
                        platform.Add <Eto.OxyPlot.Plot.IHandler>(() => new Eto.OxyPlot.Gtk.PlotHandler());
                        platform.Add <Eto.Forms.Controls.Scintilla.Shared.ScintillaControl.IScintillaControl>(() => new Eto.Forms.Controls.Scintilla.GTK.ScintillaControlHandler());
                        break;

                    case Settings.LinuxPlatformRenderer.WinForms:
                        DWSIM.UI.Desktop.WinForms.StyleSetter.SetStyles();
                        platform = new Eto.WinForms.Platform();
                        platform.Add <FlowsheetSurfaceControl.IFlowsheetSurface>(() => new WinForms.FlowsheetSurfaceControlHandler());
                        platform.Add <FlowsheetSurfaceControl_OpenGL.IFlowsheetSurface_OpenGL>(() => new WinForms.FlowsheetSurfaceControlHandler_OpenGL());
                        platform.Add <Eto.OxyPlot.Plot.IHandler>(() => new Eto.OxyPlot.WinForms.PlotHandler());
                        platform.Add <Eto.Forms.Controls.Scintilla.Shared.ScintillaControl.IScintillaControl>(() => new Eto.Forms.Controls.Scintilla.WinForms.ScintillaControlHandler());
                        break;
                    }
                    new Application(platform).Run(new MainForm());
                }
                else if (Settings.RunningPlatform() == Settings.Platform.Mac)
                {
                    switch (GlobalSettings.Settings.MacOSRenderer)
                    {
                    case Settings.MacOSPlatformRenderer.MonoMac:
                        DWSIM.UI.Desktop.Mac.StyleSetter.SetStyles();
                        platform = new Eto.Mac.Platform();
                        DWSIM.UI.Desktop.Mac.StyleSetter.BeginLaunching();
                        platform.Add <FlowsheetSurfaceControl.IFlowsheetSurface>(() => new Mac.FlowsheetSurfaceControlHandler());
                        platform.Add <FlowsheetSurfaceControl_OpenGL.IFlowsheetSurface_OpenGL>(() => new Mac.FlowsheetSurfaceControlHandler_OpenGL());
                        platform.Add <Eto.OxyPlot.Plot.IHandler>(() => new Mac.PlotHandler());
                        platform.Add <Eto.Forms.Controls.Scintilla.Shared.ScintillaControl.IScintillaControl>(() => new Eto.Forms.Controls.Scintilla.Mac.ScintillaControlHandler());
                        break;

                    case Settings.MacOSPlatformRenderer.Gtk2:
                        DWSIM.UI.Desktop.GTK.StyleSetter.SetStyles();
                        platform = new Eto.GtkSharp.Platform();
                        platform.Add <FlowsheetSurfaceControl.IFlowsheetSurface>(() => new GTK.FlowsheetSurfaceControlHandler());
                        platform.Add <FlowsheetSurfaceControl_OpenGL.IFlowsheetSurface_OpenGL>(() => new GTK.FlowsheetSurfaceControlHandler_OpenGL());
                        platform.Add <Eto.OxyPlot.Plot.IHandler>(() => new Eto.OxyPlot.Gtk.PlotHandler());
                        platform.Add <Eto.Forms.Controls.Scintilla.Shared.ScintillaControl.IScintillaControl>(() => new Eto.Forms.Controls.Scintilla.GTK.ScintillaControlHandler());
                        break;

                    case Settings.MacOSPlatformRenderer.WinForms:
                        DWSIM.UI.Desktop.WinForms.StyleSetter.SetStyles();
                        platform = new Eto.WinForms.Platform();
                        platform.Add <FlowsheetSurfaceControl.IFlowsheetSurface>(() => new WinForms.FlowsheetSurfaceControlHandler());
                        platform.Add <FlowsheetSurfaceControl_OpenGL.IFlowsheetSurface_OpenGL>(() => new WinForms.FlowsheetSurfaceControlHandler_OpenGL());
                        platform.Add <Eto.OxyPlot.Plot.IHandler>(() => new Eto.OxyPlot.WinForms.PlotHandler());
                        platform.Add <Eto.Forms.Controls.Scintilla.Shared.ScintillaControl.IScintillaControl>(() => new Eto.Forms.Controls.Scintilla.WinForms.ScintillaControlHandler());
                        break;
                    }
                    var app = new Application(platform);
                    app.Initialized += (sender, e) =>
                    {
                        if (GlobalSettings.Settings.RunningPlatform() == Settings.Platform.Mac)
                        {
                            if (GlobalSettings.Settings.MacOSRenderer == Settings.MacOSPlatformRenderer.MonoMac)
                            {
                                DWSIM.UI.Desktop.Mac.StyleSetter.FinishedLaunching();
                            }
                        }
                        if (loadsetex != null)
                        {
                            MessageBox.Show("Error loading settings from file: " + loadsetex.Message + "\nPlease fix or remove the 'dwsim_newui.ini' from the 'Documents/DWSIM Application Data' folder and try again.", "Error", MessageBoxType.Error);
                        }
                    };
                    app.Run(new MainForm());
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine();
                Console.WriteLine();
                Console.WriteLine("APP CRASH!!!");
                Console.WriteLine();
                Console.WriteLine(ex.ToString());
                string configfiledir = "";
                if (GlobalSettings.Settings.RunningPlatform() == Settings.Platform.Mac)
                {
                    configfiledir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Documents", "DWSIM Application Data");
                }
                else
                {
                    configfiledir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "DWSIM Application Data");
                }
                if (!Directory.Exists(configfiledir))
                {
                    Directory.CreateDirectory(configfiledir);
                }
                File.WriteAllText(System.IO.Path.Combine(configfiledir, "lasterror.txt"), "Output from last app crash:\n\n" + ex.ToString());
            }
        }
예제 #19
0
        public static void Main(string[] args)
        {
            Platform plat = new Eto.GtkSharp.Platform();

            new App(args, new Application(plat));
        }
예제 #20
0
        public static void Main(string[] args)
        {
            //initialize OpenTK

            OpenTK.Toolkit.Init();

            // set global settings

            Settings.CultureInfo         = "en";
            Settings.EnableGPUProcessing = false;
            Settings.OldUI = false;

            Settings.LoadSettings("dwsim_newui.ini");

            Eto.Platform platform = null;

            try
            {
                if (Settings.RunningPlatform() == Settings.Platform.Windows)
                {
                    switch (GlobalSettings.Settings.WindowsRenderer)
                    {
                    case Settings.WindowsPlatformRenderer.WinForms:
                        DWSIM.UI.Desktop.WinForms.StyleSetter.SetStyles();
                        platform = new Eto.Direct2D.Platform();
                        platform.Add <FlowsheetSurfaceControl.IFlowsheetSurface>(() => new WinForms.FlowsheetSurfaceControlHandler());
                        platform.Add <FlowsheetSurfaceControl_OpenGL.IFlowsheetSurface_OpenGL>(() => new WinForms.FlowsheetSurfaceControlHandler_OpenGL());
                        platform.Add <Eto.OxyPlot.Plot.IHandler>(() => new Eto.OxyPlot.WinForms.PlotHandler());
                        platform.Add <CodeEditorControl.ICodeEditor>(() => new WinForms.CodeEditorControlHandler());
                        break;

                    case Settings.WindowsPlatformRenderer.WinForms_Direct2D:
                        DWSIM.UI.Desktop.WinForms.StyleSetter.SetStyles();
                        platform = new Eto.WinForms.Platform();
                        platform.Add <FlowsheetSurfaceControl.IFlowsheetSurface>(() => new WinForms.FlowsheetSurfaceControlHandler());
                        platform.Add <Eto.OxyPlot.Plot.IHandler>(() => new Eto.OxyPlot.WinForms.PlotHandler());
                        platform.Add <CodeEditorControl.ICodeEditor>(() => new WinForms.CodeEditorControlHandler());
                        break;

                    case Settings.WindowsPlatformRenderer.WPF:
                        DWSIM.UI.Desktop.WPF.StyleSetter.SetTheme("aero", "normalcolor");
                        DWSIM.UI.Desktop.WPF.StyleSetter.SetStyles();
                        platform = new Eto.Wpf.Platform();
                        platform.Add <FlowsheetSurfaceControl.IFlowsheetSurface>(() => new WPF.FlowsheetSurfaceControlHandler());
                        platform.Add <FlowsheetSurfaceControl_OpenGL.IFlowsheetSurface_OpenGL>(() => new WPF.FlowsheetSurfaceControlHandler_OpenGL());
                        platform.Add <Eto.OxyPlot.Plot.IHandler>(() => new Eto.OxyPlot.Wpf.PlotHandler());
                        platform.Add <CodeEditorControl.ICodeEditor>(() => new WPF.CodeEditorControlHandler());
                        break;

                    case Settings.WindowsPlatformRenderer.Gtk2:
                        DWSIM.UI.Desktop.GTK.StyleSetter.SetStyles();
                        platform = new Eto.GtkSharp.Platform();
                        platform.Add <FlowsheetSurfaceControl.IFlowsheetSurface>(() => new GTK.FlowsheetSurfaceControlHandler());
                        platform.Add <FlowsheetSurfaceControl_OpenGL.IFlowsheetSurface_OpenGL>(() => new GTK.FlowsheetSurfaceControlHandler_OpenGL());
                        platform.Add <Eto.OxyPlot.Plot.IHandler>(() => new Eto.OxyPlot.Gtk.PlotHandler());
                        platform.Add <CodeEditorControl.ICodeEditor>(() => new GTK.CodeEditorControlHandler());
                        break;
                    }
                    new Application(platform).Run(new MainForm());
                }
                else if (Settings.RunningPlatform() == Settings.Platform.Linux)
                {
                    switch (GlobalSettings.Settings.LinuxRenderer)
                    {
                    case Settings.LinuxPlatformRenderer.Gtk2:
                        DWSIM.UI.Desktop.GTK.StyleSetter.SetStyles();
                        platform = new Eto.GtkSharp.Platform();
                        platform.Add <FlowsheetSurfaceControl.IFlowsheetSurface>(() => new GTK.FlowsheetSurfaceControlHandler());
                        platform.Add <FlowsheetSurfaceControl_OpenGL.IFlowsheetSurface_OpenGL>(() => new GTK.FlowsheetSurfaceControlHandler_OpenGL());
                        platform.Add <Eto.OxyPlot.Plot.IHandler>(() => new Eto.OxyPlot.Gtk.PlotHandler());
                        platform.Add <CodeEditorControl.ICodeEditor>(() => new GTK.CodeEditorControlHandler());
                        break;

                    case Settings.LinuxPlatformRenderer.WinForms:
                        DWSIM.UI.Desktop.WinForms.StyleSetter.SetStyles();
                        platform = new Eto.WinForms.Platform();
                        platform.Add <FlowsheetSurfaceControl.IFlowsheetSurface>(() => new WinForms.FlowsheetSurfaceControlHandler());
                        platform.Add <FlowsheetSurfaceControl_OpenGL.IFlowsheetSurface_OpenGL>(() => new WinForms.FlowsheetSurfaceControlHandler_OpenGL());
                        platform.Add <Eto.OxyPlot.Plot.IHandler>(() => new Eto.OxyPlot.WinForms.PlotHandler());
                        platform.Add <CodeEditorControl.ICodeEditor>(() => new WinForms.CodeEditorControlHandler());
                        break;
                    }
                    new Application(platform).Run(new MainForm());
                }
                else if (Settings.RunningPlatform() == Settings.Platform.Mac)
                {
                    switch (GlobalSettings.Settings.MacOSRenderer)
                    {
                    case Settings.MacOSPlatformRenderer.MonoMac:
                        DWSIM.UI.Desktop.Mac.StyleSetter.SetStyles();
                        platform = new Eto.Mac.Platform();
                        platform.Add <FlowsheetSurfaceControl.IFlowsheetSurface>(() => new Mac.FlowsheetSurfaceControlHandler());
                        platform.Add <FlowsheetSurfaceControl_OpenGL.IFlowsheetSurface_OpenGL>(() => new Mac.FlowsheetSurfaceControlHandler_OpenGL());
                        platform.Add <Eto.OxyPlot.Plot.IHandler>(() => new Mac.PlotHandler());
                        platform.Add <CodeEditorControl.ICodeEditor>(() => new Mac.CodeEditorControlHandler());
                        break;

                    case Settings.MacOSPlatformRenderer.Gtk2:
                        DWSIM.UI.Desktop.GTK.StyleSetter.SetStyles();
                        platform = new Eto.GtkSharp.Platform();
                        platform.Add <FlowsheetSurfaceControl.IFlowsheetSurface>(() => new GTK.FlowsheetSurfaceControlHandler());
                        platform.Add <FlowsheetSurfaceControl_OpenGL.IFlowsheetSurface_OpenGL>(() => new GTK.FlowsheetSurfaceControlHandler_OpenGL());
                        platform.Add <Eto.OxyPlot.Plot.IHandler>(() => new Eto.OxyPlot.Gtk.PlotHandler());
                        platform.Add <CodeEditorControl.ICodeEditor>(() => new GTK.CodeEditorControlHandler());
                        break;

                    case Settings.MacOSPlatformRenderer.WinForms:
                        DWSIM.UI.Desktop.WinForms.StyleSetter.SetStyles();
                        platform = new Eto.WinForms.Platform();
                        platform.Add <FlowsheetSurfaceControl.IFlowsheetSurface>(() => new WinForms.FlowsheetSurfaceControlHandler());
                        platform.Add <FlowsheetSurfaceControl_OpenGL.IFlowsheetSurface_OpenGL>(() => new WinForms.FlowsheetSurfaceControlHandler_OpenGL());
                        platform.Add <Eto.OxyPlot.Plot.IHandler>(() => new Eto.OxyPlot.WinForms.PlotHandler());
                        platform.Add <CodeEditorControl.ICodeEditor>(() => new WinForms.CodeEditorControlHandler());
                        break;
                    }
                    var app = new Application(platform);
                    app.Initialized += (sender, e) =>
                    {
                        if (GlobalSettings.Settings.RunningPlatform() == Settings.Platform.Mac)
                        {
                            if (GlobalSettings.Settings.MacOSRenderer == Settings.MacOSPlatformRenderer.MonoMac)
                            {
                                DWSIM.UI.Desktop.Mac.StyleSetter.FinishedLaunching();
                                Console.WriteLine("FinishedLaunching");
                            }
                        }
                    };
                    app.Run(new MainForm());
                }
            }
            catch (Exception ex)
            {
                string configfiledir = "";
                if (GlobalSettings.Settings.RunningPlatform() == Settings.Platform.Mac)
                {
                    configfiledir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Documents", "DWSIM Application Data");
                }
                else
                {
                    configfiledir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "DWSIM Application Data");
                }
                if (!Directory.Exists(configfiledir))
                {
                    Directory.CreateDirectory(configfiledir);
                }
                File.WriteAllText(System.IO.Path.Combine(configfiledir, "lasterror.txt"), "Output from last app crash:\n\n" + ex.ToString());
            }
        }
예제 #21
0
        static void Main()
        {
            // initialize OpenTK

            OpenTK.Toolkit.Init();

            // set renderers

            string WinR, LinuxR, MacR;

            WinR   = "WPF";     // WPF, WinForms, GTK
            LinuxR = "GTK";     // GTK, WinForms
            MacR   = "MonoMac"; // MonoMac, WinForms, GTK

            Eto.Platform platform = null;

            switch (RunningPlatform())
            {
            case Platform.Windows:
                switch (WinR)
                {
                case "WPF":
                    platform = new Eto.Wpf.Platform();
                    platform.Add <SKControl.ISKControl>(() => new WPF.SKControlHandler());
                    platform.Add <SKGLControl.ISKGLControl>(() => new WPF.SKGLControlHandler());
                    break;

                case "WinForms":
                    platform = new Eto.WinForms.Platform();
                    platform.Add <SKControl.ISKControl>(() => new WinForms.SKControlHandler());
                    platform.Add <SKGLControl.ISKGLControl>(() => new WinForms.SKGLControlHandler());
                    break;

                case "GTK":
                    platform = new Eto.GtkSharp.Platform();
                    platform.Add <SKControl.ISKControl>(() => new GTK.SKControlHandler());
                    platform.Add <SKGLControl.ISKGLControl>(() => new GTK.SKGLControlHandler());
                    break;
                }
                break;

            case Platform.Linux:
                switch (LinuxR)
                {
                case "WinForms":
                    platform = new Eto.WinForms.Platform();
                    platform.Add <SKControl.ISKControl>(() => new WinForms.SKControlHandler());
                    platform.Add <SKGLControl.ISKGLControl>(() => new WinForms.SKGLControlHandler());
                    break;

                case "GTK":
                    platform = new Eto.GtkSharp.Platform();
                    platform.Add <SKControl.ISKControl>(() => new GTK.SKControlHandler());
                    platform.Add <SKGLControl.ISKGLControl>(() => new GTK.SKGLControlHandler());
                    break;
                }
                break;

            case Platform.Mac:
                switch (MacR)
                {
                case "MonoMac":
                    platform = new Eto.Mac.Platform();
                    platform.Add <SKControl.ISKControl>(() => new Mac.SKControlHandler());
                    platform.Add <SKGLControl.ISKGLControl>(() => new Mac.SKGLControlHandler());
                    break;

                case "WinForms":
                    platform = new Eto.WinForms.Platform();
                    platform.Add <SKControl.ISKControl>(() => new WinForms.SKControlHandler());
                    platform.Add <SKGLControl.ISKGLControl>(() => new WinForms.SKGLControlHandler());
                    break;

                case "GTK":
                    platform = new Eto.GtkSharp.Platform();
                    platform.Add <SKControl.ISKControl>(() => new GTK.SKControlHandler());
                    platform.Add <SKGLControl.ISKGLControl>(() => new GTK.SKGLControlHandler());
                    break;
                }
                break;
            }

            // test CPU drawing (SKControl)

            //new Application(platform).Run(new FormCPU());

            // test OpenGL drawing (SKGLControl)

            new Application(platform).Run(new FormGL());
        }
예제 #22
0
        public static void Main(string[] args)
        {
            var platform = new Eto.GtkSharp.Platform();

            new Application(platform).Run(new MainForm());
        }