by Dan Duda
Requirements
- HTML and CSS Experience
- C# Experience
- Visual Studio 2017 Community
Introduction
In the age of smart phones and online calendars I find I still like to also have a paper calendar at my desk. Having a single page per month gives a lot of space to jot down notes and quickly glance at upcoming appointments, etc. Over the years I have come across downloadable year calendars in PDF format that you can print out and staple together. But I wanted more control to add my own recurring “special” dates and holidays. I also wanted to be able to include colorful icons with my events.
My first concern was how to render the calendar. I wanted to keep it simple so I decided to use just plain HTML and tables with CSS to style them. This will also enable the use of the web browser for printing and PDF conversion without having to write anything myself. There were some things I learned along the way that I hope may help someone else. One in particular was the use of media queries to override the browsers default print themes. Another was discovering the FontAwesome library for icons.
Project Setup
For this project I decided to create a console application in C# and the .Net framework. I’ll be using Visual Studio 2017 Comminity Edition. The first step is to create a “C# console application”. I’m using .net framework version 4.7.
By default Visual Studio gives us a single class file for console applications called Program.cs with a single method called Main. I didn’t feel I really needed a GUI for this and wanted to keep it simple so chose the console application approach which means it will run on the command line. The program should take a single command line paramter for the year to generate. We’ll check that the input is a valid number and then also check that it’s a pratical year. Yes, I’m pretty optimistic putting in 2400 as an end year. :)