public void TransformStack_TranlateSaveRestore_Verify() { using (var context = new Eto.Wpf.Platform().Context) { var current = Matrix.Create(); var stack = new Stack<IMatrix>(); Action<IMatrix> push = m => { stack.Push(current); m.Append(current); current = m; }; Action pop = () => current = stack.Pop(); var target = new TransformStack(push, pop); Assert.IsTrue(MatrixTests.Equals(current, 1f, 0f, 0f, 1f, 0f, 0f)); target.SaveTransform(); // Save target.TranslateTransform(5f, 5f); Assert.IsTrue(MatrixTests.Equals(current, 1f, 0f, 0f, 1f, 5f, 5f)); target.SaveTransform(); target.TranslateTransform(10f, 10f); Assert.IsTrue(MatrixTests.Equals(current, 1f, 0f, 0f, 1f, 15f, 15f)); target.RestoreTransform(); Assert.IsTrue(MatrixTests.Equals(current, 1f, 0f, 0f, 1f, 5f, 5f)); target.RestoreTransform(); Assert.IsTrue(MatrixTests.Equals(current, 1f, 0f, 0f, 1f, 0f, 0f)); } }
public static void Main(string[] args) { var platform = new Eto.Wpf.Platform(); platform.Add(typeof(Plot.IHandler), () => new Eto.OxyPlot.Wpf.PlotHandler()); new Application(platform).Run(new MainForm()); }
public static void Initialize() { if (initialized) { return; } initialized = true; var platform = Platform.Instance; if (platform == null) { platform = new Eto.Wpf.Platform(); Platform.Initialize(platform); } Style.Add <FormHandler>("eto.vstheme", h => ThemeWindow(h.Control)); Style.Add <DialogHandler>("eto.vstheme", h => ThemeWindow(h.Control)); platform.LoadAssembly(typeof(EtoInitializer).Assembly); if (Application.Instance == null) { new Eto.Forms.Application().Attach(); } Eto.Designer.Builders.BaseCompiledInterfaceBuilder.InitializeAssembly = typeof(EtoInitializer).Assembly.FullName; }
public static void Main(string[] args) { Platform plat = new Eto.Wpf.Platform(); plat.Add <DragDropController.IDragDropController>(() => { return(new DragDropWPF()); }); new App(args, new Application(plat)); }
public void TransformStack_TranlateSaveRestore_Verify() { using (var context = new Eto.Wpf.Platform().Context) { var current = Matrix.Create(); var stack = new Stack <IMatrix>(); Action <IMatrix> push = m => { stack.Push(current); m.Append(current); current = m; }; Action pop = () => current = stack.Pop(); var target = new TransformStack(push, pop); Assert.IsTrue(MatrixTests.Equals(current, 1f, 0f, 0f, 1f, 0f, 0f)); target.SaveTransform(); // Save target.TranslateTransform(5f, 5f); Assert.IsTrue(MatrixTests.Equals(current, 1f, 0f, 0f, 1f, 5f, 5f)); target.SaveTransform(); target.TranslateTransform(10f, 10f); Assert.IsTrue(MatrixTests.Equals(current, 1f, 0f, 0f, 1f, 15f, 15f)); target.RestoreTransform(); Assert.IsTrue(MatrixTests.Equals(current, 1f, 0f, 0f, 1f, 5f, 5f)); target.RestoreTransform(); Assert.IsTrue(MatrixTests.Equals(current, 1f, 0f, 0f, 1f, 0f, 0f)); } }
public static void Main(string[] args) { var platform = new Eto.Wpf.Platform(); platform.Add <RenderCanvas.IHandler>(() => new WinGLSurfaceHandler()); new Pulsar4XApplication(platform).Run(); }
static void Main() { var platform = new Eto.Wpf.Platform(); platform.Add <GLSurface.IHandler>(() => new Eto.OpenTK.Wpf.WpfWinGLSurfaceHandler()); new Application(platform).Run(new MainForm()); }
public static void Main(string[] args) { VeldridSurface.InitializeOpenTK(); var platform = new Eto.Wpf.Platform(); new Application(platform).Run(new MainForm()); }
static void Main(string[] args) { var platform = new Eto.Wpf.Platform(); var app = new TestApplication(platform); app.TestAssemblies.Add(typeof(Startup).Assembly); app.Run(); }
static void Main() { var platform = new Eto.Wpf.Platform(); platform.Add <GLSurface.IHandler>(() => new Eto.Gl.WPF_WFControl.WPFWFGLSurfaceHandler()); new Application(platform).Run(new MainForm()); }
public static void Main(string[] args) { var platform = new Eto.Wpf.Platform(); var app = new MainApplication(platform); app.Run(args); }
public static void Initialize() { if (Platform.Instance == null) { var platform = new Eto.Wpf.Platform(); // uncomment to use app domains //platform.LoadAssembly(typeof(PlatformInitializer).Assembly); new Application(platform).Attach(); } }
public static void Main(string[] args) { var platform = new Eto.Wpf.Platform(); platform.Add <NodeCheckBox.IHandler>(() => new NodeCheckBoxHandler()); platform.Add <NodePanel.IHandler>(() => new NodePanelHandler()); platform.Add <NodeWindowsFormsHost.IHandler>(() => new NodeWindowsFormsHostHandler()); new Application(platform).Run(new MainForm()); }
static void Main(string[] args) { var generator = new Eto.Wpf.Platform(); // don't use tiling for the direct drawing test Style.Add <DrawableHandler>("direct", handler => handler.AllowTiling = false); var app = new TestApplication(generator); app.Run(); }
public static void Initialize() { if (Platform.Instance == null) { var platform = new Eto.Wpf.Platform(); // uncomment to use app domains platform.LoadAssembly(typeof(PlatformInitializer).Assembly); new Application(platform).Attach(); Eto.Designer.Builders.BaseCompiledInterfaceBuilder.InitializeAssembly = typeof(EtoInitializer).Assembly.FullName; } }
public static void Initialize() { if (Platform.Instance == null) { var platform = new Eto.Wpf.Platform(); // uncomment to use app domains platform.LoadAssembly(typeof(EtoInitializer).Assembly); new Application(platform).Attach(); Eto.Designer.Builders.BaseCompiledInterfaceBuilder.InitializeAssembly = typeof(EtoInitializer).Assembly.FullName; } }
static void Main(string[] args) { var platform = new Eto.Wpf.Platform(); // optional - enables GDI text display mode /* Style.Add<Eto.Wpf.Forms.FormHandler>(null, handler => TextOptions.SetTextFormattingMode(handler.Control, TextFormattingMode.Display)); Style.Add<Eto.Wpf.Forms.DialogHandler>(null, handler => TextOptions.SetTextFormattingMode(handler.Control, TextFormattingMode.Display)); */ var app = new TestApplication(platform); app.TestAssemblies.Add(typeof(Startup).Assembly); app.Run(); }
public static void Initialize() { if (Platform.Instance == null) { Style.Add <FormHandler>("themed", h => ThemeWindow(h.Control)); Style.Add <DialogHandler>("themed", h => ThemeWindow(h.Control)); var platform = new Eto.Wpf.Platform(); // uncomment to use app domains platform.LoadAssembly(typeof(EtoInitializer).Assembly); new Application(platform).Attach(); Eto.Designer.Builders.BaseCompiledInterfaceBuilder.InitializeAssembly = typeof(EtoInitializer).Assembly.FullName; } }
static void Main(string[] args) { var platform = new Eto.Wpf.Platform(); // optional - enables GDI text display mode /**/ Style.Add <Eto.Wpf.Forms.FormHandler>(null, handler => TextOptions.SetTextFormattingMode(handler.Control, TextFormattingMode.Display)); Style.Add <Eto.Wpf.Forms.DialogHandler>(null, handler => TextOptions.SetTextFormattingMode(handler.Control, TextFormattingMode.Display)); /**/ var app = new TestApplication(platform); app.TestAssemblies.Add(typeof(Startup).Assembly); app.Run(); }
public static void Main(string[] args) { var platform = new Eto.Wpf.Platform(); platform.Add <GameControl.IGameControl>(() => new GameControlHandler()); Eto.Style.Add <ImageViewHandler>("nearest-neighbor", handler => { RenderOptions.SetBitmapScalingMode(handler.Control, BitmapScalingMode.NearestNeighbor); }); using (var app = new DataViewerApplication(platform)) using (var mainForm = new MainForm()) { app.Run(mainForm); } }
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"); } }
static void Main(string[] args) { var platform = new Eto.Wpf.Platform(); // optional - enables GDI text display mode /* * Style.Add<Eto.Wpf.Forms.FormHandler>(null, handler => TextOptions.SetTextFormattingMode(handler.Control, TextFormattingMode.Display)); * Style.Add<Eto.Wpf.Forms.DialogHandler>(null, handler => TextOptions.SetTextFormattingMode(handler.Control, TextFormattingMode.Display)); */ var app = new TestApplication(platform); app.TestAssemblies.Add(typeof(Startup).Assembly); System.Windows.Application.Current.Resources.MergedDictionaries.Add(new System.Windows.ResourceDictionary { Source = new Uri("pack://application:,,,/DynamicAero2;component/Theme.xaml", UriKind.RelativeOrAbsolute) }); System.Windows.Application.Current.Resources.MergedDictionaries.Add(new System.Windows.ResourceDictionary { Source = new Uri("pack://application:,,,/DynamicAero2;component/Brushes/Dark.xaml", UriKind.RelativeOrAbsolute) }); app.Run(); }
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()); } }
public static void Main(string[] args) { var platform = new Eto.Wpf.Platform(); new Application(platform).Run(new MainForm()); }
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()); } }
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()); }