Premium

The UWP Notepad Project (Redux): Auto Save (Premium)

Avatar

Today, we’ll implement .NETpad’s Auto Save functionality, which will work nearly identically to the way we did it previously in Windows Presentation Foundation (WPF).

To get started, we need to add a DispatchTimer to our project using code. (You may recall that in Windows Forms, we could drag a Timer object in from the toolbox, but with UWP and WPF, we need to do this manually.)  So open up MainPage.xaml.cs and scroll up to the top and locate the MainPage class definition. There, you will find a variety of what I call global variables, broken into groups like “For font settings,” “For other (non-font) settings” and so on. Below the last group (“For Find and Replace”) open up some space and add the following code:

Gain unlimited access to Premium articles.

With technology shaping our everyday lives, how could we not dig deeper?

Thurrott Premium delivers an honest and thorough perspective about the technologies we use and rely on everyday. Discover deeper content as a Premium member.

Become a Premium Member Create a Free Account