Comments for Peter Torr's Bloghttps://blogs.msdn.microsoft.com/ptorr
Posts about Windows [Phone] application development. And other stuff.Wed, 10 Dec 2014 16:46:22 +0000hourly1Comment on Async & exceptions in C# by Janez Lukanhttps://blogs.msdn.microsoft.com/ptorr/2014/12/10/async-exceptions-in-c/#comment-30061
Wed, 10 Dec 2014 16:46:22 +0000https://blogs.msdn.microsoft.com/ptorr/2014/12/10/async-exceptions-in-c/#comment-30061Although I agree with the written, I think we should point out that having async void somewhere in the middle of the code stack, is likely to cause trouble at some point. For example:

static void Main(string[] args)

{

var t = Task.Run(async () => await DoSomething());

if(t.Exception != null) Console.WriteLine(t.Exception.Message);

}

static async Task DoSomething()

{

await Task.Run(() =>_3_AsyncVoidAwaitWithTry());

}

Since _3_AsyncVoidAwaitWithTry is (returns) void, it could be quickly overseen as such. It is safe, and we can always handle whatever the results of the code by firing some events (for example), but is probably not very good practice to have async void like this.

I think async void is best used at the top of the code stack, for handling events and similar (as command execute handlers).

]]>Comment on New "Missing Platform APIs" UserVoice site for Windows Store development by Peter Torr - MSFThttps://blogs.msdn.microsoft.com/ptorr/2014/05/25/new-missing-platform-apis-uservoice-site-for-windows-store-development/#comment-30071
Tue, 24 Jun 2014 15:55:53 +0000https://blogs.msdn.microsoft.com/ptorr/2014/05/25/new-missing-platform-apis-uservoice-site-for-windows-store-development/#comment-30071Hi Dave, Windows provides BitLocker for securing files on disk and locking them to a particular machine / PIN / etc. If that's not an option (BitLocker isn't for everyone), you could also use EFS for protecting files. If that doesn't work either, there is an SDelete utility provided by Microsoft as a stand-alone tool (technet.microsoft.com/…/bb897443.aspx)
]]>Comment on New "Missing Platform APIs" UserVoice site for Windows Store development by Dave Sowershttps://blogs.msdn.microsoft.com/ptorr/2014/05/25/new-missing-platform-apis-uservoice-site-for-windows-store-development/#comment-30081
Tue, 24 Jun 2014 13:07:20 +0000https://blogs.msdn.microsoft.com/ptorr/2014/05/25/new-missing-platform-apis-uservoice-site-for-windows-store-development/#comment-30081Windows, all versions, needs a file eraser. Something to erase/shred a file by overwriting the bits on storage before removing the entry from the catalog. Today's criminals/governments are very sharp and simply flagging a file as deleted is no longer enough. I realize that erasing takes time and resources but this is something that the user would specifically request so waiting or passing it to a background process should be fine. We need this option to continue to use Windows in the future. People would choose Windows knowing that their data is safer than the competition. Also toss this one over the wall to the Azure team.
]]>Comment on Updated LayoutRules Code by ptorrhttps://blogs.msdn.microsoft.com/ptorr/2014/04/06/updated-layoutrules-code/#comment-30043
Mon, 05 May 2014 09:13:32 +0000https://blogs.msdn.microsoft.com/ptorr/2014/04/06/updated-layoutrules-code/#comment-30043Brian, thanks for posting and for sharing your solution as well. The LayoutRules code might be overkill for some scenarios where your DynamicStyle approach will work better. (My code started out like yours, but grew in complexity as I tried to do handle more and more layout cases declaratively).
]]>Comment on Updated LayoutRules Code by Brian Donovan-Smithhttps://blogs.msdn.microsoft.com/ptorr/2014/04/06/updated-layoutrules-code/#comment-30033
Sun, 04 May 2014 13:47:21 +0000https://blogs.msdn.microsoft.com/ptorr/2014/04/06/updated-layoutrules-code/#comment-30033Thanks for the 4 to 40 inches talk. It helped cement some approaches to cross platform software design and a better approach to responsive design apps.

I have taken a look at your sample app and LayoutRules api, but I found it quite verbose and not easy to read the intent from the xaml code.

Like many developers, I thought I would have a go myself and see if a different approach would suit my needs better.

After a few iterations, I have landed with an approach I have called DynamicStyle.

The basic premise of the library is to set the Style of a control, depending of the shape of the screen.

<TextBlock Text="Some Heading" dynamic:Dynamic.Style="Title"/>

When the app is run normally, the control has a Style of "Title", but when the app is snapped or run in a portrait layout, the Style is set to "Title.Tall", and when the screen is huge, the Style is set to "Title.XWide". The different style suffices can be user defined.

]]>Comment on Updated LayoutRules Code by ptorrhttps://blogs.msdn.microsoft.com/ptorr/2014/04/06/updated-layoutrules-code/#comment-30023
Tue, 22 Apr 2014 13:20:59 +0000https://blogs.msdn.microsoft.com/ptorr/2014/04/06/updated-layoutrules-code/#comment-30023Bob, it sounds like you would be better off using the WidthUpdatePropertyRule and then have your items data-bind to the value being updated. This is how the "ribbon buttons" in the sample app get larger or smaller, but you would use it for Visibility instead.
]]>Comment on Updated LayoutRules Code by Bobhttps://blogs.msdn.microsoft.com/ptorr/2014/04/06/updated-layoutrules-code/#comment-30013
Tue, 22 Apr 2014 12:28:11 +0000https://blogs.msdn.microsoft.com/ptorr/2014/04/06/updated-layoutrules-code/#comment-30013Thanks Peter – another quick question for you: I want to change (hide/show) a control on a Hub page (flip from a Gridview to a Listview when width < x). I am guessing this isn't possible via the WidthGoToVisualStateRule as the target controls are inside a DataTemplate and therefore not accessible. So I decided to refactor the two controls into a user control. Unfortunately, the control width always computes as Infinity (I assume since it can scroll right and there is no width set on the HubSection). I would prefer to do this at the page level (reach into the DataTemplate) but both scenarios are probably valid. Any suggestions or hints?

Thanks,

Bob

]]>Comment on Updated LayoutRules Code by ptorrhttps://blogs.msdn.microsoft.com/ptorr/2014/04/06/updated-layoutrules-code/#comment-30003
Thu, 17 Apr 2014 17:45:40 +0000https://blogs.msdn.microsoft.com/ptorr/2014/04/06/updated-layoutrules-code/#comment-30003Bob, I'm working on cleaning it up and getting it posted along with an official blog sometime soon… probably means next week or two. Thanks for asking!
]]>Comment on Updated LayoutRules Code by Bobhttps://blogs.msdn.microsoft.com/ptorr/2014/04/06/updated-layoutrules-code/#comment-29993
Mon, 14 Apr 2014 07:10:52 +0000https://blogs.msdn.microsoft.com/ptorr/2014/04/06/updated-layoutrules-code/#comment-29993Hey Peter, thank you very much – great talk – it should be required viewing for all Store/Phone app developers! Is there any chance you could share your tic-tac-toe example to show more detail on how the visual states are implemented and the bits are used in a more realistic example?

Thanks again,

Bob

]]>Comment on Updated LayoutRules Code by ptorrhttps://blogs.msdn.microsoft.com/ptorr/2014/04/06/updated-layoutrules-code/#comment-29983
Tue, 08 Apr 2014 10:20:39 +0000https://blogs.msdn.microsoft.com/ptorr/2014/04/06/updated-layoutrules-code/#comment-29983Thanks Jerome. I spoke to some folks here and the answer is that the "Phone" developer blog was merged with the "Windows" developer blog, so now there is just one: the "Building Apps for Windows" blog listed on that summary page. The old links to the Phone blog still work, but there is no link from the main page any more. I understand this is in a state of flux right now, but rest assured the content is still there and being added to on a regular basis. It's just missing the word "Phone" in the title due to the just-announced "Universal Apps" approach we're taking moving forwards.
]]>