Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    RoboZoom
    @RoboZoom
    I had the same issue as @zenith6495 above
    zenith6495
    @zenith6495

    i do implemented this code to clear cache whenever the app launch. But the problem remains...
    await browserWindow.WebContents.Session.ClearCacheAsync();

    @RoboZoom the workaround I use currently is to add browserWindow.reload(); at the startup code, so whenever the apps start it will trigger reload same as CTRL + R to refresh the UI to the new state. However, do note that it will have some weird flashing animation due to the refresh at startup

    i don't know if this is the best practice, can someone please clarity @GregorBiswanger
    RoboZoom
    @RoboZoom
    Yeah, obviously the reload option is an undesired alternative - I want a desktop app that actually looks and feels like a desktop app.
    Out of curiosity, what is the name of the file you're having cacheing problems with? For me, it was "main.css" - when I renamed the css file, the problem seemed to go away.
    zenith6495
    @zenith6495
    @RoboZoom may I know which main.css do you refer to? And what do you rename your file to? For my case, I'm developing .Net Core React app with Electron, there is a 'main.b1409315.css' file in the ClientApp/build/static/css, is this the file you meant?
    RoboZoom
    @RoboZoom
    @zenith6495 - My app is a .Net Core MVC app with twitter bootstrap. I was doing some customization to the sass file, rerunning the sass (which takes main.scss and transforms it into main.css) in the ClientApp/wwwroot/css directory. When I ran the transform, manually copied the main.css file contents into a second css file "second.css", saved it, with all of my site references changed from "main.css" to "second.css", the updates worked without needing to clear the cache. Also, to be clear, I didn't experience any problem changing any of my view files and the updates not propagating. I just had a css caching issue
    Maher Jendoubi
    @MaherJendoubi
    Hi all
    I get the following warning

    [2019-12-14T11:18:17.230Z] Information: Normalizing '_blazor' to 'http://localhost:8001/_blazor'.
    security-warnings.ts:179 Electron Security Warning (Insecure Content-Security-Policy) This renderer process has either no Content Security
    Policy set or a policy with "unsafe-eval" enabled. This exposes users of
    this app to unnecessary security risks.

    For more information and help, consult
    https://electronjs.org/docs/tutorial/security.
    This warning will not show up
    once the app is packaged.
    blazor.server.js:1 [2019-12-14T11:18:17.581Z] Information: WebSocket connected to ws://localhost:8001/_blazor?id=zaSWY6huEaWtC9V9EnEJxg.

    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");
                });
                Electron.WindowManager.CreateWindowAsync();
            }
    <Project Sdk="Microsoft.NET.Sdk.Web">
      <PropertyGroup>
        <TargetFramework>netcoreapp3.1</TargetFramework>
      </PropertyGroup>
      <ItemGroup>
        <Content Update="electron.manifest.json">
          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>
      </ItemGroup>
      <ItemGroup>
        <PackageReference Include="ElectronNET.API" Version="7.30.2" />
      </ItemGroup>
    </Project>
    Hari Lubovac
    @hlubovac
    Hello. I am to this particular concept. I am trying to find documentation/guides to get started. Can I get some help, please? 😀
    * I am new this ...
    Cryphic
    @Cryphic
    Is there a way to disable WebSecurity the old way doesnt seem to work right.
    Chris
    @tryhardniinja_twitter
    Hi there! I have a question regarding the AutoUpdater api as I'm a bit lost on the implementation due to the lack of documentation. Has anyone ever tried to implement this? Thanks!
    elmamdzc
    @elmamdzc
    Hi everyone :) I have started learning Blazor recently and I need to package my Blazor app using Electron.NET, but for some reason it won't work. electron.manifest.json is not created when I run a command "electronize init". Does anybody know where can be a problem? Thank you!
    Kevin J. Petersen
    @kevinjpetersen
    Any documentation for Electron.NET? Trying to change the Icon for the application but it doesn't show it, but it just shows the default one
    Yevheniy Tymchishin
    @Tum4ik
    @kevinjpetersen which icon do you mean? The window icon?
    Yevheniy Tymchishin
    @Tum4ik
    @kevinjpetersen if yes, then:
    1. Create correct path for your icon file
      var iconPath = Path.Combine(_env.ContentRootPath, "relative/path/to/your-icon.png");
    2. Create BrowserWindowOptions
      Options = new BrowserWindowOptions
       {
           MinWidth = MinWidth,
           MinHeight = MinHeight,
           Icon = iconPath,  // <-- here is your icon path
           Fullscreenable = false,
           Center = false,
           Show = false
       };
    3. Pass Options when create your window
      var electronWindow = await Electron.WindowManager.CreateWindowAsync(Options, YourUri);
    Kevin J. Petersen
    @kevinjpetersen
    @Tum4ik Thanks! It worked ^_^
    KristiforMilchev
    @KristiforMilchev
    Guys after the new update of Electron.net i started to experience some weird behaviors with the ipc requests. Whenever i reload the page the requests get duplicated for example if i send const reply = ipcRenderer.send("async-AddCategory", JSON.stringify(dto)); and return to the page to add another category later instead of calling AddCategory once it will call it twice and it increases the count with each page refresh.
    Yevheniy Tymchishin
    @Tum4ik
    @KristiforMilchev I suggest to use Blazor - it is the future. In this case you can avoid IPC and/or AJAX calls and you will still have the SPA application.
    maverick101101
    @maverick101101
    hello everyone, i am working on a desktop application using electron, and i am not able find a decent solution for creating receipt i have tried pdfmake,pdfkit and webcontents.print and webContents.printTopdf() but i am not able to get custom pdf size.
    Cristian Giagante
    @cristiangiagante
    hi
    the only documentation resides in the demo app?
    Cristian Giagante
    @cristiangiagante
    hi
    chilipepperhott
    @chilipepperhott
    Ok, so I am using the latest release of ElectronNET and I cannot seem to be able to open a window.I have followed the instructions on the readme, but I cannot seem to find any demos that work with the latest version. Does anyone have any insights?
    Help would be greatly appreciated
    RoboZoom
    @RoboZoom
    Do you have NodeIntegration set to true? Like this:
    let newWindow = new BrowserWindow({
        width: 500,
        height: 300,
        show: false,
        webPreferences: {
          nodeIntegration: true
        }
      });
    chilipepperhott
    @chilipepperhott
    The code sample you sent seems to be in f#. There does seem to be a BrowserWindowOptions datatype or any way to set it. Additionally I cannot get the demo to open a window. I am on linux. Could there be something wrong with my system?
    chilipepperhott
    @chilipepperhott
    I don't suppose there is a project template somewhere? Thank you all for any help. I am sorry to fill this thread
    RoboZoom
    @RoboZoom
    Sorry - that is in javascript in native electron
    RoboZoom
    @RoboZoom
    Try this:
    public class Startup
        {
            public Startup(IConfiguration configuration)
            {
                Configuration = configuration;
            }
    
            public IConfiguration Configuration { get; }
    
            // This method gets called by the runtime. Use this method to add services to the container.
            public void ConfigureServices(IServiceCollection services)
            {
                services.AddSession();
                services.AddControllersWithViews();
            }
    
            // 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.UseSession();
                app.UseHttpsRedirection();
                app.UseStaticFiles();
    
                app.UseRouting();
    
                app.UseAuthorization();
    
                app.UseEndpoints(endpoints =>
                {
                    endpoints.MapControllerRoute(
                        name: "default",
                        pattern: "{controller=Home}/{action=Index}/{id?}");
                });
    
                BootStrap();
            }
    
            public async void BootStrap()
            {
                var options = new ElectronNET.API.Entities.BrowserWindowOptions()
                {
                    Show = true, 
                    Frame = false,
                    Height = 1200,
                    Width = 1400
    
    
                };
                //ElectronNET.API.BrowserWindow win = new BrowserWindow(options,options);
    
                //Task.Run(async () => await Electron.WindowManager.CreateWindowAsync(options));
                BrowserWindow browserWindow = await Electron.WindowManager.CreateWindowAsync(
                    options, "");
    
                browserWindow.LoadURL($"http://localhost:{BridgeSettings.WebPort}");
            }
        }
    I'll also add that I eventually abandoned Electron.Net because it was too buggy, and went to traditional electron
    chilipepperhott
    @chilipepperhott
    I we
    I figured it out. Thanks for the help. I am very new to this whole thing and have never worked with JavaScript.
    Erdeniz Korkmaz
    @erdenizkorkmaz
    Hello guys are there any chance to change default address of electron. It uses https://localhost:8000 by default but I want to change it to https://localhost.appNameHere:27101
    chilipepperhott
    @chilipepperhott
    Hi, I hope I am not being too much of a bother, but I was wondering if there was a clean way of exiting the application?
    chilipepperhott
    @chilipepperhott
    specifically in blazor
    Yevheniy Tymchishin
    @Tum4ik
    @chilipepperhott I use Electron.App.Quit()
    chilipepperhott
    @chilipepperhott
    Ok, interesting. I will try that when I get to my computer.
    HandLoong Deng
    @handloong
    hi. How do I package electronNet Application into an exe and send it to others
    tks. i find commond: electronize build /target win
    chilipepperhott
    @chilipepperhott
    I have a few additional questions regarding blazor and ElectronNET, in case anyone has any answers. Is there a way to open a new window with a specific razor document? How can I achieve communication to the main process?
    Yevheniy Tymchishin
    @Tum4ik
    @chilipepperhott yes, there is a way to open a new window with a specific razor document
    . .
    @JestDotty_gitlab
    I'm noticing electron uses package.json's main attribute for its entry point. Is there another attribute name or some CLI property I can use to change this? For example, I want electron's entry point to be a file called electron.js. Furthermore this feature wasn't documented anywhere and I've been having build issues for hours because of it but regardless
    Deniz İrgin
    @Blind-Striker

    Hi,

    I have just released a new version of Cake.Electron.Net. It's updated according to new CLI changes on Electron.NET v7.30.2

    https://www.nuget.org/packages/Cake.Electron.Net/1.1.0