Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();
            app.UseStaticFiles();

            app.UseEndpoints(endpoints => {
                endpoints.MapRazorPages();
                endpoints.MapControllers();
            });

            Task.Run(async() => {
                var options = new BrowserWindowOptions()
                {
                    Height = 1080 / 2,
                    Width  = 1920 / 2,
                    Show   = false,
                    Title  = "testTitle",
                    Icon   = Environment.CurrentDirectory + @"\Resource\1.jpg"
                };
                var window            = await Electron.WindowManager.CreateWindowAsync(options);
                window.OnReadyToShow += () => window.Show();
            });
        }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            Task.Run(async() => {
                //Hide Window because its empty untill its ready to show
                var options = new BrowserWindowOptions
                {
                    Show = false
                };
                var browserWindow = await Electron.WindowManager.CreateWindowAsync(options);
                //Show Window if its ready to show
                browserWindow.OnReadyToShow += () => browserWindow.Show();
            });
        }
Exemplo n.º 3
0
        /// <summary>
        /// Bootstrap and set up electron environment.
        /// </summary>
        public async void BootstrapElectron()
        {
            var options = new BrowserWindowOptions
            {
                Frame           = true,
                Show            = false,
                AutoHideMenuBar = false,
            };

            // Open Electron window
            var mainWindow = await Electron.WindowManager.CreateWindowAsync(options);

            mainWindow.OnReadyToShow += () => mainWindow.Show();

            // Define menu of window
            var menu = new MenuItem[]
            {
                new MenuItem
                {
                    Label   = "File",
                    Submenu = new MenuItem[]
                    {
                        new MenuItem
                        {
                            Label = "Exit",
                            Click = () => { Electron.App.Exit(); }
                        }
                    }
                }
            };

            Electron.Menu.SetApplicationMenu(menu);
        }
Exemplo n.º 4
0
        public async void Bootstarp()
        {
            isElectron = true;
            BrowserWindowOptions options = new BrowserWindowOptions()
            {
                DarkTheme       = true,
                Center          = true,
                Show            = false, // SHOW WHEN LOADED
                BackgroundColor = "#111111",
                //Frame=false, // REMOVED THE BORDER
                Title    = "CloudStream 2",
                Vibrancy = Vibrancy.dark,
                //    Icon = Path.Combine(Directory.GetCurrentDirectory(), "icon.ico") //This will f**k linux
                //WebPreferences = new WebPreferences() { }
            };
            var window = await Electron.WindowManager.CreateWindowAsync(options);

#if !DEBUG
            window.RemoveMenu();
#endif

            // window.SetAppDetails(new AppDetailsOptions() { AppIconPath = })
            window.OnReadyToShow += () =>
            {
                window.Show();
            };

            window.SetMinimumSize(1030, 600);
        }
Exemplo n.º 5
0
        private void SetupElectron(IWebHostEnvironment env)
        {
            string icon = Path.Combine(Environment.CurrentDirectory, "./wwwroot/logo_square.png");

            if (Electron.Tray.MenuItems.Count == 0)
            {
                var menu = new MenuItem
                {
                    Label = "Exit",
                    Click = () => Electron.App.Exit()
                };

                Electron.Tray.Show(icon, menu);
                Electron.Tray.SetToolTip("FinanceAPI");
            }

            var options = new BrowserWindowOptions
            {
                Show = false
            };

            System.Threading.Tasks.Task.Run(async() => await Electron.WindowManager.CreateWindowAsync(options));

            if (env.IsDevelopment())
            {
                var startNotification = new NotificationOptions("Finance API", "FinanceAPI has started")
                {
                    Icon = icon
                };

                Electron.Notification.Show(startNotification);
            }
        }
Exemplo n.º 6
0
        private async void Bootstrap()
        {
            var options = new BrowserWindowOptions {
            };

            await Electron.WindowManager.CreateWindowAsync(options);
        }
Exemplo n.º 7
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            var option = new BrowserWindowOptions();

            option.Width          = 1400;
            option.WebPreferences = new WebPreferences {
                WebSecurity = false
            };

            // Open the Electron-Window here
            Task.Run(async() => await Electron.WindowManager.CreateWindowAsync(option));
        }
Exemplo n.º 8
0
        public static async void OpenMainWindow()
        {
            ShortcutsChanged += UpdateShortcuts;
            Commands          = await ShortcutGenerator.GetCurrentCommandListAsync();

            var options = new BrowserWindowOptions()
            {
                Show = false,
            };

            var mainWindow = await Electron.WindowManager.CreateWindowAsync(options);

            mainWindow.OnReadyToShow += () =>
            {
                mainWindow.Show();
                var openFiles = ApplicationState.Instance.FileHandlerInstance.GetOpenFilePaths();

                // If history is present, set the first file as selected. Otherwise open a new file and set it as selected.
                if (openFiles.Count > 0)
                {
                    MenuActions.SetCurrentFilePath(openFiles.First());
                }
                else
                {
                    ApplicationState.Instance.FileHandlerInstance.OpenFile("new.txt");
                    ApplicationState.Instance.FileHandlerInstance.GetFileBuffer("new.txt").FillBufferFromFile();
                    MenuActions.SetCurrentFilePath("new.txt");
                }
            };

            mainWindow.OnClosed += () => { Electron.App.Quit(); };

            SetMenu();
        }
Exemplo n.º 9
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapRazorPages();
            });
            var options = new BrowserWindowOptions {
                Width  = 1920,
                Height = 1080
            };

            Task.Run(async() => await Electron.WindowManager.CreateWindowAsync(options));
        }
Exemplo n.º 10
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();
            app.ApplicationServices
            .UseBootstrapProviders()
            .UseFontAwesomeIcons();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToPage("/_Host");
            });

            var options = new BrowserWindowOptions()
            {
                Title = "Kongo stakepool monitor"
            };

            Task.Run(async() => await Electron.WindowManager.CreateWindowAsync(options));
        }
Exemplo n.º 11
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToPage("/_Host");
            });

            // Open the Electron-Window here
            var windowOptions = new BrowserWindowOptions()
            {
                Width  = 1200,
                Height = 800
            };

            Task.Run(async() => await Electron.WindowManager.CreateWindowAsync(windowOptions));
        }
Exemplo n.º 12
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseDeveloperExceptionPage();

            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToPage("/_Host");
            });

            if (!env.IsDevelopment())
            {
                BrowserWindowOptions options = new BrowserWindowOptions
                {
                    BackgroundColor = "#121212",
                    Frame           = false,
                    Center          = true,
                    AutoHideMenuBar = true,
                    Icon            = $"{AppDomain.CurrentDomain.BaseDirectory}\\Assets\\icon.png",
                    Title           = "Wrath & Glory",
                };

                BrowserWindow window = Task.Run(async() => await Electron.WindowManager.CreateWindowAsync(options)).Result;
            }
        }
Exemplo n.º 13
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
            }

            app.UseStaticFiles();

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToPage("/_Host");
            });
            BrowserWindowOptions options = new BrowserWindowOptions();

            options.Width          = 1600;
            options.Height         = 1000;
            options.Fullscreenable = false;
            options.DarkTheme      = true;
            options.MinWidth       = 1000;
            options.MinHeight      = 800;
            options.Resizable      = false;
            Task.Run(async() => await Electron.WindowManager.CreateWindowAsync(options));
        }
Exemplo n.º 14
0
        public IActionResult Index()
        {
            string viewPath = $"http://localhost:{BridgeSettings.WebPort}/windows/demowindow";

            Electron.IpcMain.On("new-window", async(args) => {
                await Electron.WindowManager.CreateWindowAsync(viewPath);
            });

            Electron.IpcMain.On("manage-window", async(args) => {
                var browserWindow       = await Electron.WindowManager.CreateWindowAsync(viewPath);
                browserWindow.OnMove   += UpdateReply;
                browserWindow.OnResize += UpdateReply;
            });

            Electron.IpcMain.On("listen-to-window", async(args) => {
                var mainBrowserWindow = Electron.WindowManager.BrowserWindows.First();

                var browserWindow      = await Electron.WindowManager.CreateWindowAsync(viewPath);
                browserWindow.OnFocus += () => Electron.IpcMain.Send(mainBrowserWindow, "listen-to-window-focus");
                browserWindow.OnBlur  += () => Electron.IpcMain.Send(mainBrowserWindow, "listen-to-window-blur");

                Electron.IpcMain.On("listen-to-window-set-focus", (x) => browserWindow.Focus());
            });

            Electron.IpcMain.On("frameless-window", async(args) => {
                var options = new BrowserWindowOptions
                {
                    Frame = false
                };
                await Electron.WindowManager.CreateWindowAsync(options, viewPath);
            });

            return(View());
        }
Exemplo n.º 15
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
            }

            app.UseStaticFiles();

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToPage("/_Host");
            });

            // Open the Electron-Window here
            var windowOptions = new BrowserWindowOptions {
                Width = 1600, Height = 1200
            };

            Task.Run(async() => await Electron.WindowManager.CreateWindowAsync(windowOptions));

            // Config menu
            StartElectron();
        }
Exemplo n.º 16
0
        private void OpenNewWindow()
        {
            var options = new BrowserWindowOptions
            {
                Title           = "Angles Configurator",
                TitleBarStyle   = TitleBarStyle.customButtonsOnHover,
                DarkTheme       = true,
                AutoHideMenuBar = true
            };

            Task.Run(() =>
                     Electron.WindowManager.CreateWindowAsync(options, $"http://localhost:{PortNumber}/home/privacy"))
            .ContinueWith(task =>
            {
                var w = task.Result;
                w.SetMenu(new []
                {
                    new MenuItem()
                    {
                        Label = ""
                    }
                });
                w.SetMenuBarVisibility(false);
            });
        }
Exemplo n.º 17
0
        public async Task ElectronizeAsync()
        {
            var Options = new BrowserWindowOptions
            {
                DarkTheme       = true,
                AutoHideMenuBar = true,
            };

            await Electron.WindowManager.CreateWindowAsync(Options);
        }
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapRazorPages();
            });

            Task.Run(async() =>
            {
                if (await Electron.App.CommandLine.HasSwitchAsync("assembly-file") &&
                    await Electron.App.CommandLine.HasSwitchAsync("target-path"))
                {
                    var assemblyFilePath = await Electron.App.CommandLine.GetSwitchValueAsync("assembly-file");
                    var destinationPath  = await Electron.App.CommandLine.GetSwitchValueAsync("target-path");

                    var protoFileGenerator = new ProtoFileGenerator();
                    protoFileGenerator.SaveProtoFile(assemblyFilePath, destinationPath);

                    Console.WriteLine("Successfull generated!");
                    Electron.App.Exit();
                }
                else
                {
                    var browserWindowOptions = new BrowserWindowOptions
                    {
                        WebPreferences = new WebPreferences
                        {
                            WebSecurity = false
                        },
                        Show = false
                    };

                    var mainWindow            = await Electron.WindowManager.CreateWindowAsync(browserWindowOptions);
                    mainWindow.OnReadyToShow += () => mainWindow.Show();
                    mainWindow.SetMenuBarVisibility(false);
                }
            });
        }
Exemplo n.º 19
0
        public async Task <IActionResult> Open([FromBody] OpenWindowRequest request)
        {
            var options = new BrowserWindowOptions
            {
                Frame     = true,
                DarkTheme = true
            };
            await Electron.WindowManager.CreateWindowAsync(options, $"http://localhost:{BridgeSettings.WebPort}{request.Url}");

            return(Json(true));
        }
Exemplo n.º 20
0
 //this method is supposed to open up a window with electron
 public async void Bootstrap()
 {
     var options = new BrowserWindowOptions
     {
         WebPreferences = new WebPreferences
         {
             WebSecurity = false
         }
     };
     await Electron.WindowManager.CreateWindowAsync(options);
 }
Exemplo n.º 21
0
        async void BootStrap()
        {
            var option = new BrowserWindowOptions
            {
                Show  = false,
                Title = "bStudio Teaching Assistant",
            };
            var mainWindow = await Electron.WindowManager.CreateWindowAsync(option);

            mainWindow.OnReadyToShow += () => mainWindow.Show();
        }
Exemplo n.º 22
0
        public async void ElectronBootstrap()
        {
            try
            {
                if (await Electron.App.CommandLine.HasSwitchAsync("dog"))
                {
                    string value = await Electron.App.CommandLine.GetSwitchValueAsync("dog");

                    File.WriteAllText(@"c:\temp\args.txt", value);
                }
            }
            catch (Exception ex)
            {
                File.WriteAllText(@"c:\temp\error.txt", ex.ToString());
            }

            var options = new BrowserWindowOptions
            {
                Show  = false,
                Title = "BibleNote"
            };
            var mainWindow = await Electron.WindowManager.CreateWindowAsync(options, "http://localhost:8079/data-sources");

            mainWindow.OnReadyToShow += () =>
            {
                mainWindow.Show();
            };

            //MenuItem[] menu = new MenuItem[]
            //{
            //    new MenuItem
            //    {
            //        Label = "File",
            //        Submenu=new MenuItem[]
            //        {
            //            new MenuItem
            //            {
            //                Label ="Exit",
            //                Click =()=>{Electron.App.Exit();}
            //            }
            //        }
            //    },
            //    new MenuItem
            //    {
            //        Label = "Info",
            //        Click = async ()=>
            //        {
            //            await Electron.Dialog.ShowMessageBoxAsync("Welcome to App");
            //        }
            //    }
            //};

            //Electron.Menu.SetApplicationMenu(menu);
        }
Exemplo n.º 23
0
        public async void Bootstrap()
        {
            WebPreferences wp = new WebPreferences();

            wp.NodeIntegration = false;
            BrowserWindowOptions browserWindowOptions = new BrowserWindowOptions
            {
                WebPreferences = wp
            };
            await Electron.WindowManager.CreateWindowAsync(browserWindowOptions);
        }
Exemplo n.º 24
0
        public void ConfigureElectron()
        {
            var options = new BrowserWindowOptions
            {
                Title         = "MBox Configurator",
                TitleBarStyle = TitleBarStyle.customButtonsOnHover,
                DarkTheme     = true
            };

            Task.Run(async() => await Electron.WindowManager.CreateWindowAsync(options))
            .ContinueWith(res => BuildMenu(res.Result));
        }
Exemplo n.º 25
0
        public async void LaunchWithSettings()
        {
            var options = new BrowserWindowOptions
            {
                WebPreferences = new WebPreferences
                {
                    WebSecurity = false
                }
            };

            await Electron.WindowManager.CreateWindowAsync(options);
        }
Exemplo n.º 26
0
        private async Task ElectronBootstrapAsync()
        {
            BrowserWindowOptions options = new BrowserWindowOptions
            {
                Width  = 1366,
                Height = 768
            };

            BrowserWindow window = await Electron.WindowManager.CreateWindowAsync(options);

            window.SetMenuBarVisibility(false);
        }
Exemplo n.º 27
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            DatabaseManager.SqliteFilename = "asa.sqlite";
            DatabaseManager.Setup();
            Logger.Setup();
            Telemetry.Setup(Gui: true);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            WebPreferences wp = new WebPreferences();

            wp.NodeIntegration  = false;
            wp.ContextIsolation = true;

            BrowserWindowOptions browserWindowOptions = new BrowserWindowOptions
            {
#if DEBUG
                AutoHideMenuBar = false,
#else
                AutoHideMenuBar = true,
#endif
                Width          = 1200,
                Height         = 1000,
                Resizable      = true,
                Center         = true,
                Title          = string.Format("Attack Surface Analyzer {0}", Helpers.GetVersionString()),
                WebPreferences = wp
            };

            Task.Run(async() =>
            {
                await Electron.WindowManager.CreateWindowAsync(browserWindowOptions);
            });
        }
Exemplo n.º 28
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();

            // Begin I18N configuration
            var supportedCultures = new List <CultureInfo>
            {
                new CultureInfo("en"),
                new CultureInfo("es")
            };

            var options = new RequestLocalizationOptions
            {
                DefaultRequestCulture = new RequestCulture("en"),
                SupportedCultures     = supportedCultures,
                SupportedUICultures   = supportedCultures
            };

            app.UseRequestLocalization(options);
            // End I18N configuration

            app.UseStaticFiles();

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToPage("/_Host");
            });

            var opt = new BrowserWindowOptions
            {
                Icon            = @"resources\bin\pdfs\templates\favicon.ico",
                AutoHideMenuBar = true,
                Title           = "Tinta Red A Coruña - Coupon Control",
            };

            Task.Run(async() => await Electron.WindowManager.CreateWindowAsync(opt));
        }
Exemplo n.º 29
0
        private async Task <BrowserWindow> CreateElectronWindow()
        {
            var windowOptions = new BrowserWindowOptions
            {
                Fullscreenable  = true,
                TitleBarStyle   = TitleBarStyle.hidden,
                AutoHideMenuBar = true,
                Fullscreen      = true
            };
            var window = await Electron.WindowManager.CreateWindowAsync(windowOptions);

            return(window);
        }
Exemplo n.º 30
0
        async void BootStrap()
        {
            var option = new BrowserWindowOptions
            {
                Show   = false,
                Title  = "Youth Center",
                Height = 1366,
                Width  = 768
            };
            var mainWindow = await Electron.WindowManager.CreateWindowAsync(option);

            mainWindow.OnReadyToShow += () => mainWindow.Show();
        }