The Electron tutorial app is now working with Electron version 5.0.8. After downloading the new version make sure to run:
The biggest difference in this version is enabling nodeIntegration:
You can see the code on Github
I write about software, app and web development.
The Electron tutorial app is now working with Electron version 5.0.8. After downloading the new version make sure to run:
The biggest difference in this version is enabling nodeIntegration:
You can see the code on Github
In this post we’ll take a look at installing ASP.NET core and Visual Studio code on Linux Mint.
To install .NET Core I downloaded the X64 Binary and ran these commands in a console:
After that to verify the installation you can type dotnet
:
Go to https://code.visualstudio.com/ and select the .deb package for installation.
After installing the package Visual Studio code will show up in the menu:
Click on the extensions icon to the left and search for C#
. Then click install.
Now its time to create an ASP.NET MVC project from the terminal. These commands are copied from the Microsoft documentation
This creates a new mvc project in a folder called MvcMovie.
We can use the command line to open the newly created project in VS Code:
And to run the application run:
In this tutorial we’ll look at how to use Electron showSaveDialog. The save dialog will return a string containing a path which the user selected.
To only display a save dialog this is what is needed as a minimum:
But as with the other dialogs we can do more with it:
The code above proposes a path and a filename to the user when opening the save dialog with defaultPath
. It uses app.getPath to get the path to our users document folder and then appends a filename.pdf
I’ve also changed so that the callback method is used which gives us the path. I’d recommend to look at the showSaveDialog documentation to see what more options you can use.
This code is added to Electron tutorial app and you can take a look at the dialog.js file to see this code.
In the next tutorial we’ll continue from here and save the pdf. But that post is coming soon.
With showMessageBox we can display a message with our without a set of buttons from which the user can choose from.
The minimum required code to show a message box is:
But that would only display a box with no info and an OK-button. The dialog would return a response which contains the index of the button the user clicked.
Lets add more info the the box, A question and two buttons and use the callback method as well.
The code above would produce a message box looking like this:
type
displays different icons in the messagebox.buttons
is an array of strings that will be displayed as buttons.defaultId
sets which of the buttons should be selected when opening the box.title
displays a title on some platforms.message
displays a message.detail
displays more text below the message.checkboxLabel
the box can display a checkbox as well. this is the label for it.checkboxChecked
the initial value of the checkbox.Checkout the dialog documentation to get more info and what values you can set for the different settings.
This code example is added to the electron tutorial app dialog on github.
Use the Electron dialog showErrorBox to display an error message to the user. Not much to it:
This is what the message will look like on macOS in Electorn tutorial app:
The file is called dialog.js in the github repo if you want to look at the code.