public static void Init(Platform platform, ToolkitType DefaultToolKit, ToolkitType[] supportedToolkits) { CurrentPlatform = platform; SuportedPlatformToolkits = supportedToolkits; bool tkset = false; try { var settings = File.ReadAllLines(SettingsFile); foreach (var setting in settings) { string[] split = setting.Split('='); if (split[0] == "Toolkit") { try { _toolKitType = (ToolkitType)Enum.Parse(typeof(ToolkitType), split[1]); tkset = true; } catch { } } } } catch { } if(!tkset) _toolKitType = DefaultToolKit; }
public static void Run(ToolkitType type) { Application.Initialize (type); using(var w = new MainWindow ()){ w.Show (); Application.Run (); } Application.Dispose (); }
public static void Main(string[] args) { bool show_help = false; string filename = null; string path = null; string featureExtraction = null; // commandline parsing var p = new OptionSet() { { "h|?|help", "show help screen", v => show_help = v != null }, { "f|file=", "project file to open", v => filename = v }, { "p|path=", "path to folder with scans", v => path = v }, { "e|extraction=", "select and run feature extraction", v => featureExtraction = v }, }; try { p.Parse(args); } catch (OptionException e) { Console.Out.WriteLine(e.Message); printHelp(p); return; } // print help if (show_help) { printHelp(p); return; } ThreadPool.SetMaxThreads(8, 16); // start application if (GetOS() == OSType.Unix) { toolkitType = ToolkitType.Gtk; } else if (GetOS() == OSType.MaxOSX) { toolkitType = ToolkitType.Cocoa; } else { toolkitType = ToolkitType.Gtk; } Application.Initialize(toolkitType); Project project = new Project(filename); Window w = new MainWindow(project); w.Show(); Application.Run(); w.Dispose(); Application.Dispose(); }
public static void Run(ToolkitType type) { Application.Initialize (type); MainWindow w = new MainWindow (); w.Show (); Application.Run (); w.Dispose (); }
public static void Run(ToolkitType type) { Application.Initialize(type); SplashWindow splash = new SplashWindow(); splash.Show(); Application.Run(); splash.Dispose(); Application.Dispose(); }
public static void Run(ToolkitType type) { Application.Initialize (type); MainWindow w = new MainWindow (); w.Title = "Xwt Demo Application"; w.Width = 500; w.Height = 400; w.Show (); Application.Run (); w.Dispose (); }
public static void Run(ToolkitType type) { Application.Initialize (type); MainWindow w = new MainWindow () { Title = "ControlSuite - CSPlot Samples", Width = 800, Height = 600 }; w.Show (); Application.Run (); w.Dispose (); }
private static BaseLib.Media.OpenTK.IXwtRender TryLoad(string type, ToolkitType toolkit, out IRendererFactory renderfactory) { try { var a = Assembly.Load($"BB74.Xwt.OpenTK.{type}"); var t = a.GetType($"BaseLib.Platforms.{type}"); var o = new object[] { null }; var r = (BaseLib.Media.OpenTK.IXwtRender)Activator.CreateInstance(t, o); renderfactory = o[0] as BaseLib.Media.Display.IRendererFactory; return(r); } catch (Exception e) { Console.WriteLine(e.ToString()); // Log.LogException(e); throw; } }
public static void Start(string[] args, ToolkitType type, Type splashType, Type mainType) { Application.Initialize(type); GuiService.UIThread = Thread.CurrentThread; //exceptions Application.UnhandledException += (sender, e) => { Helper.OnException(e.ErrorException); }; //Load Configuration for (int i = 0; i < args.Length; i++) { string s = args[i]; if (s.Equals("-config")) { var obj = Serialization.Deserialize(args[++i]); using (var op = new ListExplorer()) { op.DataSource = obj; op.ShowWindow((WindowFrame)null); } Application.Run(); Serialization.Serialize(obj, args[i]); return; } } using (var splash = (Splash)EmitInvoker.CreateObject(splashType)) { splash.Run(); } using (var main = (MainWindow)EmitInvoker.CreateObject(mainType)) { main.LoadConfiguration(); main.Show(); Application.Run(); } Application.Dispose(); }
/// <summary> /// Tries to load a toolkit /// </summary> /// <returns><c>true</c>, the toolkit could be loaded, <c>false</c> otherwise.</returns> /// <param name="type">Toolkit type</param> /// <param name="toolkit">The loaded toolkit</param> public static bool TryLoad(ToolkitType type, out Toolkit toolkit) { var et = toolkits.Values.FirstOrDefault(tk => tk.toolkitType == type); if (et != null) { toolkit = et; return(true); } Toolkit t = new Toolkit(); t.toolkitType = type; if (t.LoadBackend(GetBackendType(type), true, false)) { toolkit = t; return(true); } toolkit = null; return(false); }
internal static string GetBackendType(ToolkitType type) { string version = typeof(Application).Assembly.GetName().Version.ToString(); switch (type) { case ToolkitType.Gtk: return("Xwt.GtkBackend.GtkEngine, Xwt.Gtk, Version=" + version); case ToolkitType.Cocoa: return("Xwt.Mac.MacEngine, Xwt.Mac, Version=" + version); case ToolkitType.Wpf: return("Xwt.WPFBackend.WPFEngine, Xwt.WPF, Version=" + version); case ToolkitType.XamMac: return("Xwt.Mac.MacEngine, Xwt.XamMac, Version=" + version); default: throw new ArgumentException("Invalid toolkit type"); } }
public static void SetToolkit(ToolkitType toolkitType) { _toolKitType = toolkitType; }
private static void TryLoad(ToolkitType type) { ToolkitType = type; XwtRender = BaseLib.Media.OpenTK.Platform.TryLoad(type, out IRendererFactory renderfactory); Program.RenderFactory = renderfactory; }
public bool Initialize(ToolkitType type) { _log.Open(Path.Combine(AppData.Path, "ParkitectNexusLauncher.log")); _log.MinimumLogLevel = LogLevel.Debug; Application.Initialize(type); _window = _presenterFactory.InstantiatePresenter <MainWindow>(); _window.Show(); var update = _updateManager.CheckForUpdates <App>(); if (update != null) { if ( MessageDialog.AskQuestion("ParkitectNexus Client Update", "A required update for the ParkitectNexus Client needs to be installed.\n" + "Without this update you won't be able to install blueprints, savegames or mods trough this application. The update should take less than a minute.\n" + $"Would you like to install it now?\n\nYou are currently running v{typeof (App).Assembly.GetName().Version}. The newest version is v{update.Version}", Command.Yes, Command.No) != Command.Yes) { return(false); } if (!_updateManager.InstallUpdate(update)) { MessageDialog.ShowError(_window, "ParkitectNexus Client Update", "Failed installing the update! Please try again later."); } return(false); } if (!_parkitect.DetectInstallationPath()) { if ( !MessageDialog.Confirm( "We couldn't automatically detect Parkitect on your machine!\nPlease press OK and manually select the installation folder of Parkitect.", Command.Ok)) { _window.Dispose(); Application.Dispose(); return(false); } do { var dlg = new SelectFolderDialog("Select your Parkitect installation folder.") { CanCreateFolders = false, Multiselect = false }; if (dlg.Run(_window)) { if (_parkitect.SetInstallationPathIfValid(dlg.Folder)) { break; } } else { _window.Dispose(); Application.Dispose(); return(false); } } while (!_parkitect.IsInstalled); } _migrator.Migrate(); ModLoaderUtil.InstallModLoader(_parkitect, _log); _taskManager.Add <CheckForUpdatesTask>(); return(true); }
// RUN public static void Run(ToolkitType type) { Upgrade(); // Initialize XWT Application.Initialize(type); Icon = Image.CreateMultiSizeIcon(new[] { Resources.GetImage("4P.png"), Resources.GetImage("4P 16.png") }); // Init scripting async Script.InitializeScripting(); // count users string fplugLocal = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), ".4plug"); try { string idPath = Path.Combine(fplugLocal, "id10"); if (!Directory.Exists(fplugLocal)) Directory.CreateDirectory(fplugLocal); string id = null; if (File.Exists(idPath)) { try { id = File.ReadAllText(idPath); if (id.Length != 10) id = null; } catch { } } if (id == null) { id = getRandomID10(); File.WriteAllText(idPath, id); new WebClient().DownloadData("http://164.132.197.197/four/4plug/registeruser.php?id10=" + id); } } catch { } // Check if started for the first time FirstTime = !File.Exists("config.xml"); if (FirstTime) { XSettings.Load("config.xml"); if (Directory.Exists(@"C:\Program Files\Steam\steamapps\common")) DefaultSteamLibrary = @"C:\Program Files\Steam\steamapps\common"; else if (Directory.Exists(@"C:\Program Files (x86)\Steam\steamapps\common")) DefaultSteamLibrary = @"C:\Program Files (x86)\Steam\steamapps\common"; new SplashWindow().Run(); } // testing SettingsWindow w; if (Directory.Exists("C:\\")) w = new SettingsWindow(@"C:\Program Files (x86)\Steam\steamapps\common\Team Fortress 2\tf\custom\7HUD-master\mod.xml", @"C:\Program Files (x86)\Steam\steamapps\common\Team Fortress 2\tf\custom\7HUD-master", true); else w = new SettingsWindow(@"/home/daniel/Desktop/7HUD-master/mod.xml", @"/home/daniel/Desktop/7HUD-master/", true); // Show main window //using (MainWindow w = MainWindow = new MainWindow()) { XSettings.Load("config.xml"); w.Closed += (s, e) => { Application.Exit(); }; //if (Games.Count == 0) //{ // var w = new AddGamesWindow(); // w.Run(); //} //SetCurrentGame(Games[Math.Min(Math.Max((int)XSettings.Games.Attribute("selectedindex"), Games.Count - 1), 0)]); w.Show(); Application.Run(); } // Save settings XSettings.Save(); // Apply updates if (ApplyUpdate) { File.Copy("4PlugUpdate.exe", "_update.exe"); Process.Start("_update.exe"); } Application.Dispose(); }
public static void Initialize(ToolkitType type) { Initialize (Toolkit.GetBackendType (type)); }
public static void SetAppType(ToolkitType type) { AppType = type; }
internal static string GetBackendType(ToolkitType type) { string version = typeof(Application).Assembly.GetName ().Version.ToString (); switch (type) { case ToolkitType.Gtk: return "Xwt.GtkBackend.GtkEngine, Xwt.Gtk, Version=" + version; case ToolkitType.Cocoa: return "Xwt.Mac.MacEngine, Xwt.Mac, Version=" + version; case ToolkitType.Wpf: return "Xwt.WPFBackend.WPFEngine, Xwt.WPF, Version=" + version; default: throw new ArgumentException ("Invalid toolkit type"); } }
public static void Initialize(ToolkitType type) { Initialize(Toolkit.GetBackendType(type)); }
public bool Initialize(ToolkitType type) { _log.Open(Path.Combine(AppData.Path, "ParkitectNexusLauncher.log")); _log.MinimumLogLevel = LogLevel.Debug; Application.Initialize(type); _window = _presenterFactory.InstantiatePresenter<MainWindow>(); _window.Show(); var update = _updateManager.CheckForUpdates<App>(); if (update != null) { if ( MessageDialog.AskQuestion("ParkitectNexus Client Update", "A required update for the ParkitectNexus Client needs to be installed.\n" + "Without this update you won't be able to install blueprints, savegames or mods trough this application. The update should take less than a minute.\n" + $"Would you like to install it now?\n\nYou are currently running v{typeof (App).Assembly.GetName().Version}. The newest version is v{update.Version}", Command.Yes, Command.No) != Command.Yes) { return false; } if (!_updateManager.InstallUpdate(update)) MessageDialog.ShowError(_window, "ParkitectNexus Client Update", "Failed installing the update! Please try again later."); return false; } if (!_parkitect.DetectInstallationPath()) { if ( !MessageDialog.Confirm( "We couldn't automatically detect Parkitect on your machine!\nPlease press OK and manually select the installation folder of Parkitect.", Command.Ok)) { _window.Dispose(); Application.Dispose(); return false; } do { var dlg = new SelectFolderDialog("Select your Parkitect installation folder.") { CanCreateFolders = false, Multiselect = false }; if (dlg.Run(_window)) { if (_parkitect.SetInstallationPathIfValid(dlg.Folder)) break; } else { _window.Dispose(); Application.Dispose(); return false; } } while (!_parkitect.IsInstalled); } _migrator.Migrate(); ModLoaderUtil.InstallModLoader(_parkitect, _log); _taskManager.Add<CheckForUpdatesTask>(); return true; }
public static void InitializeAsGuest(ToolkitType type) { Initialize (type); toolkit.ExitUserCode (null); }
public static void InitializeAsGuest(ToolkitType type) { Initialize(type); toolkit.ExitUserCode(null); }