Posts

Showing posts from October, 2020

WPF: Show publish version in the app

Image
--- --- WPF: Show the publish version in the app MainWindow.xaml <TextBlock Name="version_lbl"/> Add a reference to System.Deployment.dll MainWindow.xaml.cs using System . Deployment . Application ; . . . public MainWindow ( ) { InitializeComponent ( ) ; if ( ApplicationDeployment . IsNetworkDeployed ) { var _version = ApplicationDeployment . CurrentDeployment . CurrentVersion ; string v = $ "{_version.Major}.{_version.Minor}.{_version.Build}.{_version.Revision}" ; version_lbl . Text = v ; } } Publish and install the app

How to install Font-Awesome in Angular

How to install Font-Awesome in Angular Angular CLI: How to add Font-Awesome Works in: Angular CLI: 10.1.1 Node: 10.15.3 Angular: 10.1.1 Font-Awesome 5 Steps Install Font-Awesome into your app npm install --save @fortawesome/fontawesome-free Open app.module.ts and import the module import '@fortawesome/fontawesome-free/js/all.js' ; Add some icons < i class = " fas fa-user-shield " > </ i > Rebuild and run the app Done References Install Font Awesome 5 with NPM

Angular + ASPNET WebAPI + Windows Authentication + CORS + JWT

Image
--- --- How to: Angular + ASPNET WebAPI + Windows Authentication + CORS + JWT Scenario We need an intranet web app that allows the user to login automatically with windows authentication, but also it is required to be able to logout from the app and login manually with a different username and password. Client and Server are in different locations (domains) For this we need: ASPNet WebAPI service with Windows Auth Anonynous Auth JWT support CORS support Basic Angular app Environment Visual Studio 2015 .NetFramework 4.8 Angular CLI 10.1.3 Node 10.15.3 Windows 10 Requirements Read https://jwt.io/introduction/ Read https://stackoverflow.com/a/40284152/3596441 Steps AspNet WebAPI Service Create the WebAPI with windows authentication enabled Enable CORS Configure it, so it returns JSON instead of XML Enable Anonymous Authentication Install JWT support install-package System.IdentityModel.Tokens.Jwt Create a folder named JWT and inside add ...

Add Cordova and Electron to an Angular App

Image
--- --- Add Cordova and Electron to an Angular App Run your angular app as a web, Windows, Android or Linux app, and and if you have the means, in an Iphone or a Mac. Here I’m just covering the browser, Windows and Android. You can find this code in Github . Works in Windows 10 Node js 12.13 Angular CLI 10.1.1 Cordova 10 Android Studio Create the Angular App Create an Angular app by running this command in the terminal ng new angular-app Run in the browser Run ng serve Open http://localhost:4200 in your favorite browser Install Electron in the Angular App To install electron in angular-app run npm install --save-dev electron Inside angular-app create a file and name it main.js Copy the code the from the first app tutorial in the Electron web site and paste it in main.js const { app , BrowserWindow } = require ( 'electron' ) function createWindow ( ) { // Create the browser window. const win = new BrowserWindow ( { width : ...

Connect Angular with WebAPI

Image
--- --- Connect Angular with Web API In this exercise we’re creating a DotNet Web API service that uses Entity Framework to connect to a MS SQL Server instance to get some data, we’re also creating an Angular app to display data from this service, in the process we’re including an Http interceptor to fix the server’s url for every request and adding some Http error handling. Requirements You have a version of Microsoft SQL Server engine available You should have some notion of how Entity Framework, Angular and Web API work Read Observables overview Read RxJS Library Read Observables in Angular Read Angular Http Guide Read Angular Routing & Navigation Works with Dot NET Framework 4.8 Microsoft Asp Net Web API 5.2.7 Entity Framework 6.4.4 Visual Studio 2019 Steps Web API project Create an ASP Net Web API project, and for this tutorial: Don’t enable Windows authentication Don’t enable HTTPS If asked, include MVC and Web API references Entity Framework ...