private static void Main(string[] args) { Console.WriteLine(@"nossued website"); // client framework (use Vue.js) var vue = new VueResourceProvider(); var provider = StonehengeResourceLoader.CreateDefaultLoader(vue); // options var options = new StonehengeHostOptions { Title = "NOSSUED", StartPage = "home", ServerPushMode = ServerPushModes.LongPolling, PollIntervalMs = 5000 }; // hosting var host = new KestrelHost(provider, options); if (!host.Start("localhost", 32000)) { Console.WriteLine(@"Failed to start server on: " + host.BaseUrl); Environment.Exit(1); } // wait for user pressing Ctrl+C to terminate var terminate = new AutoResetEvent(false); Console.CancelKeyPress += (sender, eventArgs) => { terminate.Set(); }; Console.WriteLine(@"Started server on: " + host.BaseUrl); terminate.WaitOne(); Console.WriteLine(@"Server terminated."); host.Terminate(); }
public ResolveVmDependenciesTest() { Id = Guid.NewGuid(); _loader = StonehengeResourceLoader.CreateDefaultLoader(StonehengeLogger.DefaultLogger, null); _loader.Services.AddService(typeof(ResolveVmDependenciesTest), this); _session = new AppSession(_loader, new StonehengeHostOptions()); }
public ControllerCreationTests() { _options = new StonehengeHostOptions(); _vue = new VueResourceProvider(StonehengeLogger.DefaultLogger); _loader = StonehengeResourceLoader.CreateDefaultLoader(StonehengeLogger.DefaultLogger, _vue); _loader.InitProvider(_loader, _options); _loader.Services.AddService(typeof(DiDependency), new DiDependency()); _session = new AppSession(_loader, _options); }
// ReSharper disable once UnusedParameter.Local private static void Main(string[] args) { Console.WriteLine("Sample showing stonehenge on Chromely"); // stonehenge backend var options = new StonehengeHostOptions { Title = "Demo" }; var provider = StonehengeResourceLoader .CreateDefaultLoader(new VueResourceProvider()); var host = new KestrelHost(provider, options); if (!host.Start(options.Title, false, "localhost", 8888)) { Console.WriteLine("Failed to start stonehenge server"); } // ensure CEF runtime files are present var path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) ?? "."; Directory.SetCurrentDirectory(path); try { CefRuntime.Load(); } catch (Exception ex) { Console.WriteLine("Failed to load runtime: " + ex.Message); Console.WriteLine("Installing CEF runtime from " + CefLoader.CefBuildsDownloadUrl); CefLoader.Load(); } // chromely frontend var startUrl = host.BaseUrl; var config = ChromelyConfiguration .Create() .WithHostMode(WindowState.Normal, true) .WithHostTitle(options.Title) //.WithHostIconFile("chromely.ico") .WithAppArgs(args) .WithHostSize(1000, 600) .WithStartUrl(startUrl); using (var window = new CefGlueBrowserWindow(config)) { var exitCode = window.Run(args); if (exitCode != 0) { Console.WriteLine("Failed to start chromely frontend: code " + exitCode); } } Console.WriteLine("Demo done."); }
public StonehengeUi(ILogger logger, StonehengeHostOptions options, Assembly appAssembly) { _options = options; StonehengeLogger.DefaultLevel = LogLevel.Trace; Logger = logger; var vue = new VueResourceProvider(Logger); _loader = StonehengeResourceLoader.CreateDefaultLoader(Logger, vue, appAssembly); }
private static void Main() { Console.WriteLine("NOSSUED InfoScreenServer"); var cfgFile = Path.Combine(Application.GetApplicationDirectory(), "InfoScreen.cfg"); var profile = new Profile(cfgFile); var settings = new InfoSettings(); var spp = new ClassPropertyProvider(settings); spp.SetProperties(profile["Event"].Properties); spp.SetProperties(profile["Twitter"].Properties); Console.WriteLine($"Event {settings.Name}, Keyword = {settings.Keywords}"); var key = ""; //Environment.GetEnvironmentVariable("twitter-key"); var secret = ""; //Environment.GetEnvironmentVariable("twitter-secret"); _client = new TwitterClient(settings); if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(secret)) { Console.WriteLine("Missing twitter auth - start demo mode"); var tweets = Path.Combine(Application.GetApplicationDirectory(), "DemoTweets.json"); var json = File.ReadAllText(tweets); _client.Tweets = JsonConvert.DeserializeObject <List <TwitterMessage> >(json); } else { _client.Connect(key, secret); } var vue = new VueResourceProvider(); var provider = StonehengeResourceLoader.CreateDefaultLoader(vue); provider.Services.AddService(typeof(TwitterClient), _client); provider.Services.AddService(typeof(InfoSettings), settings); var options = new StonehengeHostOptions { Title = settings.Name }; var host = new KestrelHost(provider, options); host.Start("localhost", 32000); Process.Start(new ProcessStartInfo(host.BaseUrl) { UseShellExecute = true }); Console.ReadLine(); _client.Dispose(); }
private static void Main(string[] args) { Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); var path = ApplicationInfo.ApplicationDirectory; Directory.SetCurrentDirectory(path); var settingsFile = new Profile(Path.Combine(path, "GitState.cfg")); new ProfileClassLoader().LoadClass(Settings, settingsFile); // Starting stonehenge backend var options = new StonehengeHostOptions { Title = "GitState", StartPage = "main", ServerPushMode = ServerPushModes.LongPolling, PollIntervalSec = 10 }; var logger = Logger.DefaultFactory.CreateLogger("GitState"); var provider = StonehengeResourceLoader .CreateDefaultLoader(logger, new VueResourceProvider(logger)); var host = new KestrelHost(provider, options); if (!host.Start("localhost", 8880)) { Console.WriteLine("Failed to start stonehenge server"); } // Starting chromely frontend Console.WriteLine("Starting chromely frontend"); var config = DefaultConfiguration.CreateForRuntimePlatform(); config.CefDownloadOptions = new CefDownloadOptions(true, true); config.StartUrl = host.BaseUrl; config.WindowOptions = new WindowOptions { Title = "GitState", Size = new WindowSize(Settings.WindowWidth, Settings.WindowHeight), RelativePathToIconFile = "GitState.ico" }; config.DebuggingMode = true; AppBuilder .Create() .UseApp <ChromelyBasicApp>() .UseConfig <IChromelyConfiguration>(config) .Build() .Run(args); Console.ReadLine(); Console.WriteLine("GitState done."); }
public VueTestApp(Assembly appAssembly = null) { var vue = new VueResourceProvider(StonehengeLogger.DefaultLogger); var loader = appAssembly != null ? StonehengeResourceLoader.CreateDefaultLoader(StonehengeLogger.DefaultLogger, vue, appAssembly) : StonehengeResourceLoader.CreateDefaultLoader(StonehengeLogger.DefaultLogger, vue); loader.Services.AddService(typeof(VueTestData), Data); _server = new KestrelHost(loader); _server.Start("localhost"); }
static void Main(string[] args) { Console.WriteLine("SunSpec Explorer"); var consoleListener = new ConsoleTraceListener(); Trace.Listeners.Add(consoleListener); var options = new StonehengeHostOptions { Title = "SunSpec Explorer", StartPage = "explorer", ServerPushMode = ServerPushModes.LongPolling, PollIntervalMs = 5000 }; var vue = new VueResourceProvider(); var provider = StonehengeResourceLoader.CreateDefaultLoader(vue); //provider.Services.AddService(typeof(InformantEngine), _engine); var host = new KestrelHost(provider, options); if (!host.Start("localhost", 8080)) { Console.WriteLine("Failed to start stonehenge server"); } var config = DefaultConfiguration.CreateForRuntimePlatform(); config.CefDownloadOptions = new CefDownloadOptions { AutoDownloadWhenMissing = true, DownloadSilently = true }; config.WindowOptions = new WindowOptions { Title = " ", //RelativePathToIconFile = "Informant.ico", Size = new WindowSize( (int)(1000 * Display.GetScalingFactor()), (int)(600 * Display.GetScalingFactor())) }; config.DebuggingMode = true; config.StartUrl = host.BaseUrl; AppBuilder .Create() .UseConfiguration <IChromelyConfiguration>(config) .UseApp <ChromelyBasicApp>() .Build() .Run(args); }
// ReSharper disable once UnusedParameter.Local private static void Main(string[] args) { Console.WriteLine("IctBaden.Modbus.SampleDevice"); Trace.Listeners.Add(new TronTraceListener(true)); var logger = Framework.Logging.Logger.DefaultFactory.CreateLogger("Modbus"); var source = new TestData(); var device = new ModbusSlave("Sample", source, 1502, 1); device.Start(); var options = new StonehengeHostOptions { Title = "Modbus", StartPage = "device", ServerPushMode = ServerPushModes.LongPolling, PollIntervalSec = 5 }; var vue = new VueResourceProvider(logger); var provider = StonehengeResourceLoader.CreateDefaultLoader(logger, vue); provider.Services.AddService(typeof(TestData), source); provider.Services.AddService(typeof(ModbusSlave), device); var host = new KestrelHost(provider, options); if (!host.Start("*", 0)) { Console.WriteLine("Failed to start stonehenge server"); return; } var wnd = new HostWindow(host.BaseUrl, "Modbus", new Point(600, 800)); if (!wnd.Open()) { Console.WriteLine("Failed to open window"); } Console.WriteLine("Done."); }
private static void Main() { Trace.Listeners.Add(new System.Diagnostics.ConsoleTraceListener()); StonehengeLogger.DefaultLevel = LogLevel.Trace; var logger = LoggerFactory.CreateLogger("stonehenge"); Console.WriteLine(@""); Console.WriteLine(@"Stonehenge 3 sample"); Console.WriteLine(@""); logger.LogInformation("Vue.SampleCore started"); // select hosting options var options = new StonehengeHostOptions { Title = "VueSample", ServerPushMode = ServerPushModes.LongPolling, PollIntervalSec = 10, SessionIdMode = SessionIdModes.Automatic, HandleWindowResized = true // SslCertificatePath = Path.Combine(StonehengeApplication.BaseDirectory, "stonehenge.pfx"), // SslCertificatePassword = "******" }; // Select client framework Console.WriteLine(@"Using client framework vue"); var vue = new VueResourceProvider(logger); var loader = StonehengeResourceLoader.CreateDefaultLoader(logger, vue); loader.Services.AddService(typeof(ILogger), logger); // Select hosting technology var hosting = "kestrel"; if (Environment.CommandLine.Contains("/simple")) { hosting = "simple"; } switch (hosting) { case "kestrel": Console.WriteLine(@"Using Kestrel hosting"); _server = new KestrelHost(loader, options); break; case "simple": Console.WriteLine(@"Using simple http hosting"); _server = new SimpleHttpHost(loader, options); break; } Console.WriteLine(@"Starting server"); var terminate = new AutoResetEvent(false); Console.CancelKeyPress += (_, _) => { terminate.Set(); }; var host = Environment.CommandLine.Contains("/localhost") ? "localhost" : "*"; if (_server.Start(host, 32000)) { Console.WriteLine(@"Server reachable on: " + _server.BaseUrl); if (Environment.CommandLine.Contains("/window")) { using var wnd = new HostWindow(_server.BaseUrl, options.Title); if (!wnd.Open()) { logger.LogError("Failed to open main window"); terminate.Set(); } } else { terminate.WaitOne(); } Console.WriteLine(@"Server terminated."); } else { Console.WriteLine(@"Failed to start server on: " + _server.BaseUrl); } #pragma warning disable 0162 // ReSharper disable once HeuristicUnreachableCode _server.Terminate(); Console.WriteLine(@"Exit sample app"); Environment.Exit(0); }
private static void Main() { var consoleListener = new ConsoleTraceListener(); Trace.Listeners.Add(consoleListener); Console.WriteLine(@""); Console.WriteLine(@"Stonehenge 3 sample"); Console.WriteLine(@""); // Select client framework Console.WriteLine(@"Using client framework aurelia"); var loader = StonehengeResourceLoader.CreateDefaultLoader(new AureliaResourceProvider()); var options = new StonehengeHostOptions { Title = "Sample", StartPage = "start", SessionIdMode = SessionIdModes.CookiesOnly }; // Select hosting technology var hosting = "kestrel"; if (Environment.CommandLine.Contains("/Simple")) { hosting = "simple"; } switch (hosting) { case "kestrel": Console.WriteLine(@"Using Kestrel hosting"); _server = new KestrelHost(loader, options); break; case "simple": Console.WriteLine(@"Using simple http hosting"); _server = new SimpleHttpHost(loader, options); break; } Console.WriteLine(@"Starting server"); var terminate = new AutoResetEvent(false); Console.CancelKeyPress += (sender, eventArgs) => { terminate.Set(); }; var host = Environment.CommandLine.Contains("/localhost") ? "localhost" : "*"; if (_server.Start(host, 32000)) { Console.WriteLine(@"Started server on: " + _server.BaseUrl); var wnd = new HostWindow(_server); if (!wnd.Open()) { Trace.TraceError("Failed to open main window."); terminate.WaitOne(); } Console.WriteLine(@"Server terminated."); } else { Console.WriteLine(@"Failed to start server on: " + _server.BaseUrl); } #pragma warning disable 0162 // ReSharper disable once HeuristicUnreachableCode _server.Terminate(); Environment.Exit(0); }