In this post we’ll take a look at installing ASP.NET core and Visual Studio code on Linux Mint.
1. Installing .NET CORE
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
2. Install Visual Studio Code
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:
3. Install the C# Extension
Click on the extensions icon to the left and search for
C#. Then click install.
4. Creating an ASP.NET Core Project
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.
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.
Adding more info to the message box
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:
typedisplays different icons in the messagebox.
buttonsis an array of strings that will be displayed as buttons.
defaultIdsets which of the buttons should be selected when opening the box.
titledisplays a title on some platforms.
messagedisplays a message.
detaildisplays more text below the message.
checkboxLabelthe box can display a checkbox as well. this is the label for it.
checkboxCheckedthe 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:
- Call it on the main process.
- Require dialog.
- Call showErrorBox() with a title and a message.
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.