public void DrawRectangle(string behaviorName) { var random = new Random(); _mockBehaviorResolver .Setup(resolver => resolver.GetBehaviorHandler(behaviorName)).Returns(() => { return(new DrawContentBehavior(_sciterWindow, (element, prms) => { if (prms.DrawEvent != DrawEvent.Content) { return false; } using (var graphics = SciterGraphics.Create(prms.Handle)) { for (int i = 0; i < byte.MaxValue; i++) { graphics.SaveState() .Translate(prms.Area.Left, prms.Area.Top) .SetLineColor( (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)) .SetFillColor( (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)) .SetLineWidth(random.Next(2, 10)) .DrawRectangle(random.Next(byte.MinValue, prms.Area.Width), random.Next(byte.MinValue, prms.Area.Height), random.Next(byte.MinValue, prms.Area.Width), random.Next(byte.MinValue, prms.Area.Height)) .RestoreState(); } } element?.Window?.Close(); return true; })); }); _ = new TestableSciterHost(_sciterWindow) .SetBehaviorResolver(_mockBehaviorResolver.Object); _sciterWindow.Show(); var backgroundColor = random.Next(byte.MinValue, 80); _sciterWindow.RootElement.AppendElement("body", elm => elm) .SetStyleValue("background", $"rgb({backgroundColor}, {backgroundColor}, {backgroundColor})") .SetStyleValue("behavior", behaviorName); SciterPlatform.RunMessageLoop(); //Assert.NotNull(_sciterGraphics); }
static void Main() { SciterPlatform.EnableDragAndDrop(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
static void Main(string[] args) { MessageBox.Show(IntPtr.Zero, "ola", "mnundo"); // Platform specific (required for GTK) SciterPlatform.Initialize(); // Sciter needs this for drag 'n drop support SciterPlatform.EnableDragAndDrop(); #if GTKMONO Mono.Setup(); #endif /* * NOTE: * In Linux, if you are getting a System.TypeInitializationException below, it is because you don't have 'libsciter-gtk-64.so' in your LD_LIBRARY_PATH. * Run 'sudo bash install-libsciter.sh' contained in this package to install it in your system. */ // Create the window AppWindow = new Window(); // Prepares SciterHost and then load the page AppHost = new Host(AppWindow); // Run message loop SciterPlatform.RunMessageLoop(); }
static Task Main(string[] args) { // Platform specific (required for GTK) SciterPlatform.Initialize(); // Sciter needs this for drag 'n drop support SciterPlatform.EnableDragAndDrop(); var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables() .Build(); var services = new ServiceCollection() .AddLogging(builder => { builder .ClearProviders() .AddConfiguration(configuration.GetSection("Logging")) .AddConsole(); }) .AddSingleton <IConfiguration>(provider => configuration) .AddSciterBehavior <SciterClockBehavior>() .AddSciterBehavior <CustomDrawBehavior>() .AddSciterBehavior <CustomExchangeBehavior>() .AddSciterBehavior <CustomFocusBehavior>() .AddSciterBehavior <CustomMouseBehavior>() .AddSciter <ApplicationHost>(); var serviceProvider = services.BuildServiceProvider(); return(serviceProvider.RunSciterAsync()); }
public void DrawLine(string behaviorName) { var random = new Random(); _mockBehaviorResolver .Setup(resolver => resolver.GetBehaviorHandler(behaviorName)).Returns(() => { return(new DrawContentBehavior(_sciterWindow, (element, prms) => { if (prms.DrawEvent != DrawEvent.Content) { return false; } using (var graphics = SciterGraphics.Create(prms.Handle)) { for (var i = 0; i < byte.MaxValue; i++) { graphics.SaveState() .Translate(prms.Area.Left, prms.Area.Top) .SetLineColor((byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)) .SetFillColor((byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)) .SetLineWidth(random.Next(2, 10)) .DrawText( SciterText.CreateForElementAndStyle( "The quick brown fox jumps over the lazy dog", element.Handle, $"color: rgba({random.Next(byte.MinValue, byte.MaxValue)}, {random.Next(byte.MinValue, byte.MaxValue)}, {random.Next(byte.MinValue, byte.MaxValue)});font-size: {random.Next(12, 48)}dip;"), random.Next(byte.MinValue, prms.Area.Width), random.Next(byte.MinValue, prms.Area.Height), 5) .RestoreState(); } } element?.Window?.Close(); return true; })); }); _ = new TestableSciterHost(_sciterWindow) .SetBehaviorResolver(_mockBehaviorResolver.Object); _sciterWindow.Show(); _sciterWindow.RootElement.AppendElement("body", elm => elm) .SetStyleValue("background-color", $"black") .SetStyleValue("behavior", behaviorName); SciterPlatform.RunMessageLoop(); //Assert.NotNull(_sciterGraphics); }
static void Main() { SciterPlatform.Initialize(); SciterPlatform.EnableDragAndDrop(); Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
static void Main(string[] args) { var list = new List <int> { 123 }; var ss = SciterValue.Create(new { aa = list }); Console.WriteLine($@"Sciter: {Sciter.SciterApi.SciterVersion()}"); Console.WriteLine("Bitness: " + IntPtr.Size); // Platform specific (required for GTK) SciterPlatform.Initialize(); // SciterCore needs this for drag 'n drop support (on Windows) SciterPlatform.EnableDragAndDrop(); // Create the window AppWindow = new SciterWindow() .CreateMainWindow(800, 600) .CenterWindow() .SetTitle("SciterCore.Windows::Core") .SetIcon(SciterTest.Core.Properties.Resources.IconMain); // Prepares SciterHost and then load the page AppHost = new AppHost(AppWindow); AppHost .SetupWindow(AppWindow) .AttachEventHandler(new AppEventHandler()); AppHost.SetupPage("index.html"); //AppHost.ConnectToInspector(); //byte[] css_bytes = File.ReadAllBytes(@"D:\ProjetosSciter\AssetsDrop\AssetsDrop\res\css\global.css"); //SciterX.API.SciterAppendMasterCSS(css_bytes, (uint) css_bytes.Length); Debug.Assert(!AppHost.EvalScript("Utils").IsUndefined); // Show window and Run message loop AppWindow.Show(); SciterPlatform.RunMessageLoop(); }
static void Main(string[] args) { // Platform specific (required for GTK) SciterPlatform.Initialize(); // Sciter needs this for drag 'n drop support SciterPlatform.EnableDragAndDrop(); Console.WriteLine($@"Sciter: {Sciter.SciterApi.SciterVersion()}"); // Create the window var window = new SciterWindow() .CreateMainWindow(1500, 800) .CenterWindow() .SetTitle("SciterCore::Framework::Graphics::SkiaSharp"); #if WINDOWS window.SetIcon(Properties.Resources.IconMain); #endif // Prepares SciterHost and then load the page var host = new Host(window: window); /* * host.RegisterBehaviorHandler(typeof(DrawBitmapBehavior), "DrawBitmap") * .RegisterBehaviorHandler(typeof(DrawTextBehavior), "DrawText") * .RegisterBehaviorHandler(typeof(DrawGeometryBehavior), "DrawGeometry") * .AttachEventHandler(new HostEventHandler()); * * host.SetupPage("index.html"); * * // Show window and Run message loop * window.Show(); */ SciterPlatform.RunMessageLoop(); GC.Collect(); GC.WaitForPendingFinalizers(); }
static Task Main(string[] args) { // Platform specific (required for GTK) SciterPlatform.Initialize(); // Sciter needs this for drag 'n drop support SciterPlatform.EnableDragAndDrop(); var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables() .Build(); var services = new ServiceCollection() .AddLogging(builder => { builder .ClearProviders() .AddConfiguration(configuration.GetSection("Logging")) .AddConsole(); }) .AddSingleton <IConfiguration>(provider => configuration) .AddSciterBehavior <DrawBitmapBehavior>() .AddSciterBehavior <InfoBitmapBehavior>() .AddSciterBehavior <SolidBitmapBehavior>() .AddSciterBehavior <SolidForegroundBitmapBehavior>() .AddSciterBehavior <LinearBitmapBehavior>() .AddSciterBehavior <LinearForegroundBitmapBehavior>() .AddSciterBehavior <RadialBitmapBehavior>() .AddSciterBehavior <RadialForegroundBitmapBehavior>() .AddSciter <SkiaSharpAppHost>(); var serviceProvider = services.BuildServiceProvider(); var app = serviceProvider.GetRequiredService <SciterApplication>(); return(app.RunAsync()); }
static void Main(string[] args) { // Platform specific (required for GTK) SciterPlatform.Initialize(); // Sciter needs this for drag 'n drop support SciterPlatform.EnableDragAndDrop(); var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables() .Build(); var services = new ServiceCollection() .AddLogging(builder => { builder .ClearProviders() .AddConfiguration(configuration.GetSection("Logging")) .AddConsole(); }) .AddSingleton <IConfiguration>(configuration) .AddSciter <AppHost, AppEventHandler>(hostOptions => hostOptions .SetArchiveUri("this://app/") .SetHomePage("index.html"), windowOptions => windowOptions .SetPosition(SciterWindowPosition.Default)); //.AddSingleton<SciterApplication>(); var serviceProvider = services.BuildServiceProvider(); var app = serviceProvider.GetRequiredService <SciterApplication>(); app.Run(); }
static void Main(string[] args) { // Platform specific (required for GTK) SciterPlatform.Initialize(); // Sciter needs this for drag 'n drop support SciterPlatform.EnableDragAndDrop(); var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables() .Build(); var services = new ServiceCollection() .AddLogging(builder => { builder .ClearProviders() .AddConfiguration(configuration.GetSection("Logging")) .AddConsole(); }) .AddSingleton <IConfiguration>(configuration) .AddSciterBehavior <RuntimeInformationBehavior>() .AddSciter <AppHost, AppEventHandler>(hostOptions => hostOptions .SetArchiveUri("this://app/") .SetHomePage(provider => { string indexPage = null; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { indexPage = "index-win.html"; } if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { indexPage = "index-lnx.html"; } if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { indexPage = "index-macos.html"; } if (string.IsNullOrWhiteSpace(indexPage)) { throw new PlatformNotSupportedException(); } #if DEBUG //Used for development/debugging (load file(s) from the disk) //See this .csproj file for the SciterCorePackDirectory and SciterCorePackCopyToOutput properties var location = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var path = Path.Combine(location ?? string.Empty, "wwwroot", indexPage); var uri = new Uri(path, UriKind.Absolute); Debug.Assert(uri.IsFile); Debug.Assert(File.Exists(uri.AbsolutePath)); #else var uri = new Uri(uriString: indexPage, UriKind.Relative); #endif return(uri); }), windowOptions => windowOptions .SetPosition(SciterWindowPosition.CenterScreen)); //.AddSingleton<SciterApplication>(); var serviceProvider = services.BuildServiceProvider(); var app = serviceProvider.GetRequiredService <SciterApplication>(); app.Run(); }
public void ShowModal(IntPtr handle) { Show(handle); SciterPlatform.RunMessageLoop(handle); }
public void DrawLine_with_lineCap_and_lineJoin(string behaviorName, LineCapType lineCap, LineJoinType lineJoin) { var random = new Random(); _mockBehaviorResolver.Setup(resolver => resolver.GetBehaviorHandler(behaviorName)) .Returns(() => { return(new DrawContentBehavior(_sciterWindow, (element, args) => { if (args.DrawEvent != DrawEvent.Content) { return false; } using (var graphics = SciterGraphics.Create(args.Handle)) { for (var i = 0; i < byte.MaxValue; i++) { graphics.SaveState() .Translate(args.Area.Left, args.Area.Top) .SetLineColor( (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)) .SetFillColor( (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)) .SetLineWidth(random.Next(2, 10)) .SetLineCap(lineCap) .SetLineJoin(lineJoin) .DrawLine(random.Next(byte.MinValue, args.Area.Width), random.Next(byte.MinValue, args.Area.Height), random.Next(byte.MinValue, args.Area.Width), random.Next(byte.MinValue, args.Area.Height)) .SetLineGradientLinear( 0f, 0f, args.Area.Width / 2f, args.Area.Height, SciterColorStop.Create(0f, (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)), SciterColorStop.Create(.5f, (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)), SciterColorStop.Create(1f, (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue))) .DrawLine(random.Next(byte.MinValue, args.Area.Width), random.Next(byte.MinValue, args.Area.Height), random.Next(byte.MinValue, args.Area.Width), random.Next(byte.MinValue, args.Area.Height)) .RestoreState(); } } element?.Window?.Close(); return true; })); }); _ = new TestableSciterHost(_sciterWindow) .SetBehaviorResolver(_mockBehaviorResolver.Object); _sciterWindow.Show(); _sciterWindow.RootElement.AppendElement("body", elm => elm) .SetStyleValue("background", $"rgb({random.Next(byte.MinValue, byte.MaxValue)}, {random.Next(byte.MinValue, byte.MaxValue)}, {random.Next(byte.MinValue, byte.MaxValue)})") .SetStyleValue("behavior", behaviorName); SciterPlatform.RunMessageLoop(); //Assert.NotNull(_sciterGraphics); }
public void Draw_line_with_linear_gradient(string behaviorName) { var random = new Random(); _mockBehaviorResolver .Setup(resolver => resolver.GetBehaviorHandler(behaviorName)).Returns(() => { return(new DrawContentBehavior(_sciterWindow, (element, args) => { if (args.DrawEvent != DrawEvent.Content) { return false; } using (var graphics = SciterGraphics.Create(args.Handle)) { for (var i = 0; i < 10; i++) { graphics.SaveState() .Translate(args.Area.Left, args.Area.Top) .SetLineWidth(random.Next(5, 15)) .SetLineGradientLinear( 0f, 0f, args.Area.Width, args.Area.Height, SciterColorStop.Create(0f, Color.Aqua), SciterColorStop.Create(.25f, (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (float)random.NextDouble()), SciterColorStop.Create(.5f, (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)), SciterColorStop.Create(.75f, (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)), SciterColorStop.Create(1f, SciterColor.Lime)) .DrawLine(random.Next(byte.MinValue, args.Area.Width), random.Next(byte.MinValue, args.Area.Height), random.Next(byte.MinValue, args.Area.Width), random.Next(byte.MinValue, args.Area.Height)); graphics.SaveState() .Translate((args.Area.Right - args.Area.Left) / 2f, (args.Area.Height - args.Area.Top) / 2f) .SetLineGradientLinear( 0f, 0f, args.Area.Width, args.Area.Height, SciterColorStop.Create(0f, Color.Orange), SciterColorStop.Create(.25f, (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (float)random.NextDouble()), SciterColorStop.Create(.5f, (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)), SciterColorStop.Create(.75f, (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)), SciterColorStop.Create(1f, SciterColor.Indigo)) .DrawEllipse(0, random.Next(0), random.Next(byte.MinValue, args.Area.Width / 2), random.Next(byte.MinValue, args.Area.Height / 2)) .DrawRectangle(random.Next(byte.MinValue, args.Area.Width), random.Next(byte.MinValue, args.Area.Height), random.Next(byte.MinValue, args.Area.Width / 2), random.Next(byte.MinValue, args.Area.Height / 2)) .RestoreState(); graphics.SaveState() .Translate(args.Area.Left, args.Area.Top) .SetLineGradientLinear( 0f, 0f, args.Area.Width, args.Area.Height, SciterColorStop.Create(0f, Color.Coral), SciterColorStop.Create(.25f, (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (float)random.NextDouble()), SciterColorStop.Create(.5f, (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)), SciterColorStop.Create(.75f, (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)), SciterColorStop.Create(1f, SciterColor.Magenta)) .DrawRectangle(random.Next(byte.MinValue, args.Area.Width), random.Next(byte.MinValue, args.Area.Height), random.Next(byte.MinValue, args.Area.Width / 2), random.Next(byte.MinValue, args.Area.Height / 2)) .RestoreState(); graphics.RestoreState(); } } element?.Window?.Close(); return true; })); }); _ = new TestableSciterHost(_sciterWindow) .SetBehaviorResolver(_mockBehaviorResolver.Object); _sciterWindow.Show(); _sciterWindow.RootElement.AppendElement("body", elm => elm) .SetStyleValue("background-color", $"rgb({random.Next(byte.MinValue, byte.MaxValue)}, {random.Next(byte.MinValue, byte.MaxValue)}, {random.Next(byte.MinValue, byte.MaxValue)})") .SetStyleValue("behavior", behaviorName); SciterPlatform.RunMessageLoop(); }
public App() { SciterPlatform.Initialize(); SciterPlatform.EnableDragAndDrop(); }
static Task Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += (sender, eventArgs) => throw ((Exception)eventArgs.ExceptionObject); // Platform specific (required for GTK) SciterPlatform.Initialize(); // Sciter needs this for drag 'n drop support SciterPlatform.EnableDragAndDrop(); var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables() .Build(); var services = new ServiceCollection() .AddLogging(builder => { builder .ClearProviders() .AddConfiguration(configuration.GetSection("Logging")) .AddConsole(); }) .AddSingleton <IConfiguration>(provider => configuration) .AddSciterArchivesFromAssembly(Assembly.Load("SciterCore.SciterSharp.Utilities")) .AddSciterBehavior <DragDropBehavior>() .AddSciterBehavior <SecondBehavior>() .AddSciter <AppHost, AppEventHandler>(hostOptions => hostOptions .SetArchiveUri("this://app/") .SetHomePage(provider => { string indexPage = null; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { var osVersion = Environment.OSVersion.Version; if (osVersion.Major < 6 || (osVersion.Major == 6 && osVersion.Minor < 1)) { indexPage = "index-win.html"; // TODO: Add fallback page } else { indexPage = "index-win.html"; } } if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { indexPage = "index-lnx.html"; } if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { indexPage = "index-macos.html"; } if (string.IsNullOrWhiteSpace(indexPage)) { throw new PlatformNotSupportedException(); } #if DEBUG //Used for development/debugging (load file(s) from the disk) //See this .csproj file for the SciterCorePackDirectory and SciterCorePackCopyToOutput properties var location = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var path = Path.Combine(location ?? string.Empty, "wwwroot", indexPage); var uri = new Uri(path, UriKind.Absolute); Debug.Assert(uri.IsFile); Debug.Assert(File.Exists(uri.AbsolutePath)); #else var uri = new Uri(uriString: indexPage, UriKind.Relative); #endif return(uri); }), windowOptions => windowOptions .SetTitle("SciterCore::Hello") .SetDimensions(800, 600) .SetPosition(SciterWindowPosition.CenterScreen)); var serviceProvider = services.BuildServiceProvider(); return(serviceProvider.RunSciterAsync()); }
public void DrawEllipse(string behaviorName) { var random = new Random(); _mockBehaviorResolver.Setup(resolver => resolver.GetBehaviorHandler(behaviorName)) .Returns(() => { return(new DrawContentBehavior(_sciterWindow, (element, prms) => { switch (prms.DrawEvent) { case DrawEvent.Content: using (var graphics = SciterGraphics.Create(prms.Handle)) { for (int i = 0; i < byte.MaxValue; i++) { var color = SciterColor.Create( (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue), (byte)random.Next(byte.MinValue, byte.MaxValue)); graphics.SaveState() .Translate(prms.Area.Left, prms.Area.Top) .SetLineColor(color) .SetLineWidth(random.Next(1, 4)) .DrawEllipse(prms.Area.Width / 2f, prms.Area.Height / 2f, random.Next(byte.MinValue, prms.Area.Width / 2), random.Next(byte.MinValue, prms.Area.Height / 2)) //.DrawPath( // SciterPath // .Create() // .MoveTo(prms.area.Width / 2, prms.area.Height / 2) // .ArcTo(random.Next(byte.MinValue, prms.area.Width), random.Next(byte.MinValue, prms.area.Height), random.Next(0, 360), random.Next(byte.MinValue, byte.MaxValue), random.Next(byte.MinValue, byte.MaxValue), false, true) // .LineTo(random.Next(byte.MinValue, prms.area.Width / 2), random.Next(byte.MinValue, prms.area.Height / 2)) // .BezierCurveTo(random.Next(byte.MinValue, byte.MaxValue), random.Next(byte.MinValue, byte.MaxValue), random.Next(byte.MinValue, byte.MaxValue), random.Next(byte.MinValue, byte.MaxValue), random.Next(byte.MinValue, prms.area.Width / 2), random.Next(byte.MinValue, prms.area.Height / 2)) // .QuadraticCurveTo(random.Next(byte.MinValue, byte.MaxValue), random.Next(byte.MinValue, byte.MaxValue), random.Next(byte.MinValue, prms.area.Width / 2), random.Next(byte.MinValue, prms.area.Height / 2)) // , DrawPathMode.StrokeOnly) //.DrawEllipse(prms.area.Width / 2, prms.area.Height / 2, 50f, 50f) //.SetLineColor(SciterColor.Transparent) //.SetFillColor(color) //.DrawPath( // SciterPath // .Create() // .MoveTo(prms.area.Width / 2, prms.area.Height / 2 - 50) // .ArcTo(prms.area.Width / 2, prms.area.Height / 2, 90, 25, 25, false, true) // .ArcTo(prms.area.Width / 2, prms.area.Height / 2 + 50, 90, 25, 25, false, false) // .ArcTo(prms.area.Width / 2, prms.area.Height / 2 - 50, 90, 50, 50, false, false) // , DrawPathMode.FillOnly) // //.DrawEllipse(prms.area.Width / 2, prms.area.Height / 2 - 25, 6f, 6f) //.DrawEllipse(prms.area.Width / 2, prms.area.Height / 2 + 25, 6f, 6f) .RestoreState(); } } break; case DrawEvent.Background: case DrawEvent.Foreground: case DrawEvent.Outline: default: return false; } element?.Window?.Close(); return true; })); }); _ = new TestableSciterHost(_sciterWindow) .SetBehaviorResolver(_mockBehaviorResolver.Object); _sciterWindow.Show(); var backgroundColor = random.Next(byte.MinValue, 80); _sciterWindow.RootElement.AppendElement("body", elm => elm) .SetStyleValue("background", $"rgb({backgroundColor}, {backgroundColor}, {backgroundColor})") .SetStyleValue("behavior", behaviorName); SciterPlatform.RunMessageLoop(); //Assert.NotNull(_sciterGraphics); }
static void Main(string[] args) { // Platform specific (required for GTK) SciterPlatform.Initialize(); // Sciter needs this for drag 'n drop support SciterPlatform.EnableDragAndDrop(); var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables() .Build(); var services = new ServiceCollection() .AddLogging(builder => { builder .ClearProviders() .AddConfiguration(configuration.GetSection("Logging")) .AddConsole(); }) .AddSingleton <IConfiguration>(provider => configuration) .AddTransient <ApplicationWindow>() .AddTransient <HostEventHandler>() //.AddScoped<SciterHost>() .AddTransient <BaseHost>() .AddTransient <ApplicationHost>() .AddTransient <CustomHostEventHandler>() .AddTransient <CustomHost>() .AddTransient <CustomWindow>() .AddTransient <SciterApplication>(); var serviceProvider = services.BuildServiceProvider(); var app = serviceProvider.GetRequiredService <SciterApplication>(); app.Run(serviceProvider.GetRequiredService <ApplicationHost>()); //var host = new HostBuilder() // .ConfigureHostConfiguration(configHost => // { // configHost.SetBasePath(Directory.GetCurrentDirectory()); // //configHost.AddJsonFile(_hostsettings, optional: true); // //configHost.AddEnvironmentVariables(prefix: _prefix); // configHost.AddCommandLine(args); // }) // .ConfigureAppConfiguration((hostContext, configApp) => // { // configApp.SetBasePath(Directory.GetCurrentDirectory()); // //configApp.AddJsonFile(_appsettings, optional: true); // configApp.AddJsonFile( // $"appsettings.{hostContext.HostingEnvironment.EnvironmentName}.json", // optional: true); // //configApp.AddEnvironmentVariables(prefix: _prefix); // configApp.AddCommandLine(args); // }) // .ConfigureServices((hostContext, services) => // { // services.AddLogging(); // services.AddHostedService<Startup>(); // }) // .ConfigureLogging((hostContext, configLogging) => // { // configLogging.AddConsole(); // }) // .UseConsoleLifetime() // .Build(); //await host.RunAsync(); }
public void ShowModal(IntPtr window) { Show(window); SciterPlatform.RunMessageLoop(window); }