The UWP Files: Unsyncable (Premium)

I had almost given up on the Universal Windows Platform (UWP) version of .NETpad multiple times because of ongoing difficulties with asynchronous operations. And then the answer came to me in a dream.

No, I’m not kidding.

Like many of you, I suspect, I’ve been sleeping poorly. And last night was particularly bad for no reason I can explain. But it was clear that I was going to need to take a nap today, and with Andrew canceling the already rescheduled recording of What the Tech, I suddenly had an extra two hours this afternoon. So I figured I’d work on the UWP version of .NETpad until I inevitably started drifting off.

I have restarted this project four times since the first version. Each iteration of the project doesn’t correspond exactly with the articles I’ve written about my experiences so far. But if you go back and look, you can see that I started with a version that used a traditional menu-based UI, similar to the original Notepad, which is, of course, a desktop application, and then evolved it to utilize a more modern interface that was better representative of UWP.

That took a lot of time, but I created a Settings pane that slides in from the right and custom Content Panel dialogs for the Save prompt and Find/Replace. Along the way, I also started building out the app’s other functionality, including the important file operations like Open, Save, and Save As.

And virtually all of these things triggered huge problems, all of them related to UWP’s requirement that any pop-up windows and all file operations occur asynchronously. I first wrote about this issue back in The UWP Files: Asyncing Feeling (Premium) last week, but this has been an issue for much longer than that.

I’ve researched this topic more than I care to admit, and I even reached out on Twitter recently in the vague hope that someone would understand the issue and provide some insight. But I was starting to give up, was starting to reconcile myself with the notion that this version of the app---which because of other limitations was already going to be somewhat of a subset of the WinForms and WPF versions of the app---would never be finished.

But I kept plugging away. In part because there was just too much code to wade through in the versions in which I had implemented the reading and savings of user settings, the display and function of the Settings pane, and much of the implementation of Find, Replace, and Replace All, plus a ton of smaller features, I decided to focus only on the problem areas for my fourth restart of this project. I built the basic structure of the app, implemented the simplest possible Save prompt (as a Content Dialog), and dug into file operations.

This version of the app has only three command bar buttons, for now: New, Open, and Save. It uses the two key global variables used to track changes in the app, TextHasChanged and DocumentName. And it has three key custom methods, DisplaySavePrompt, Save, and Sav...

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.

Tagged with

Share post

Please check our Community Guidelines before commenting

Windows Intelligence In Your Inbox

Sign up for our new free newsletter to get three time-saving tips each Friday

"*" indicates required fields

This field is for validation purposes and should be left unchanged.

Thurrott © 2024 Thurrott LLC