protected static void Run() { using (var window = new Window()) { window.Title = "MyApp"; window.Icon = AppIcon.FromFile("icon", "."); Application.ContentProvider = new EmbeddedContentProvider("App"); Application.Run(window, "index.html"); } }
protected static void Run() { // this creates a new window with default values using (var window = new Window()) { window.Icon = AppIcon.FromFile("icon", "."); // these are only called in Debug mode: SetDevSettings(window); // the port number is defined in the angular.json file (under "architect"->"serve"->"options"->"port") // note that you have to run the angular dev server first (npm run watch) Application.UriWatcher = new AngularDevUriWatcher("http://localhost:65000"); // this relates to the path defined in the .csproj file Application.ContentProvider = new EmbeddedContentProvider("Angular\\dist"); // runs the application and opens the window with the given page loaded Application.Run(window, "/index.html"); } }
public static void Main(string[] args) { // Note: Program.cs is shared between all projects for convenience. // You could just as well have a separate startup logic for each platform. // this creates a new configuration with default values var config = new WindowConfiguration(); var icon = AppIcon.FromFile("icon", "Icons"); // we have a separate assembly for the client side files config.ContentAssembly = typeof(DummyMarker).Assembly; // this relates to the path defined in the client .csproj file config.ContentFolder = "Angular\\dist"; config.Icon = icon; // this is only called in Debug mode: SetDevServer(config); // runs the application and opens a window with the given page loaded Application.Run(config, "index.html"); }
protected static void Run(BotArguments botArguments) { using (var bot = new Bot()) using (var window = new Window()) { bot.Execute(botArguments); window.UseBrowserTitle = false; window.Title = "Bot Brown"; window.CanResize = true; window.SetWindowState(WindowState.Maximized); window.Icon = AppIcon.FromFile("botbrown", "."); window.EnableDevTools = false; // this relates to the path defined in the .csproj file Application.ContentProvider = new EmbeddedContentProvider("App"); string port = botArguments.Port ?? (botArguments.IsDebug ? WebserverConstants.DebugPort : WebserverConstants.ProductivePort); Application.Run(window, $"http://localhost:{port}"); } }
protected static void Run() { var icon = AppIcon.FromFile("icon", "."); var serviceCollection = new ServiceCollection(); serviceCollection.AddScoped <UiBridge>(); Application.AddGlobalHandler <UiBridge>(); using var serviceProvider = serviceCollection.BuildServiceProvider(); _serviceProvider = serviceProvider; using (var window = new Window(serviceProvider)) { _mainWindow = window; window.Title = "SpiderEye Playground"; window.UseBrowserTitle = true; window.EnableScriptInterface = true; window.CanResize = true; window.BackgroundColor = "#303030"; window.Size = new Size(800, 600); window.MinSize = new Size(300, 200); window.MaxSize = new Size(1200, 900); window.Icon = icon; window.Navigating += (sender, uri) => Console.WriteLine("uri changed: " + uri); var windowMenu = new Menu(); var appMenu = windowMenu.MenuItems.AddLabelItem("App"); appMenu.MenuItems.AddMacOsHide(); appMenu.MenuItems.AddMacOsHideOtherApplications(); appMenu.MenuItems.AddMacOsUnhideAllApplications(); appMenu.MenuItems.AddMacOsSeparator(); var quitMenu = appMenu.MenuItems.AddLabelItem("Quit"); quitMenu.SetSystemShortcut(SystemShortcut.Close); quitMenu.Click += (s, e) => Application.Exit(); windowMenu.MenuItems.AddMacOsEdit(); windowMenu.MenuItems.AddMacOsView(); var mainMenu = windowMenu.MenuItems.AddLabelItem("Main Menu"); mainMenu.MenuItems.AddLabelItem("Entry 1"); mainMenu.MenuItems.AddSeparatorItem(); mainMenu.MenuItems.AddLabelItem("Entry 2"); var showModalMenu = mainMenu.MenuItems.AddLabelItem("Show Modal"); showModalMenu.Click += (s, e) => ShowModalMenu_Click(true); showModalMenu.SetShortcut(ModifierKey.Control | ModifierKey.Shift, Key.M); var showWindowMenu = mainMenu.MenuItems.AddLabelItem("Show Window"); showWindowMenu.Click += (s, e) => ShowModalMenu_Click(false); showWindowMenu.SetShortcut(ModifierKey.Control | ModifierKey.Shift, Key.W); windowMenu.MenuItems.AddMacOsWindow(); var helpMenu = windowMenu.MenuItems.AddLabelItem("Help"); var helpItem = helpMenu.MenuItems.AddLabelItem("MyHelp"); helpItem.SetSystemShortcut(SystemShortcut.Help); window.Menu = windowMenu; if (window.MacOsOptions != null) { window.MacOsOptions.Appearance = MacOsAppearance.DarkAqua; } SetDevSettings(window); // the port number is defined in the angular.json file (under "architect"->"serve"->"options"->"port") // note that you have to run the angular dev server first (npm run watch) Application.UriWatcher = new AngularDevUriWatcher("http://localhost:65400"); Application.ContentProvider = new EmbeddedContentProvider("Angular/dist"); Application.Run(window, "/index.html"); } }
protected static void Run() { var icon = AppIcon.FromFile("icon", "."); using (var statusIcon = new StatusIcon()) using (var window = new Window()) { window.Title = "SpiderEye Playground"; window.UseBrowserTitle = true; window.EnableScriptInterface = true; window.CanResize = true; window.BackgroundColor = "#303030"; window.Size = new Size(800, 600); window.MinSize = new Size(300, 200); window.MaxSize = new Size(1200, 900); window.Icon = icon; statusIcon.Icon = icon; statusIcon.Title = window.Title; SetDevSettings(window); var menu = new Menu(); var showItem = menu.MenuItems.AddLabelItem("Hello World"); showItem.SetShortcut(ModifierKey.Primary, Key.O); showItem.Click += ShowItem_Click; var eventItem = menu.MenuItems.AddLabelItem("Send Event to Webview"); eventItem.SetShortcut(ModifierKey.Primary, Key.E); eventItem.Click += async(s, e) => await window.Bridge.InvokeAsync("dateUpdated", DateTime.Now); var subMenuItem = menu.MenuItems.AddLabelItem("Open me!"); subMenuItem.MenuItems.AddLabelItem("Boo!"); var borderItem = menu.MenuItems.AddLabelItem("Window Border"); var def = borderItem.MenuItems.AddLabelItem("Default"); def.Click += (s, e) => { window.BorderStyle = WindowBorderStyle.Default; }; var none = borderItem.MenuItems.AddLabelItem("None"); none.Click += (s, e) => { window.BorderStyle = WindowBorderStyle.None; }; var sizeItem = menu.MenuItems.AddLabelItem("Window Size"); var max = sizeItem.MenuItems.AddLabelItem("Maximize"); max.Click += (s, e) => { window.Maximize(); }; var unmax = sizeItem.MenuItems.AddLabelItem("Unmaximize"); unmax.Click += (s, e) => { window.Unmaximize(); }; var min = sizeItem.MenuItems.AddLabelItem("Minimize"); min.Click += (s, e) => { window.Minimize(); }; var unmin = sizeItem.MenuItems.AddLabelItem("Unminimize"); unmin.Click += (s, e) => { window.Unminimize(); }; var full = sizeItem.MenuItems.AddLabelItem("Enter Fullscreen"); full.Click += (s, e) => { window.EnterFullscreen(); }; var unfull = sizeItem.MenuItems.AddLabelItem("Exit Fullscreen"); unfull.SetShortcut(ModifierKey.Primary, Key.F11); unfull.Click += (s, e) => { window.ExitFullscreen(); }; menu.MenuItems.AddSeparatorItem(); var exitItem = menu.MenuItems.AddLabelItem("Exit"); exitItem.Click += (s, e) => Application.Exit(); statusIcon.Menu = menu; var bridge = new UiBridge(); Application.AddGlobalHandler(bridge); // the port number is defined in the angular.json file (under "architect"->"serve"->"options"->"port") // note that you have to run the angular dev server first (npm run watch) Application.UriWatcher = new AngularDevUriWatcher("http://localhost:65400"); Application.ContentProvider = new EmbeddedContentProvider("Angular/dist"); Application.Run(window, "/index.html"); } }