<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Synergist</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/synergist/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/synergist/feed.xml</link>
    <description>Combining Software in Amazing Ways</description>
    <lastBuildDate>Tue, 16 Apr 2019 05:31:07 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Using the InkToolbar with Custom Dry Ink in Windows Anniversary Edition</title>
      <link>https://docs.microsoft.com/archive/blogs/synergist/using-the-inktoolbar-with-custom-dry-ink-in-windows-anniversary-edition</link>
      <pubDate>Fri, 26 Aug 2016 18:01:45 GMT</pubDate>
      <dc:creator><![CDATA[Synergist]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/synergist/?p=3785</guid>
      <description><![CDATA[I have been experimenting with the new InkToolbar control in the new Windows Anniversary Update and...]]></description>
      <content:encoded><![CDATA[<p><font size="4">I have been experimenting with the new <a href="https://blogs.windows.com/buildingapps/2016/08/04/the-ink-canvas-and-ruler-combining-art-and-technology/">InkToolbar control</a> in the new Windows Anniversary Update and wanted to walk through a common scenario for using the InkToolbar with “Custom Dry Ink”.&nbsp; The InkToolbar was designed to work with an InkCanvas control that manages its own ink data.&nbsp; It is so easy to use – and the functionality that you get with it is great: pens, pencils, highlighters, erasers and a ruler.&nbsp; In two lines of Xaml with no code behind, you have the beginning of a very powerful drawing app.&nbsp; You can see this in use with the new Sketchpad in the Ink Workspace that is now part of Windows 10 Anniversary Update.&nbsp;&nbsp;&nbsp; </font></p> <blockquote> <p><font size="4">&lt;InkCanvas x:Name=”InkCanvas”/&gt;</font></p> <p><font size="4">&lt;InkToolbar TargetInkCanvas=”{x:Bind InkCanvas}”/&gt;</font></p></blockquote> <p><font size="4">In more sophisticated scenarios, app developers will want to draw their own ink.&nbsp; Those types of scenarios include:</font></p> <ul> <li><font size="4">Interleave visual elements with ink</font></li> <li><font size="4">Applying effects to ink using toolkits like <a href="https://github.com/Microsoft/Win2D" target="_blank">Win2D</a></font></li> <li><font size="4">Sketching applications that will likely have lots of ink strokes</font></li> <li><font size="4">Large canvas apps that can scroll and zoom</font></li></ul> <p><font size="4">Once an app developer decides to manage their own ink in the InkCanvas, they need write code for a few things:</font></p> <ul> <li><font size="4">Storing ink once the user completes a stroke</font>  <li><font size="4">Drawing ink</font>  <li><font size="4">Erasing ink (including erasing all ink on the canvas)</font></li></ul> <p><font size="4">I wrote a sample that demonstrates how to do each of these tasks.</font></p> <h1>Storing Ink</h1> <p><font size="4">Windows Ink Platform (DirectInk) has two different types of ink, “wet ink” and “dry ink”.&nbsp; The engineers on the Windows team did lots of work to make ink flow from the pen with as little latency as possible, even predictively rendering where the ink is going to go.&nbsp; </font></p> <p><font size="4"></font>&nbsp;</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/08/image744.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/08/image_thumb574.png" width="1783" height="1018"></a></p> <p><font size="4">The InkCanvas Control in Xaml processes input and routes rendering to the InkPresenter which renders “wet ink” in its own high-priority thread.&nbsp; Once the pen is lifted from the screen, that is then rendered by the InkCanvas’s “dry ink” renderer.&nbsp; App developers can hook into this event by activating custom drying and then waiting for strokes to be collected:</font></p> <blockquote> <p><font size="4">private void MainPage_Loaded(object sender, RoutedEventArgs e)</font></p> <p><font size="4">{</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp; var inkPresenter = InkCanvas.InkPresenter;</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp; _inkSynchronizer = inkPresenter.ActivateCustomDrying();</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp; inkPresenter.StrokesCollected += InkPresenter_StrokesCollected;</font></p> <p>}</p></blockquote> <p><font size="4">Then each time the user draws on the screen, the StrokesCollected event is triggered, use the Ink Synchronizer to get the strokes to add and add them to the your app’s storage – in this case, _strokes is a List&lt;InkStrokeContainer&gt;.&nbsp; Once that is done, the Ink Synchronizer is used to tell the InkCanvas that it can remove the wet strokes, and then the DrawingCanvas is invalidated – the DrawingCanvas is the Win2d CanvasControl where the dry ink will get rendered.</font></p> <blockquote> <p><font size="4">private void InkPresenter_StrokesCollected(InkPresenter sender, InkStrokesCollectedEventArgs args)<br>{<br>&nbsp;&nbsp;&nbsp; var strokes = _inkSynchronizer.BeginDry();</font></p> <p><font size="4"></font>&nbsp;</p> <p><font size="4">&nbsp;&nbsp;&nbsp; var container = new InkStrokeContainer();</font></p> <p><font size="4"></font>&nbsp;</p> <p><font size="4">&nbsp;&nbsp;&nbsp; container.AddStrokes(from item in strokes<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select item.Clone());</font></p> <p><font size="4"></font>&nbsp;</p> <p><font size="4">&nbsp;&nbsp;&nbsp; _strokes.Add(container);</font></p> <p><font size="4"></font>&nbsp;</p> <p><font size="4">&nbsp;&nbsp;&nbsp; _inkSynchronizer.EndDry();</font></p> <p><font size="4"></font>&nbsp;</p> <p><font size="4">&nbsp;&nbsp;&nbsp; DrawingCanvas.Invalidate();<br>}</font></p> <h1>Drawing Dry Ink with Win2D</h1></blockquote> <p><font size="4">On Windows, if you want to draw 2D graphics with the fastest, most powerful API, you will want to use Direct2D, a COM-based API that is used under the hood for most graphics on Windows but is a bit hard to use, especially for C# developers.&nbsp; To remedy that, Microsoft created <a href="http://microsoft.github.io/Win2D/html/Introduction.htm">Win2D</a> as a UWP class-oriented wrapper for Direct2D that is meant to work great in Xaml-based apps.&nbsp; Win2d has a very easy to use API for drawing Ink that makes it a great match for custom dry ink: <a href="http://microsoft.github.io/Win2D/html/Overload_Microsoft_Graphics_Canvas_CanvasDrawingSession_DrawInk.htm">CanvasDrawingSession.DrawInk()</a>.&nbsp; Add the Win2D.UWP package to the app project and then you can add the Win2D CanvasControl to the Xaml behind the InkCanvas:</font></p> <blockquote> <p><font size="2" face="Courier New">&lt;Page<br>&nbsp;&nbsp;&nbsp; x:Class="InkToolbarTest.MainPage"<br>&nbsp;&nbsp;&nbsp; xmlns="</font><a href="http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;"><font size="2" face="Courier New">http://schemas.microsoft.com/winfx/2006/xaml/presentation"</font></a><br><font size="2" face="Courier New">&nbsp;&nbsp;&nbsp; xmlns:x="</font><a href="http://schemas.microsoft.com/winfx/2006/xaml&quot;"><font size="2" face="Courier New">http://schemas.microsoft.com/winfx/2006/xaml"</font></a><br><font size="2" face="Courier New">&nbsp;&nbsp;&nbsp; xmlns:canvas="using:Microsoft.Graphics.Canvas.UI.Xaml"<br>&nbsp;&nbsp;&nbsp; xmlns:d="</font><a href="http://schemas.microsoft.com/expression/blend/2008&quot;"><font size="2" face="Courier New">http://schemas.microsoft.com/expression/blend/2008"</font></a><br><font size="2" face="Courier New">&nbsp;&nbsp;&nbsp; xmlns:mc="</font><a href="http://schemas.openxmlformats.org/markup-compatibility/2006&quot;"><font size="2" face="Courier New">http://schemas.openxmlformats.org/markup-compatibility/2006"</font></a><br><font size="2" face="Courier New">&nbsp;&nbsp;&nbsp; mc:Ignorable="d"&gt;<br>&nbsp;&nbsp;&nbsp; &lt;Grid</font><font size="2" face="Courier New">&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;canvas:CanvasControl Draw="DrawCanvas" </font></p> <p><font size="2" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ClearColor="Beige" x:Name="DrawingCanvas"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;InkCanvas x:Name="InkCanvas"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;InkToolbar TargetInkCanvas="{x:Bind InkCanvas}"</font></p> <p><font size="2" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VerticalAlignment="Top" x:Name="InkToolbar"/&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/Grid&gt;<br>&lt;/Page&gt;</font></p></blockquote> <p><font size="4">The CanvasControl has a Draw event which is triggered every time the control needs to draw itself.&nbsp; The event is also triggered by the CanvasControl.Invalidate() method in the InkPresenter_StrokesCollected event handler.&nbsp; </font><font size="4">The code to draw the ink in that DrawCanvas() method can be as simple as calling CanvasDrawingSession.DrawInk() on the lists of InkStrokes in the InkStrokeContainers, but I wanted to show how easy it is to use Win2d Effects to jazz up the ink – adding a drop shadow to each stroke:</font></p> <blockquote> <p><font size="4">private void DrawCanvas(CanvasControl sender, CanvasDrawEventArgs args)<br>{<br>&nbsp;&nbsp;&nbsp; DrawInk(args.DrawingSession);<br>}</font></p> <p><font size="4">private void DrawInk(CanvasDrawingSession session)<br>{<br>&nbsp;&nbsp;&nbsp; foreach (var item in _strokes)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var strokes = item.GetStrokes();</font></p> <p><font size="4"></font>&nbsp;</p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; using (var list = new CanvasCommandList(session))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; using (var listSession = list.CreateDrawingSession())<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; listSession.DrawInk(strokes);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; using (var shadowEffect = new ShadowEffect<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ShadowColor = Colors.DarkRed,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Source = list<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; })<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; session.DrawImage(shadowEffect, new Vector2(2, 2));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; session.DrawInk(strokes);<br>&nbsp;&nbsp;&nbsp; }<br>}</font></p></blockquote> <p><font size="4">The end result of the drop shadows is most visible with thick pen strokes.&nbsp; The end result is that the shadow appears to pops in under the strokes as the pen is lifted from the screen.</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/08/image353.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/08/image_thumb281.png" width="1011" height="710"></a></p> <p><font size="4">This works great – now you can use all of the drawing tools and the ruler to draw, but when you try using the eraser, nothing happens.&nbsp; </font></p> <h1>Erasing Dry Ink</h1> <p><font size="4">This is because the InkToolbar eraser doesn’t know about any of the dry ink; the application has taken control of dry ink rendering.&nbsp; Now if you want to implement erasing you have to handle that yourself by doing two things:</font></p> <ol> <li><font size="4">When the user has selected the eraser tool, handle pointer events and do hit-testing on the ink.&nbsp; The InkStrokeContainer make this easy to do.</font>  <li><font size="4">If you hold your pointer (finger, mouse, or pen) over the eraser button, you will see an option to “Erase All Ink”.&nbsp; You will need to override this behavior to erase all the ink that has been collected.</font></li></ol> <p><font size="4">Once the page has loaded, get the eraser button and handle the Checked and Unchecked events (it’s just a styled radio button)</font></p> <blockquote> <p><font size="4">var eraser = InkToolbar.GetToolButton(InkToolbarTool.Eraser) as InkToolbarEraserButton;</font></p> <p><font size="4">if (eraser != null)<br>{<br>&nbsp;&nbsp;&nbsp; eraser.Checked += Eraser_Checked;<br>&nbsp;&nbsp;&nbsp; eraser.Unchecked += Eraser_Unchecked;<br>}</font></p></blockquote> <p><font size="4">Then in the Checked event handler, attach pointer events and set the input processing mode; in the Unchecked event to the opposite:</font></p> <blockquote> <p><font size="4">private void Eraser_Checked(object sender, RoutedEventArgs e)<br>{<br>&nbsp;&nbsp;&nbsp; var unprocessedInput = InkCanvas.InkPresenter.UnprocessedInput;</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp; unprocessedInput.PointerPressed += UnprocessedInput_PointerPressed;<br>&nbsp;&nbsp;&nbsp; unprocessedInput.PointerMoved += UnprocessedInput_PointerMoved;<br>&nbsp;&nbsp;&nbsp; unprocessedInput.PointerReleased += UnprocessedInput_PointerReleased;<br>&nbsp;&nbsp;&nbsp; unprocessedInput.PointerExited += UnprocessedInput_PointerExited;<br>&nbsp;&nbsp;&nbsp; unprocessedInput.PointerLost += UnprocessedInput_PointerLost;</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp; InkCanvas.InkPresenter.InputProcessingConfiguration.Mode = InkInputProcessingMode.None;<br>}</font></p> <p><font size="4">private void Eraser_Unchecked(object sender, RoutedEventArgs e)<br>{<br>&nbsp;&nbsp;&nbsp; var unprocessedInput = InkCanvas.InkPresenter.UnprocessedInput;</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp; unprocessedInput.PointerPressed -= UnprocessedInput_PointerPressed;<br>&nbsp;&nbsp;&nbsp; unprocessedInput.PointerMoved -= UnprocessedInput_PointerMoved;<br>&nbsp;&nbsp;&nbsp; unprocessedInput.PointerReleased -= UnprocessedInput_PointerReleased;<br>&nbsp;&nbsp;&nbsp; unprocessedInput.PointerExited -= UnprocessedInput_PointerExited;<br>&nbsp;&nbsp;&nbsp; unprocessedInput.PointerLost -= UnprocessedInput_PointerLost;</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp; InkCanvas.InkPresenter.InputProcessingConfiguration.Mode = InkInputProcessingMode.Inking;<br>}</font></p></blockquote> <p><font size="4">All of the pointer event handlers are trivial, except for the PointerMoved event handler which does the hit testing using the InkStrokeContainer.SelectWithLine() API.&nbsp; If the stroke of the eraser crosses any of the strokes, the bounding box of the selected stroke will be returned otherwise it would be empty&nbsp; In the pointer moved event handler, items in the _strokes list are removed if the eraser intersects them:</font></p> <blockquote> <p><font size="4">private void UnprocessedInput_PointerMoved(InkUnprocessedInput sender, PointerEventArgs args)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!_isErasing)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var invalidate = false;</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach (var item in _strokes.ToArray())<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var rect = item.SelectWithLine(_lastPoint, args.CurrentPoint.Position);</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (rect.IsEmpty)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; continue;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (rect.Width * rect.Height &gt; 0)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _strokes.Remove(item);</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invalidate = true;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _lastPoint = args.CurrentPoint.Position;</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; args.Handled = true;</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (invalidate)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DrawingCanvas.Invalidate();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void UnprocessedInput_PointerLost(InkUnprocessedInput sender, PointerEventArgs args)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (_isErasing)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; args.Handled = true;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _isErasing = false;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void UnprocessedInput_PointerExited(InkUnprocessedInput sender, PointerEventArgs args)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (_isErasing)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; args.Handled = true;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _isErasing = true;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void UnprocessedInput_PointerPressed(InkUnprocessedInput sender, PointerEventArgs args)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _lastPoint = args.CurrentPoint.Position;</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; args.Handled = true;</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _isErasing = true;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void UnprocessedInput_PointerReleased(InkUnprocessedInput sender, PointerEventArgs args)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (_isErasing)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; args.Handled = true;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _isErasing = false;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p></blockquote> <p><font size="4">The last thing to do with erasing is to implement the Erase All Ink button.&nbsp; Since in custom dry mode, the InkToolbar has no control over the application-owned InkStrokeContainer, you need to override some of its built-in behavior.&nbsp; The control template for the InkToolbarEraserButton uses a Button in an attached Flyout to trigger the InkCanvas erase all function.&nbsp; In this code, the button is replaced with another button that has a different event handler:</font></p> <blockquote> <p><font size="4">var eraser = InkToolbar.GetToolButton(InkToolbarTool.Eraser) as InkToolbarEraserButton;</font></p> <p><font size="4">if (eraser != null)<br>{<br>&nbsp;&nbsp;&nbsp; eraser.Checked += Eraser_Checked;<br>&nbsp;&nbsp;&nbsp; eraser.Unchecked += Eraser_Unchecked;<br>}</font></p> <p><font size="4">var flyout = FlyoutBase.GetAttachedFlyout(eraser) as Flyout;</font></p> <p><font size="4">if (flyout != null)<br>{<br>&nbsp;&nbsp;&nbsp; var button = flyout.Content as Button;</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp; if (button != null)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var newButton = new Button();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newButton.Style = button.Style;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newButton.Content = button.Content;</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newButton.Click += EraseAllInk;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; flyout.Content = newButton;<br>&nbsp;&nbsp;&nbsp; }<br>}</font></p></blockquote> <p><br><font size="4">Then the EraseAllInk is trivial:</font></p> <blockquote> <p><font size="4">private void EraseAllInk(object sender, RoutedEventArgs e)<br>{<br>&nbsp;&nbsp;&nbsp; _strokes.Clear();</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp; DrawingCanvas.Invalidate();<br>}</font></p></blockquote> <h1>Simultaneous Pen and Touch</h1> <p><font size="4">One new feature in the Windows 10 anniversary edition is the ability for apps to use pen and touch simultaneously. This can be most easily seen with the new Ruler tool that can be shown on the InkCanvas.&nbsp; An easy way to take advantage of simultaneous pen and touch is to put the InkCanvas into a ScrollViewer and enable zooming in the ScrollViewer.&nbsp; Doing this enables one-finger panning and two finger pinch to zoom.&nbsp; I’ve implemented the ScrollViewer zooming and panning features via a Style, “ZoomableScrollViewer” and by using that and giving the contents of the ScrollViewer a size, you get panning and scrolling.&nbsp; For fun, try drawing a horizontal or vertical line by putting the pen down and then flicking the canvas with your finger up, down, left or right.&nbsp; The scroll “rails” will keep the scrolling to a single axis at a time.&nbsp; See the Xaml changes here:</font></p> <blockquote> <p><font size="2" face="Courier New">&lt;Page<br>&nbsp;&nbsp;&nbsp; x:Class="InkToolbarTest.MainPage"<br>&nbsp;&nbsp;&nbsp; xmlns="</font><a href="http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;"><font size="2" face="Courier New">http://schemas.microsoft.com/winfx/2006/xaml/presentation"</font></a><br><font size="2" face="Courier New">&nbsp;&nbsp;&nbsp; xmlns:x="</font><a href="http://schemas.microsoft.com/winfx/2006/xaml&quot;"><font size="2" face="Courier New">http://schemas.microsoft.com/winfx/2006/xaml"</font></a><br><font size="2" face="Courier New">&nbsp;&nbsp;&nbsp; xmlns:canvas="using:Microsoft.Graphics.Canvas.UI.Xaml"<br>&nbsp;&nbsp;&nbsp; xmlns:d="</font><a href="http://schemas.microsoft.com/expression/blend/2008&quot;"><font size="2" face="Courier New">http://schemas.microsoft.com/expression/blend/2008"</font></a><br><font size="2" face="Courier New">&nbsp;&nbsp;&nbsp; xmlns:mc="</font><a href="http://schemas.openxmlformats.org/markup-compatibility/2006&quot;"><font size="2" face="Courier New">http://schemas.openxmlformats.org/markup-compatibility/2006"</font></a><br><font size="2" face="Courier New">&nbsp;&nbsp;&nbsp; mc:Ignorable="d"&gt;<br>&nbsp;&nbsp;&nbsp; &lt;Page.Resources&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Style TargetType="ScrollViewer" x:Key="ZoomableScrollViewer"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Setter Property="ZoomMode" Value="Enabled"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Setter Property="HorizontalScrollMode" Value="Enabled"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Setter Property="VerticalScrollMode" Value="Enabled"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Setter Property="HorizontalScrollBarVisibility" Value="Auto"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Setter Property="VerticalScrollBarVisibility" Value="Auto"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Style&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/Page.Resources&gt;<br>&nbsp;&nbsp;&nbsp; &lt;Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ScrollViewer Style="{StaticResource ZoomableScrollViewer}"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Grid Width="3000" Height="2000"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;canvas:CanvasControl Draw="DrawCanvas" ClearColor="Beige" x:Name="DrawingCanvas"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;InkCanvas x:Name="InkCanvas"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Grid&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ScrollViewer&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;InkToolbar TargetInkCanvas="{x:Bind InkCanvas}" VerticalAlignment="Top" x:Name="InkToolbar"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;InkToolbarCustomToolButton Content="" FontFamily="Segoe MDL2 Assets" Click="OnShare" ToolTipService.ToolTip="Share"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/InkToolbar&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/Grid&gt;<br>&lt;/Page&gt;</font></p></blockquote><font size="4"> <h1>Sharing Ink</h1> <p>I added a custom button to the InkToolbar to enable sharing the rendered ink to other apps.&nbsp; This code re-uses the DrawInk() method but renders to an offscreen bitmap that is then put into the sharing DataPackage.&nbsp; Because the InkToolbar buttons are meant to act as radio buttons, I needed to override the default behavior of pressed state:</p> <blockquote> <p><font size="4">private async void OnShare(object sender, RoutedEventArgs e)<br>{<br>&nbsp;&nbsp;&nbsp; var activeTool = InkToolbar.ActiveTool;</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp; // Show the share UI<br>&nbsp;&nbsp;&nbsp; DataTransferManager.ShowShareUI();</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp; await Task.Delay(TimeSpan.FromSeconds(0.1));</font></p> <p><font size="4">&nbsp;&nbsp;&nbsp; // reset the active tool after pressing the share button<br>&nbsp;&nbsp;&nbsp; InkToolbar.ActiveTool = activeTool;<br>}</font></p> <h1 align="left">Helpful Links</h1> <ul> <li><font size="4">Get the <a href="https://github.com/mscherotter/InkToolbarAndCustomDryInk">full source here</a> for the project.</font>  <li> <div align="left"><font size="4"><a href="https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.inkcanvas.aspx">InkCanvas</a> control</font></div> <li> <div align="left"><font size="4"><a href="https://msdn.microsoft.com/en-us/library/windows/apps/Windows.UI.Xaml.Controls.InkToolbar.aspx">InkToolbar</a> control</font></div> <li> <div align="left"><font size="4"><a href="http://microsoft.github.io/Win2D/html/Introduction.htm">Win2D</a> library</font></div> <li> <div align="left"><font size="4"><a href="https://channel9.msdn.com/Events/Build/2016/B865">Pen and Ink: Inking at the Speed of Thought</a> from //Build 2016</font></div></li></ul> <p align="center"></font><font size="4"></font>&nbsp;</p></blockquote> <p><font size="4">I have been drawing my whole life – my career in software started over 20 years ago when I was in architecture school and I experimented with a computer that I could draw on.&nbsp;&nbsp; I am very excited about the possibilities of combining the great UX (InkToolbar and InkCanvas) with great graphic processing power (Win2D) with great hardware (Surface).&nbsp; The future is bright for <a href="https://www.linkedin.com/pulse/keeping-journaling-alive-21st-century-michael-scherotter">someone who draws with a pen</a>.&nbsp; Take a look at <a href="https://www.behance.net/gallery/36710741/Sydney-Sketches">my latest pen drawings</a> that I did on a Surface Pro 3.&nbsp; How do they compare with <a href="https://sway.com/sgHz73jODRuAAJFe">drawings I did in a traditional journal</a>?&nbsp; <strong>What new experiences can you craft with Ink on Windows?</strong></font></p>]]></content:encoded>
    </item>
    <item>
      <title>Console Ouptut: my New Debugging and Testing tool for Windows</title>
      <link>https://docs.microsoft.com/archive/blogs/synergist/console-ouptut-my-new-debugging-and-testing-tool-for-windows</link>
      <pubDate>Sat, 20 Aug 2016 16:01:20 GMT</pubDate>
      <dc:creator><![CDATA[Synergist]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/synergist/?p=3815</guid>
      <description><![CDATA[I have been working with a partner who wanted to get standard console output from a UWP app for...]]></description>
      <content:encoded><![CDATA[<p><font size="3">I have been working with a partner who wanted to get standard console output from a UWP app for debugging and testing purposes.&nbsp; Of course the easiest way get debugging output is by attaching a debugger like Visual Studio but in some cases that isn’t possible or practical.&nbsp; I just published an app, <a href="https://www.microsoft.com/store/apps/9NBLGGH515N5">Console Output</a> that enables other apps to send output text lines to it. There are some new capabilities in Windows 10 Anniversary Update that makes this possible:</font></p> <ol> <li><font size="3"><a href="https://blogs.windows.com/buildingapps/2016/06/07/background-activity-with-the-single-process-model/#z3OjoTRbQMVX1puj.99">App Services</a> that can run in the application’s process instead of in a background task</font>&nbsp; <li><font size="3"><a href="https://msdn.microsoft.com/windows/uwp/launch-resume/connected-apps-and-devices">Remote Systems API</a> that enables connecting apps across devices and platforms.</font></li></ol> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/08/Destktop.png"><img title="Destktop" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="Destktop" src="https://msdnshared.blob.core.windows.net/media/2016/08/Destktop_thumb.png" width="1028" height="725"></a></p> <p><font size="3">On its own, Console Output doesn’t do anything special when you run it, but if you launch it from another app by activating the <em>consoleoutput:</em> protocol handler <strong>consoleoutput:?title=My app name </strong>you can then send text output to it with app services.</font></p> <p><font size="3">When you install and run Console Output, you will see a full code sample in C# showing how to launch Console Output with the Launcher.LaunchUriAsync() API and then open an AppServiceConnection communications channel for bi-directional communications with Console Output.&nbsp; The sample code is at the bottom of this article.&nbsp; Console Output is also <a href="http://aka.ms/Bttm1d">enabled for remote activation</a> so doing debugging and testing of devices nearby or through the cloud becomes possible as well.&nbsp; I have also shared the source code for a <a href="https://github.com/mscherotter/ConsoleOutputTester">Console Output Tester</a> app that demonstrates how an app might use Console Output.</font></p> <h1>Sample C# Code</h1> <blockquote> <p><font size="3" face="Courier New">using System;<br>using Windows.ApplicationModel.AppService;<br>using Windows.Foundation.Collections;<br>using Windows.System;</font></p></blockquote> <blockquote> <p><font size="3" face="Courier New">public class ConsolLoggingTester : IDisposable<br>{<br>&nbsp;&nbsp;&nbsp; private AppServiceConnection _appServiceConnection;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; public ConsolLoggingTester()<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InitializeAppServiceConnection();<br>&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="3" face="Courier New">&nbsp;&nbsp;&nbsp; private async void InitializeAppServiceConnection()<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // this is the unique package family name of the Console Ouput app<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const string consoleOutputPackageFamilyName = "49752MichaelS.Scherotter.ConsoleOutput_9eg5g21zq32qm";</font></p> <p><font size="3" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var options = new LauncherOptions<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PreferredApplicationDisplayName = "Console Output",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PreferredApplicationPackageFamilyName = consoleOutputPackageFamilyName,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TargetApplicationPackageFamilyName = consoleOutputPackageFamilyName,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };</font></p> <p><font size="3" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // launch the ConsoleOutput app<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var uri = new Uri("consoleoutput:?Title=Console Output Tester&amp;input=true");</font></p> <p><font size="3" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!await Launcher.LaunchUriAsync(uri, options))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="3" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var appServiceConnection = new AppServiceConnection<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AppServiceName =&nbsp; "consoleoutput",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PackageFamilyName = consoleOutputPackageFamilyName<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };</font></p> <p><font size="3" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var status = await appServiceConnection.OpenAsync();</font></p> <p><font size="3" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (status == AppServiceConnectionStatus.Success)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _appServiceConnection = appServiceConnection;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // because we want to get messages back from the console, we <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // launched the app with the input=true parameter<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _appServiceConnection.RequestReceived += OnRequestReceived;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="3" face="Courier New">&nbsp;&nbsp;&nbsp; public async void LogMessage(string messageText)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (_appServiceConnection == null)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="3" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var message = new ValueSet<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ["Message"] = messageText<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };</font></p> <p><font size="3" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; await _appServiceConnection.SendMessageAsync(message);<br>&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="3" face="Courier New">&nbsp;&nbsp;&nbsp; public void Dispose()<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (_appServiceConnection != null)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _appServiceConnection.Dispose();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _appServiceConnection = null;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }</font></p> <p><font size="3" face="Courier New">&nbsp;&nbsp;&nbsp; private void OnRequestReceived(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AppServiceConnection sender, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AppServiceRequestReceivedEventArgs args)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var message = args.Request.Message["Message"] as string;</font></p> <p><font size="3" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // handle message input from Console Ouptut app<br>&nbsp;&nbsp;&nbsp; }<br>}</font></p></blockquote> <h1>Links</h1> <ul><font size="3"> <ul> <li> <p><a href="https://www.microsoft.com/store/apps/9NBLGGH515N5">Console Output in the Windows Store</a></p> <li> <p><a href="https://github.com/mscherotter/ConsoleOutputTester">Console Output Tester source code on GitHub</a><br></p></li></ul></font></ul> <p><font size="3">Please tell me if you start using Console Output and if you find it useful!</font></p>]]></content:encoded>
    </item>
    <item>
      <title>Watercoloring, 3D Printing, CAD, Hour of Code, Windows Apps, and The Creative Process</title>
      <link>https://docs.microsoft.com/archive/blogs/synergist/watercoloring-3d-printing-cad-hour-of-code-windows-apps-and-the-creative-process</link>
      <pubDate>Thu, 10 Dec 2015 16:07:25 GMT</pubDate>
      <dc:creator><![CDATA[Synergist]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/synergist/?p=3742</guid>
      <description><![CDATA[If you know me, you know that I like creating stuff and the creative process.&nbsp; Having studied...]]></description>
      <content:encoded><![CDATA[<p>If you know me, you know that I like creating stuff and the creative process.&nbsp; Having studied architecture and then <strong>design tool development</strong>, I have added many tools over the years to my creative palette and have even created some <a href="https://www.youtube.com/playlist?list=PLqGxsklBwRIqJY2VGt_uRg8es4oy_lO3l" target="_blank">videos</a> demonstrating them.&nbsp; While I have spent my career in software development and technical evangelism, I put a primary activity of my work, <strong>coding</strong>, firmly in the category of <strong>creative tools</strong>, right next to my journal, pens, watercolors, and cameras.&nbsp; Please follow with me – there is a thread that connects all of the things in the title of this post.&nbsp; For me <strong><font color="#ff0000">creativity is a fluid</font></strong> that runs each of my interests to each other. </p> <h1>Watercoloring</h1> <p>My latest creative journey stared with the fact that my watercolor kit, filled with character and memories,&nbsp; has gotten rusty and has started to fall apart after 25 years of usage.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2015/12/WP_20151205_001.jpg"><img title="WP_20151205_001" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;border-top-width: 0px;margin-right: auto" border="0" alt="WP_20151205_001" src="https://msdnshared.blob.core.windows.net/media/2015/12/WP_20151205_001_thumb.jpg" width="644" height="364"></a></p> <p>Since I have been working with 3D printers lately, I though that I would design a new watercolor palette – but first I needed to get my ideas out – and for me my journal is the best tool for that – I still haven’t gone digital for my favorite creative tool.&nbsp; I did a few quick sketches with an ultra-fine point Sharpie and added a little color – and had the germ of an idea – a watercolor kit where I could put my travel brushes in as well.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2015/12/WP_20151205_002.jpg"><img title="WP_20151205_002" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;border-top-width: 0px;margin-right: auto" border="0" alt="WP_20151205_002" src="https://msdnshared.blob.core.windows.net/media/2015/12/WP_20151205_002_thumb.jpg" width="639" height="484"></a></p> <h1>3D Printing</h1> <p>I took my design and then started making a model in <a href="https://www.microsoft.com/en-US/store/apps/3D-Builder/9WZDNCRFJ3T6" target="_blank">3D Builder</a>, the 3D design and printing app that comes with Windows 10.&nbsp; In 3D Builder, you can make very complex shapes by taking simple shapes (cubes, cylinders, wedges, etc.) and doing transforms (translate, scale, rotate) and Boolean operations (add, subtract, intersect) on them.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2015/12/image3.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;border-top-width: 0px;margin-right: auto" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2015/12/image_thumb.png" width="644" height="364"></a></p> <p>3D Builder is very powerful but it does have its limitations – think of it as WordPad for 3D printing – it comes with Windows 10 now and is very easy to use, but doing something like changing the size of the holes I created for the brushes will typically involve a complex repair because it doesn’t keep the parameters that I used to make the hole in the model: Boolean operations are destructive in 3D Builder.&nbsp; There is a simple workflow to account for this involving making copies of objects before doing Boolean operations on them. As a software developer, I wanted to automate the process – I wanted to code it.&nbsp; What I really wanted to do was to make a parametric model where I could change the various numerical values that make up the model.&nbsp; When he got into 3D printing, my colleague Scott Hanselman wrote a great article about the <a href="http://www.hanselman.com/blog/TheBasicsOf3DPrintingIn2015FromSomeoneWith16WHOLEHOURSExperience.aspx" target="_blank">basics of 3D printing</a> and in the article pointed to the site <a href="http://openjscad.org/" target="_blank">openjscad.org</a> where you can write JavaScript to make a model that you could then send to a 3D Printer.&nbsp; This was exactly what I was looking for.</p> <h1>CAD: Computer Aided Design</h1> <p><a href="https://msdnshared.blob.core.windows.net/media/2015/12/image4.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;border-top-width: 0px;margin-right: auto" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2015/12/image_thumb1.png" width="644" height="365"></a></p> <p>I wrote the code for watercolor palette, and published the JavaScript source to <a href="https://github.com/mscherotter/wcpal/blob/master/OpenJSCAD/WatercolorPalette.jscad" target="_blank">GitHub</a>.&nbsp; The model is made up of a simple reusable functions I combined to make a complex model.&nbsp; For example to make the edges rounded, I subtracted a quarter-round solid from each edge.&nbsp; The code to make the quarter round is here where the height is the length in millimeters:</p> <div id="scid:C89E2BDB-ADD3-4f7a-9810-1B7EACF446C1:df90c8e7-5fbe-4993-8d8b-f5a04df25431" class="wlWriterEditableSmartContent" style="float: none;padding-bottom: 0px;padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px"><pre>
[sourcecode language='javascript'  padlinenumbers='true']
// Generate a quarter-round used to radius the edges (4mm radius)
function corner(height) {
    if (!height) {
        height = 140;
    }
    return color(&quot;white&quot;, cube({ size: [4, 4, height] })
     .translate([0, 0, 0])
     .subtract(cylinder({ r: 4, h: height }))
     .rotateY(90));
}
[/sourcecode]
</pre>
</div>
<p><a href="https://msdnshared.blob.core.windows.net/media/2015/12/image5.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;border-top-width: 0px;margin-right: auto" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2015/12/image_thumb2.png" width="644" height="407"></a></p>
<p>In addition to publishing the source code for the model, I even published the model in both STL and .3MF format (still a work in progress) to <a href="http://www.thingiverse.com/thing:1097490" target="_blank">Thingiverse</a>.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2015/12/WP_20151106_001.jpg"><img title="WP_20151106_001" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;border-top-width: 0px;margin-right: auto" border="0" alt="WP_20151106_001" src="https://msdnshared.blob.core.windows.net/media/2015/12/WP_20151106_001_thumb.jpg" width="644" height="364"></a></p>
<p>In the process of using the OpenJSCAD.org site, I found some things that I could improve upon and since the site has a link at the bottom to <a href="https://github.com/Spiritdude/OpenJSCAD.org" target="_blank">clone/fork the site on GitHub</a>, I did just that.</p>
<h1>My Fork of OpenJSCAD.org</h1>
<p>Here is what I wanted to do that triggered my decision to fork OpenJSCAD.org and make my own version that you can view the code for on <a href="https://github.com/mscherotter/OpenJSCAD.org" target="_blank">GitHub</a> and try out <a href="http://openjscad.azurewebsites.net/" target="_blank">here</a>.</p>
<ol>
<li>Make the site work on Azure (by adding a Web.config file) 
<li>Enable the site to work on Internet Explorer and Microsoft Edge 
<li>Adds <a href="https://developers.google.com/blockly/" target="_blank">Blockly</a>-based block coding so that kids can try drag-and-drop CAD-coding 
<li>Enable the site to work as a <a href="https://www.microsoft.com/en-us/store/apps/openjscad/9nblggh6j6j9" target="_blank">hosted web app</a> when in a Windows 10 app that adds the following features 
<ol>
<li>Enables direct 3D Printing via new <a href="https://msdn.microsoft.com/library/windows/apps/windows.graphics.printing3d.aspx" target="_blank">Windows 10 3D Printing APIs</a> 
<li>Enable file association with .jscad files so that when you double-click on one, it launches the app with the file 
<li>Adds saving to the new <a href="http://3mf.io/" target="_blank">3D Manufacturing Format (.3MF)</a> 
<li>Enable block coding file saving and loading to Windows 10 roaming storage </li></ol></li></ol>
<p align="left">You can try out the site I put up on Azure Websites: <br><a title="http://openjscad.azurewebsites.net/" href="http://openjscad.azurewebsites.net/">http://openjscad.azurewebsites.net/</a></p>
<h1>Hour of Code and Block Programming</h1>
<p>When I heard that Microsoft would be creating <a href="http://openjscad.azurewebsites.net/" target="_blank">Minecraft-based content for the Hour of Code</a> I was very excited since I was planning on helping my partners 21st Century Fox and Adobe Systems run Hour of Code events at their companies.&nbsp; Here is a photo of my son Sam, age 10, who accompanied me to assist teaching an <strong><a href="https://code.org/mc" target="_blank">Hour of Code</a></strong> at the <strong>20th Century Fox Innovation Lab</strong> in Los Angeles.&nbsp; When I showed the OpenJSCAD JavaScript programming to Sam, he was a bit stuck on the JavaScript syntax – but after he ran through the Minecraft-based coding exercises with drag-and-drop block programming, I got an idea: why not add this to my fork of OpenJSCAD.</p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/2015/12/WP_20151207_007.jpg"><img title="WP_20151207_007" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;border-top-width: 0px;margin-right: auto" border="0" alt="WP_20151207_007" src="https://msdnshared.blob.core.windows.net/media/2015/12/WP_20151207_007_thumb.jpg" width="644" height="364"></a></p>
<p>The Minecraft-based coding exercises use a block-based programming tool called <a href="https://developers.google.com/blockly/" target="_blank">Blockly</a>, I wanted to see how easy it would be to integrate that into <a href="https://github.com/mscherotter/OpenJSCAD.org" target="_blank">my fork of OpenJSCAD</a>.&nbsp; I saw that millions of kids were going to learn how to program with blocks over the course of the Hour of Code Week December 7-11 and I wanted to find a way for kids to leverage those new coding skills to build 3D Models.</p>
<p>I started that by cloning the <a href="https://github.com/google/blockly" target="_blank">Blockly GitHub repository</a> and merging that with my <a href="https://github.com/mscherotter/OpenJSCAD.org" target="_blank">fork of the OpenJSCAD site</a>.&nbsp; If anyone knows of a best practice for merging two different forks of two seemingly unrelated GitHub repositories, please share that with me.&nbsp; My moniker is <strong>Synergist</strong> – and true to <a href="http://dictionary.reference.com/browse/synergist" target="_blank">its definition</a>, I like combining things in new ways.&nbsp; For me, combining technologies in ways people hadn’t thought of before is my passion – so this kind of creative mixing of GitHub repositories, while keeping those repositories current is essential.</p>
<p>&nbsp;</p>
<p>In my Block-coding implementation of OpenJSCAD, I made blocks for the various basic solids like Cube, Sphere, Cylinder, blocks for transforms like translate, rotate, and scale, and blocks for Boolean operations like union and subtract.&nbsp; In Blockly, you define the blocks separately from the code generators – since Blockly could generate code for any text-based languages.&nbsp; You can see the blocks and generators for the CAD objects, transforms and operations <a href="https://github.com/mscherotter/OpenJSCAD.org/tree/dev/blockly/cad" target="_blank">here</a>.&nbsp; II t is still a work in progress – I am still trying to get touch working as well as it does on <a href="http://code.org/mc">http://code.org/mc</a> and getting variables working is a bit tricky.</p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/2015/12/clip_image001.jpg"><img title="clip_image001" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;border-top-width: 0px;margin-right: auto" border="0" alt="clip_image001" src="https://msdnshared.blob.core.windows.net/media/2015/12/clip_image001_thumb.jpg" width="644" height="440"></a></p>
<p>then generates this code:</p>
<div id="scid:C89E2BDB-ADD3-4f7a-9810-1B7EACF446C1:86c556d0-98ce-4932-9dbe-85a2f747ec24" class="wlWriterEditableSmartContent" style="float: none;padding-bottom: 0px;padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px"><pre>
[sourcecode language='javascript'  padlinenumbers='true']
function main() { 

    return cube({size:[10, 10, 10], center: true}) 

.subtract(  sphere({r:6, center:true})) 

.translate([0, 0, 5]); 

} 
[/sourcecode]
</pre>
</div>
<p>This was my son Sam’s first code model and he saw that blocks=code=model=real object.&nbsp; He got it!</p>
<h1>Hosted Web App</h1>
<p>One of the very powerful ways to build a Windows 10 App is called a <a href="http://microsoftedge.github.io/WebAppsDocs/en-US/win10/HWA.htm" target="_blank">Hosted Web App</a>.&nbsp; A Hosted Web App can have almost all of the capabilities of a native app except the majority of its code resides on the web instead of the app package.&nbsp; This enables a single code base to support a website and an app while doing feature detection to enable certain features when running in the app context.&nbsp; In the case of the OpenJSCAD app, the Windows 10 specific code around 3d Printing is all in the <a href="https://github.com/mscherotter/OpenJSCAD.org/blob/dev/Windows3DPrinting.js" target="_blank">Windows3DPrinting.js</a> file.&nbsp; Once you have detected that you are running in the Windows App context on a page that has been whitelisted in the application manifest, you can start calling Windows Runtime APIs:</p>
<div style="font-family: monospace">
<p>if (typeof Windows !== “undefined”) {</p>
<p>&nbsp;&nbsp;&nbsp; // call Windows Runtime APIs</p>
<p>}</p></div>
<p>Last month, Microsoft released an update to Windows that added some new functionality available to developers.&nbsp; One area that was enhanced was in 3D printing and because of this, I needed to have some code branches in specific areas around creating 3D Models.&nbsp; Take a look where I am using the IsTH2() function in the <a href="https://github.com/mscherotter/OpenJSCAD.org/blob/dev/Windows3DPrinting.js" target="_blank">Windows3DPrinting.js</a> code.</p>
<div id="scid:C89E2BDB-ADD3-4f7a-9810-1B7EACF446C1:b7ec2c29-aeb0-4ed7-8d40-a3dd0821a32f" class="wlWriterEditableSmartContent" style="float: none;padding-bottom: 0px;padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px"><pre>
[sourcecode language='javascript'  padlinenumbers='true']
function isTh2(){
        /// &lt;summary&gt;Is Windows Threshold 2 (November 2015 Update)?&lt;/summary&gt;
        /// &lt;returns type=&quot;bool&quot;&gt;true if running Windows TH2 (November 2015 Update)&lt;/returns&gt;

        var apiInformation = Windows.Foundation.Metadata.ApiInformation,
            universalApiContract = &quot;Windows.Foundation.UniversalApiContract&quot;;

        return apiInformation.isApiContractPresent(universalApiContract, 2);
}
[/sourcecode]
</pre>
</div>
<p>The hosted web app adds Windows 10 functionality specifically to the following areas:</p>
<ul>
<li>3D Printing and 3D Manufacturing Format file creation 
<li>saving and loading block coding files to roaming storage 
<li>.jscad file association – in this case I needed to include some file activation code in the app package 
<li>Handling case where there is no internet connection</li></ul>
<p><a href="https://msdnshared.blob.core.windows.net/media/2015/12/image6.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;border-top-width: 0px;margin-right: auto" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2015/12/image_thumb3.png" width="619" height="484"></a>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/2015/12/image7.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;border-top-width: 0px;margin-right: auto" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2015/12/image_thumb4.png" width="616" height="480"></a></p>
<h1>The Creative Process</h1>
<p>As you can see by now, my creative process is much more of a journey where I combine my interests rather than a destination.&nbsp; In this creative process, I created a painting, a watercolor kit, a website, and an app – and taught some kids to code on the way.</p>]]></content:encoded>
    </item>
    <item>
      <title>3D Printing in Windows 10</title>
      <link>https://docs.microsoft.com/archive/blogs/synergist/3d-printing-in-windows-10</link>
      <pubDate>Wed, 14 Oct 2015 14:49:43 GMT</pubDate>
      <dc:creator><![CDATA[Synergist]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/synergist/2015/10/14/3d-printing-in-windows-10/</guid>
      <description><![CDATA[If you know me, you know that I have always been interested in design tools: devices and processes...]]></description>
      <content:encoded><![CDATA[<p>If you know <a href="http://charette.com/blog/my-story/" target="_blank">me</a>, you know that I have always been interested in <strong>design tools</strong>:<strong> </strong>devices and processes that aid in the creative design process.&#160; Today I work for a company, Microsoft, that makes both a creative tool with a pen, the <a href="http://www.microsoft.com/surface/en-us" target="_blank">Surface</a>, and <a href="https://www.microsoft.com/en-US/store/apps/3D-Builder/9WZDNCRFJ3T6" target="_blank">3D Builder</a>, software for designing and printing 3D models.&#160; When I show 3D printers to people they often don’t understand the power of it until I show them something that I made, a door stop to solve a problem in my house.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/5611.DSCF1018_7480A055.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/5611.DSCF1018_5F00_7480A055.jpg"><img title="DSCF1018" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; float: left; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px" border="0" alt="DSCF1018" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/5355.DSCF1018_thumb_01E6B35C.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/5355.DSCF1018_5F00_thumb_5F00_01E6B35C.jpg" width="324" align="left" height="484" /></a>In my house I have a front door that swings and hits a counter top and because there is a recessed toe plate, there is no place to put a door stop by the base of the door.&#160; I wanted to prevent the door from banging into the counter top. I decided to make a door stop that could clip onto the counter.</p>  <p>Windows 10 comes with a free app, called <a href="https://www.microsoft.com/en-US/store/apps/3D-Builder/9WZDNCRFJ3T6" target="_blank">3D Builder</a> which has basic solid modeling capabilities, giving me the ability to make a complex shape by adding together a few basic shapes and then subtracting another shape and then “slicing” it to make a final object that I could print.&#160; The software is extremely easy to use but also very powerful.&#160; Since any app in Windows 10 can now use the <a href="https://msdn.microsoft.com/en-us/windows/hardware/bg183398.aspx" target="_blank">3D printing facilities</a> built into the operating system, plug-and-play 3D printers are now really easy to setup and get running in Windows.&#160; The printing technology is still a very hands-on process but it is incredibly rewarding to come up with an idea that solves a problem, design a solution, and manufacture the result.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/0842.image_1D8B3F52.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/0842.image_5F00_1D8B3F52.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/7612.image_thumb_3FE2D4CB.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/7612.image_5F00_thumb_5F00_3FE2D4CB.png" width="644" height="511" /></a></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/1778.DSCF1014_065FC4D4.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/1778.DSCF1014_5F00_065FC4D4.jpg"><img title="DSCF1014" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="DSCF1014" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/3247.DSCF1014_thumb_;210F.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/3247.DSCF1014_5F00_thumb_5F00_3B00210F.jpg" width="644" height="431" /></a></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/7242.DSCF1015_13C5D7DA.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/7242.DSCF1015_5F00_13C5D7DA.jpg"><img title="DSCF1015" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="DSCF1015" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/0602.DSCF1015_thumb_48663415.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/0602.DSCF1015_5F00_thumb_5F00_48663415.jpg" width="644" height="431" /></a></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/8637.DSCF1016_7D069050.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/8637.DSCF1016_5F00_7D069050.jpg"><img title="DSCF1016" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="DSCF1016" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/4667.DSCF1016_thumb_6ABDC98E.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/4667.DSCF1016_5F00_thumb_5F00_6ABDC98E.jpg" width="324" height="484" /></a></p>  <h1>Next Steps</h1>  <p>Now it’s your turn.&#160; Take a look at the <a href="http://www.thingiverse.com/thing:1072550" target="_blank">model I uploaded to Thingiverse</a> – download it, print it out, change it, make it better, make it yours.&#160; What problem (big or small) have you solved with 3D printing?</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/0825.image_43838059.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/0825.image_5F00_43838059.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/1727.image_thumb_45C00915.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/1727.image_5F00_thumb_5F00_45C00915.png" width="644" height="463" /></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Having Fun with the Neon API</title>
      <link>https://docs.microsoft.com/archive/blogs/synergist/having-fun-with-the-neon-api</link>
      <pubDate>Sun, 26 Apr 2015 16:13:23 GMT</pubDate>
      <dc:creator><![CDATA[Synergist]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/synergist/2015/04/26/having-fun-with-the-neon-api/</guid>
      <description><![CDATA[One of the exciting things that got to do at South by Southwest last month in Austin was help with a...]]></description>
      <content:encoded><![CDATA[<p>One of the exciting things that got to do at South by Southwest last month in Austin was help with <a href="http://sxsw.com/music/news/2015/recapping-2015-sxsw-music-hackathon-championship" target="_blank">a hackathon</a> where developers got to experiment with building new music apps and experiences.&nbsp; As part of this hackathon, I helped a newly-independent artist, <a href="http://www.werneon.com/" target="_blank">Neon Hitch</a> release her own API in her own voice and wrote about it <a href="http://blogs.msdn.com/b/synergist/archive/2015/03/18/apis-as-artistic-expression-the-neon-api.aspx" target="_blank">here on this blog</a> and <a href="http://www.billboard.com/articles/columns/music-festivals/6509385/win-butler-neon-hitch-robert-delong-SXSW-Music-Hackathon-winner" target="_blank">Billboard</a> and <a href="http://www.dailycal.org/2015/03/30/on-the-rarity-of-female-influence-at-sxsw-music-hackathon/" target="_blank">The Daily Californian</a> (UC Berkeley) blog wrote about it as well.<p>Since then, Neon Hitch has joined the <a href="http://www.microsoft.com/bizspark/default.aspx" target="_blank">Microsoft BizSpark</a> program which gets her production company and label free software and Azure cloud services.&nbsp; BizSpark is actually great for an independent artist who wants to do something innovative with technology because many musicians fit the BizSpark criteria:</p><ul>   <li>Developing software or apps </li>    <li>Less than 5 years old and privately held </li>    <li>Making less than US$1M annually </li> </ul><p>Because Neon&rsquo;s API is run with <a href="http://azure.microsoft.com/en-us/documentation/services/api-management/" target="_blank">Azure API Management</a>, the cost for her to manage and run the API, is basically $0.&nbsp; Because Neon released an API, new opportunities can open up.&nbsp; Here is one:</p><h1>Kinetic Typography</h1><p>I have had a fascination with Kinetic Typography.&nbsp; Here is one of my favorite examples is <a href="https://www.youtube.com/watch?t=55&amp;v=PbC4gqZGPSY" target="_blank">Ira Glass talking about the creative process</a>:</p><iframe height="315" src="https://www.youtube.com/embed/PbC4gqZGPSY" frameborder="0" width="560" allowfullscreen="allowfullscreen"></iframe><p>I like Kinetic Typography so much, I built an app for Windows to create it.&nbsp; One of the reasons that I created it was to learn about how to use CSS Animations &ndash; it turns out you can do all sorts of things with CSS Animation today in any modern browser.</p><p>Since I released the app last year, I have added <a href="https://soundcloud.com/nasa" target="_blank">audio from NASA</a> and words from some of my favorite poems, <em>Jabberwocky</em> by Lewis Carrol and <em>Ozymandias</em> by Percy Bysshe Shelley.&nbsp; I just released an update to the app which uses the <a href="https://neonhitch.portal.azure-api.net/" target="_blank">Neon API</a> to let her fans create kinetic typography videos with her songs which she released with a <a href="http://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">Creative Commons License</a>.&nbsp; </p><p align="center"><strong>Now make your own Neon Hitch Lyric Videos!</strong></p><p>Get <a href="http://apps.microsoft.com/windows/en-us/app/kinetic-typography/0b49854c-f403-479b-b7f8-3d7dd92f83a2" target="_blank">Kinetic Typography</a> today for Windows 8.1: it&rsquo;s free!</p><p>I&rsquo;d love to see what people create with this &ndash; please <a href="https://www.facebook.com/KineticTypographyApp" target="_blank">post here</a> if you make something cool with Kinetic Typography.</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>APIs as Artistic Expression: the Neon API</title>
      <link>https://docs.microsoft.com/archive/blogs/synergist/apis-as-artistic-expression-the-neon-api</link>
      <pubDate>Wed, 18 Mar 2015 18:37:04 GMT</pubDate>
      <dc:creator><![CDATA[Synergist]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/synergist/2015/03/18/apis-as-artistic-expression-the-neon-api/</guid>
      <description><![CDATA[Musicians take care to craft so many of the ways that they express themselves beyond the music that...]]></description>
      <content:encoded><![CDATA[<p>Musicians take care to craft so many of the ways that they express themselves beyond the music that they release: their outfits, their videos, album covers, the typography used in the liner notes, the palette of the website, the mood of the images, the style of the logos, the tour busses, and most recently their apps.&#160; All of these require attention to detail because these artifacts are the artist’s brand.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/6457.IMG_20150209_214551_489368C8.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/6457.IMG_5F00_20150209_5F00_214551_5F00_489368C8.jpg"><img title="IMG_20150209_214551" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="IMG_20150209_214551" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/2337.IMG_20150209_214551_thumb_186C1E05.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/2337.IMG_5F00_20150209_5F00_214551_5F00_thumb_5F00_186C1E05.jpg" width="209" align="left" height="197" /></a>We have been working recently with an innovative&#160; newly-independent artist, <a href="http://en.wikipedia.org/wiki/Neon_Hitch" target="_blank">Neon Hitch</a> (also on <a href="https://music.xbox.com/artist/neon-hitch/b/1414a410-7629-53f4-8e3b-052f2088a4d9" target="_blank">Xbox Music</a>) to allow her to express herself in an entirely new way: with <strong>her own API</strong>.&#160; Neon owns all the content in the API and will be releasing it on her own interactive label she created called <em><strong>FanLabel</strong></em>.&#160; Neon wanted to engage her fans and now software developers in a new way, in her own voice.&#160; Working side-by-side with her (<a href="https://instagram.com/p/0WFPjJodRR/" target="_blank">best working lunch ever!</a>), our team created an API in her voice using the new <a href="http://azure.microsoft.com/en-us/services/api-management/" target="_blank">Microsoft Azure API Management</a> service.</p>  <p>This API lets app developers “<a href="https://neonhitch.portal.azure-api.net/docs/services/550762048790ee07ec3c1118/operations/550762858790ee07ec3c111a" target="_blank"><em>snatch</em></a>” content including <em>choons</em> (songs), <em>flicks</em> (videos), and <em>fotos</em> (pictures) and lets them mash it up in new creative ways.&#160;&#160; With her songs, Neon wanted to include more metadata than the typical music API might expose, like the “bevy”, “grub”, “hood”, “mood” to make the API hers.&#160; It was a really fun collaboration creating an API that was expressive and a bit cheeky.&#160; Take a look at the <a href="https://neonhitch.portal.azure-api.net/" target="_blank">Neon API portal here</a>. </p>  <p>Neon’s <a href="https://www.youtube.com/watch?v=AcJsBK07kcM" target="_blank">interesting background</a> has given her a unique perspective and her songs have empowered many people, including girls and people in the LBGT community.&#160; Microsoft’s <a href="http://www.microsoft.com/en-us/diversity/default.aspx#fbid=tdyIvystKUk" target="_blank">efforts to include</a> more people in the world of coding and software development, makes a Neon Hitch API a great match with Microsoft’s mission.&#160; Hopefully more of Neon’s fans will try coding first with her API.</p>  <p>Because we used the <strong>Azure API Management</strong> service, Neon was able to design the API with her own terminology as well as monitor usage and have an fully-featured API portal created automatically.&#160; All she needed to do was “Neonize” it.&#160; The API portal has a testing console for each of the Snatch APIs as well as code samples generated in JavaScript, C#, PHP, Ruby, Curl, Java, and Objective C to make it simple to start using the API.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/7345.image_7A8D9A03.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/7345.image_5F00_7A8D9A03.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/7823.image_thumb_6DB5D496.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/7823.image_5F00_thumb_5F00_6DB5D496.png" width="808" height="476" /></a></p>  <p>We released the API today at the <a href="http://sxsw.com/music/hackathon/" target="_blank">South by Southwest Music Hackathon</a> in Austin, Texas and developers have already started their 24-hour hacking marathon using APIs from Neon, Ableton, Kinect for Windows, and more.&#160; We can’t wait to see what developers do with it.&#160; You can start with the Neon API now and sign up for a free <em>Royal</em> key today.</p>  <p align="center"><a title="https://neonhitch.portal.azure-api.net/" href="https://neonhitch.portal.azure-api.net/">https://neonhitch.portal.azure-api.net/</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Using the Multilingual App Toolkit with WPF Applications</title>
      <link>https://docs.microsoft.com/archive/blogs/synergist/using-the-multilingual-app-toolkit-with-wpf-applications</link>
      <pubDate>Thu, 05 Mar 2015 15:46:33 GMT</pubDate>
      <dc:creator><![CDATA[Synergist]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/synergist/2015/03/05/using-the-multilingual-app-toolkit-with-wpf-applications/</guid>
      <description><![CDATA[One of the toolkits available to app developers enabling them to reach new audiences is the...]]></description>
      <content:encoded><![CDATA[<p>One of the toolkits available to app developers enabling them to reach new audiences is the <a href="https://visualstudiogallery.msdn.microsoft.com/5e2a913c-709c-44e6-8b90-a552eede1903">Multilingual App Toolkit</a> (MAT).&#160; Using this toolkit, you can easily add multiple language support to Store apps on Windows 8.1 and Windows Phone 8.1 as well as WPF applications on Windows.&#160; The toolkit can also use the Microsoft Translator Service to automatically translate the string resources in your app to other languages.</p>  <p>I would like to walk you through the process of using the MAT with WPF applications, where the process is slightly different than with Windows Store and Phone apps.</p>  <h1>Prerequisites</h1>  <ol>   <li>Install Microsoft Visual Studio 2013 Update 4 </li>    <li>Install Microsoft Multilingual App Toolkit </li> </ol>  <h1>Start Using MAT with WPF Apps</h1>  <ol>   <li>Open the WPF project in Visual Studio </li>    <li>In the project settings, Application…Assembly Info, set the Neutral Language to your language; I selected <strong>English (United States)</strong> </li>    <li>In the Tools menu, select <strong>Enable Multilingual App Toolkit.</strong>&#160; When you do this, a <strong>Resources.qps-ploc.xlf</strong> file will be automatically added to the project Properties.&#160; This will be used to create “Pseudo” translation.&#160; Pseudo Language is an artificial modification of the software product intended to simulate real language localization. The pseudo language can be used to detect potential localizability issues or bugs early in the project cycle, before the actual localization starts. </li>    <li>In the Solution Explorer, open the Properties…..<strong>Resources.resx</strong> and in the top bar of the editor, change the <strong>Access Modifier</strong> from Internal to <strong>Public</strong> </li>    <li>During the build process, the MAT will automatically update the .xlf files, keeping them in sync.&#160; </li>    <li>When you add new strings to the Resources.resx file, build the project and then right click on .xlf files in the solution explorer and select <strong>Generate machine translations.</strong> </li>    <li>For the strings in Xaml, you should use the x:Static extension to have the strings point to the .resx file:      <br />&lt;Window x:Class=&quot;MultilingualApp.MainWindow&quot;       <br />xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;       <br />xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;       <br /><font style="background-color: #ffff00">xmlns:properties=&quot;clr-namespace:MultilingualApp.Properties&quot;</font>       <br />Height=&quot;350&quot; Width=&quot;525&quot;&gt;       <br />&#160;&#160;&#160; &lt;Grid&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;StackPanel&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;TextBlock       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Text=&quot;<font style="background-color: #ffff00">{x:Static properties:Resources.TranslateMe}</font>&quot;/&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Button       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Content=&quot;{x:Static properties:Resources.PressMe}&quot;/&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/StackPanel&gt;       <br />&#160;&#160;&#160; &lt;/Grid&gt;       <br />&lt;/Window&gt;       <br /></li>    <li>You should use the Resources.resx file for all of the localizable strings in your app. </li>    <li>Add additional languages by right-clicking on the project, and selecting <strong>Add translation languages…</strong> </li>    <li>You can use the Microsoft Translator Service to generate translations or send the .xlf files to translation services as it is in the <a href="https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=xliff" target="_blank">localization industry standard XLIFF file format</a>. </li>    <li>     <p>In addition to language translations, the MAT also use the Microsoft Terminology APIs (Language Portal Provider).&#160; This enables direct access to Microsoft’s product translation memories.&#160; See this article for more details: <a href="http://blogs.msdn.com/b/matdev/archive/2014/07/01/new-version-of-microsoft-terminology-api-launched.aspx">http://blogs.msdn.com/b/matdev/archive/2014/07/01/new-version-of-microsoft-terminology-api-launched.aspx</a></p>   </li> </ol>  <h1>Testing Pseudo Language</h1>  <p>WPF uses the OS language by default so <strong>Thread.CurrentThread.CurrentUICulture</strong> and <strong>Thread.CurrentThread.CurrentCulture</strong> need to be manually set to ‘qps-PLOC’ since it is not a log-in language.&#160; Here is how you can easily do that:</p>  <div>namespace MultilingualApp   <br />{    <br />&#160;&#160;&#160; using System.Diagnostics;    <br />&#160;&#160;&#160; using System.Globalization;    <br />&#160;&#160;&#160; using System.Threading;    <br />&#160;&#160;&#160; using System.Windows;    <br />    <br />/// &lt;summary&gt;    <br />/// Interaction logic for App.xaml    <br />/// &lt;/summary&gt;    <br />public partial class App : Application    <br />{    <br />&#160;&#160;&#160; private CultureInfo cultureOverride = new CultureInfo(&quot;qps-PLOC&quot;);    <br />    <br />&#160;&#160;&#160; public App()    <br />&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (Debugger.IsAttached == true &amp;&amp; cultureOverride != null)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Thread.CurrentThread.CurrentUICulture = cultureOverride;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Thread.CurrentThread.CurrentCulture = cultureOverride;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160; }    <br />}    <br /></div>  <div>You can now see what the Xaml above translated to with the Pseudo translation:    <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/8666.image_0506E7D4.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/8666.image_5F00_0506E7D4.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/3482.image_thumb_01741D1E.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/3482.image_5F00_thumb_5F00_01741D1E.png" width="550" height="366" /></a></div>  <h1>Summary</h1>  <p>The Multilingual App Toolkit along with the Microsoft Translator Service has made a difficult and often expensive process of globalizing and localizing apps easy and straightforward.&#160; Now it is easy to localize WPF application as well as Windows Store and Windows Phone apps.</p>  <h1>Thanks</h1>  <p>Thanks to Cameron Lerum from the MAT team for helping with this article.</p>]]></content:encoded>
    </item>
    <item>
      <title>Xaml Generator – a New App for Office</title>
      <link>https://docs.microsoft.com/archive/blogs/synergist/xaml-generator-a-new-app-for-office</link>
      <pubDate>Tue, 09 Dec 2014 18:39:01 GMT</pubDate>
      <dc:creator><![CDATA[Synergist]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/synergist/2014/12/09/xaml-generator-a-new-app-for-office/</guid>
      <description><![CDATA[A few years ago I build and shared the source code for a Word to Xaml Converter, a Word 2007 add-in...]]></description>
      <content:encoded><![CDATA[<p>A few years ago I build and shared the source code for a <a href="https://wordtoxaml.codeplex.com/">Word to Xaml Converter</a>, a Word 2007 add-in that developers could use to convert Microsoft Office Word documents to Xaml for WPF and Silverlight applications.&#160; Since it was originally published, the solution has been downloaded more than 3,000 times and I’ve received lots of feedback on it, progressively enhancing it to handle more Word features in the Xaml conversion.&#160; I built the converter as a .NET library and a Word COM add-in, both built in C#.&#160; </p>  <h1>Apps for Office</h1>  <p>Now with Office 2013 and Office 365, there is a new development model where developers can build “<a href="http://technet.microsoft.com/en-us/library/jj219429(v=office.15).aspx">Apps for Office</a>” using HTML, CSS, and JavaScript to build apps that can be added to Microsoft Office.&#160; With this, Microsoft also launched an <a href="https://store.office.com/">Apps for Office store</a> where these apps can be listed and sold.&#160; I was able to take what I built earlier as a Word add-in and move it to the cloud with <a href="http://azure.microsoft.com/en-us/services/websites/">Microsoft Azure Websites</a> and listed it in the Apps for Office store.&#160; This enables users of Office 2013 and Office 365 to now use the Xaml Generator in Microsoft Office Word wherever they are seeing it.</p>  <h1>Xaml Generator</h1>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/2654.AppLogo.96x96_15C9C262.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/2654.AppLogo.96x96_5F00_15C9C262.png"><img title="AppLogo.96x96" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px" border="0" alt="AppLogo.96x96" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/5807.AppLogo.96x96_thumb_31021B63.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/5807.AppLogo.96x96_5F00_thumb_5F00_31021B63.png" width="96" align="left" height="96" /></a> </p>  <p>With this new App for Office, you select the text that you want to convert in Microsoft Word and then press the [Generate Xaml] button.&#160; The generated text is then put in the task pane which you can then copy to Visual Studio to use in an app.&#160; With this new release, I added Windows Xaml which can be used for Windows Universal Apps released for Windows 8.1 and Windows Phone 8.1.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/5621.image_48302692.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/5621.image_5F00_48302692.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/0184.image_thumb_302ED6DB.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/0184.image_5F00_thumb_5F00_302ED6DB.png" width="804" height="719" /></a></p>  <p>To use the Xaml Generator in Word 2013</p>  <ol>   <li>Open the Insert tab and press the <strong>Xaml Generator</strong> button or find it in the Store button in the insert tab.&#160; Once you install the app, it should show up as a task pane to the right of the editing workspace.</li>    <li>Select the text that you want to convert in Word.</li>    <li>Choose the <strong>Xaml type</strong> in the drop-down and press the <strong>Generate Xaml</strong> button.&#160; The appropriate Xaml will then be generated and put into the text area.</li>    <li>Press the <strong>Copy to clipboard</strong> button to copy the text in the output window to your clipboard.</li>    <li>Paste the Xaml in your clipboard into Visual Studio or Expression Blend.</li> </ol>  <p><a href="https://store.office.com/xaml-generator-WA104379167.aspx?assetid=WA104379167" target="_blank">Get Xaml Generator here</a>.</p>  <p>I’d loved your feedback on the app as it’s my first <strong>App for Office</strong>.</p>]]></content:encoded>
    </item>
    <item>
      <title>Pausing Video when a Companion Ad is Clicked</title>
      <link>https://docs.microsoft.com/archive/blogs/synergist/pausing-video-when-a-companion-ad-is-clicked</link>
      <pubDate>Mon, 20 Oct 2014 07:43:10 GMT</pubDate>
      <dc:creator><![CDATA[Synergist]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/synergist/2014/10/20/pausing-video-when-a-companion-ad-is-clicked/</guid>
      <description><![CDATA[When building a media app on Windows Phone 8.1, it is very popular for developers to use the...]]></description>
      <content:encoded><![CDATA[<p>When building a media app on Windows Phone 8.1, it is very popular for developers to use the <a href="https://playerframework.codeplex.com/" target="_blank">Microsoft Media Platform Player Framework</a>, and open source media player framework for both Windows and Windows Phone.&#160;&#160; The framework is made up of a number of components which enable developers to include just the component that they need for their media scenario.&#160; One of these components is for pre-roll, mid-roll, and post-roll advertisements – which, when connected to an ad service like FreeWheel, will display video ads at certain times during playback.&#160; One of the options for the advertising component is to display image-based <a href="https://playerframework.codeplex.com/wikipage?title=Companion%20ads" target="_blank">companion ads</a> while a video ad is playing back.&#160; This image can be clicked on to bring a viewer to a web-based landing page for the advertisement.</p>  <p>Working with a partner, we found out that the typical Xaml page navigation events (Page.OnNavigatedTo and Page.OnNavigatedFrom) don’t fire immediately when the user clicks on one of the companion ads on Windows.&#160; This can be problematic if you need to pause the video playback when the user clicks on the ad.&#160; In this case, you need to handle the <a href="http://msdn.microsoft.com/EN-US/library/windows/apps/windows.ui.core.corewindow.visibilitychanged(v=vs.10).aspx" target="_blank">CoreWindow.VisibilityChanged</a> event.&#160; Attach this event on Page.OnNavigatedTo and detach it on the Page.OnNavigatedFrom.&#160; </p>  <pre class="csharpcode"><span class="kwrd">protected</span> <span class="kwrd">override</span> <span class="kwrd">void</span> OnNavigatedTo(NavigationEventArgs e)
{
    <span class="kwrd">base</span>.OnNavigatedTo(e);

    <span class="kwrd">this</span>.navigationHelper.OnNavigatedTo(e);

    CoreWindow.GetForCurrentThread().VisibilityChanged += </pre>

<pre class="csharpcode">        this.OnVisibilityChanged;
}</pre>

<pre class="csharpcode">&#160;</pre>

<pre class="csharpcode"><span class="kwrd">protected</span> <span class="kwrd">override</span> <span class="kwrd">void</span> OnNavigatedFrom(NavigationEventArgs e)
{
    <span class="kwrd">base</span>.OnNavigatedFrom(e);

    CoreWindow.GetForCurrentThread().VisibilityChanged –= </pre>

<pre class="csharpcode">        <span class="kwrd">this</span>.OnVisibilityChanged;
}
</pre>


<p>At that point, the code that you need to call would be something like this:</p>

<pre class="csharpcode"><span class="kwrd">private void</span> OnVisibilityChanged(</pre>

<pre class="csharpcode">    CoreWindow sender, </pre>

<pre class="csharpcode">    VisibilityChangedEventArgs args)
{
    <span class="kwrd">if</span> (args.Visible)
    {
        <span class="kwrd">this</span>.Player.InteractiveViewModel.PlayResume();
    }
    <span class="kwrd">else</span>
    {
        <span class="kwrd">this</span>.Player.InteractiveViewModel.Pause();
    }
}
</pre>


<p>&#160;</p>

<p>As the Player Framework is Open Source, the app developer community is encouraged to download the <a href="https://playerframework.codeplex.com/SourceControl/latest" target="_blank">source code</a>, fork it, and suggestion fixes and enhancements.&#160; The latest source code in the player framework is in the “universal” branch.&#160; </p>]]></content:encoded>
    </item>
    <item>
      <title>Surface Pro 3 + Adobe Photoshop CC 2014</title>
      <link>https://docs.microsoft.com/archive/blogs/synergist/surface-pro-3-adobe-photoshop-cc-2014</link>
      <pubDate>Wed, 08 Oct 2014 09:15:35 GMT</pubDate>
      <dc:creator><![CDATA[Synergist]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/synergist/2014/10/08/surface-pro-3-adobe-photoshop-cc-2014/</guid>
      <description><![CDATA[The past two days, I have had an amazing time helping attendees at the Adobe MAX conference setup...]]></description>
      <content:encoded><![CDATA[<p>The past two days, I have had an amazing time helping attendees at the Adobe MAX conference setup their new <a href="http://www.microsoft.com/surface/en-us/products/surface-pro-3" target="_blank">Microsoft Surface Pro 3</a> tablets.&#160;&#160; For most of the attendees that I had met, this was their first experience with Windows or their first experience with Windows on a tablet.&#160; In partnership with Microsoft, Adobe has been working to make their creative cloud desktop apps work great on the Surface Pro 3 but there are a few things that you can do to make these apps work even better:</p>  <p>Because the Surface Pro 3 has a very high resolution screen (2160 x1440) I have found it useful to adjust both Windows and Photoshop CC 2014 to make the UI text a bit bigger than normal.&#160; If you find the menus and UI text too small to read in Photoshop on the Surface’s screen, here is what you can do to make them bigger:</p>  <h1>Configuring Windows</h1>  <ol>   <li>From the start screen, tap on the Desktop tile, or press the search icon in the upper right and type “desktop” to get to the desktop</li>    <li>With your trackpad, right-click on an empty space on the desktop to see a context menu or tap and hold your finger on the desktop and then pull your finger away from the screen.&#160; <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/2860.image_1F3CFCB9.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/2860.image_5F00_1F3CFCB9.png"><img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/7356.image_thumb_69C6CB44.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/7356.image_5F00_thumb_5F00_69C6CB44.png" width="183" height="193" /></a> </li>    <li>Tap on the <strong>Screen resolution </strong>menu item</li>    <li>In the Screen resolution window, tap on the link <strong>Make text and other items larger or smaller       <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/0830.image_5A26C033.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/0830.image_5F00_5A26C033.png"><img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/2425.image_thumb_7C1222B7.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/2425.image_5F00_thumb_5F00_7C1222B7.png" width="316" height="373" /></a> </strong></li>    <li>In the Display window, move the slider all the way to the right (Larger) and press the Apply button at the bottom of the Window.&#160; You may have to wait a moment while the settings are applied.     <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/7142.image_22740603.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/7142.image_5F00_22740603.png"><img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/6746.image_thumb_445F6887.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/6746.image_5F00_thumb_5F00_445F6887.png" width="427" height="365" /></a>&#160; </li>    <li>Once that is done, press the [x] button in the upper right of the Display window.</li> </ol>  <h1>Configuring Photoshop CC 2014</h1>  <ol>   <li>Press the Windows Key on the keyboard or the right side of the screen to go the start screen</li>    <li>From the start screen, launch Photoshop:</li>    <ol>     <li>Type “photo” and you will see “Adobe Photoshop CC 2014” listed in the search results: tap that or</li>      <li>Swipe up with your finger on the start screen and you will see the full app list – where “Adobe Photoshop CC 2014” is listed</li>   </ol>    <li>Once Photoshop has started, open the preferences dialog from the top menu: Edit…Preferences…Experimental Features…</li>    <li>Check the option to “Scale UI 200% for high-density displays, press OK and restart Photoshop.     <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/6840.image_0D851441.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/6840.image_5F00_0D851441.png"><img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/83/05/metablogapi/0268.image_thumb_3CD689CB.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-83-05-metablogapi/0268.image_5F00_thumb_5F00_3CD689CB.png" width="540" height="247" /></a> </li> </ol>  <p></p>  <p></p>  <p></p>  <h1>Palm-Block Technology</h1>  <p>When writing or drawing on Windows you can rest your palm on the screen once the pen is within range (about 1cm).&#160;&#160; This takes a bit on getting used to but once you have the muscle-memory, drawing with the pressure-sensitive pen gets really fun and intuitive.&#160; </p>  <h1>More Tips and Resources</h1>  <p>As you explore your new Surface, here are some more resources to get acquainted or re-acquainted with Windows:</p>  <ul>   <li><a href="http://windows.microsoft.com/en-us/windows/support#1TC=windows-8" target="_blank">Windows How-To</a></li>    <li><a href="http://www.microsoft.com/surface/en-us/why-surface/for-creating" target="_blank">Surface for Creative Professionals</a></li>    <li><a href="http://surface.com/support" target="_blank">Surface Support</a></li> </ul>]]></content:encoded>
    </item>
  </channel>
</rss>