Posts

Showing posts with the label .NET Core

Reviewing WPF and MVVM

Image
 I've been working in WPF (Windows Presentation Foundation) a lot lately. WPF is a great way to build a Windows desktop application, it's been around for many years and is very mature compared to UWP (Universal Windows Platform) which is a similar tool for creating desktop applications. It's not the newest, shiniest tool but it is definitely a great tool to be aware of. A while back I built a simple WPF program that worked with a .NET function library that did very simple distance calculations, and I decided to review that before really getting into more advanced concepts. When the program runs, it looks like this:   It's nothing too fancy, but it will show travel time, rate of travel and distance traveled over time. It also allows an excel spreadsheet to be inputted and it will run many calculations and then update the spreadsheet. The layout here is primarily built using the XAML grid, a staple of any WPF application. The grid specifies how many rows and columns the g...

Blazor Edit Form and Validation

Image
      For a class project I'm working on in a secure coding class I wanted to find a way to safely validate form data as to not send malicious values to our API or our database. I was working out how to do this in Blazor, and found the handy EditForm component. It allows you to enter a type of model you'd like the form to build, and in that model we can specify if the form is required and what type of data is allowed in.       In this example we have a couple required fields and we don't allow any special characters into our fields. We also only allow a certain length of string as our input, and simple error messages are displayed when invalid data is passed. When proper or improper data is passed to our form, it looks like this: