Switching Project Type Between Windows Runtime Component and (.NET) Class Library

There are times when you might want to switch the type of your library between a Windows Runtime Component and (.NET) Class Library. Why would you do that? There are slight differences between these – a WinRT Component can be used by other assemblies written in any language supported by WinRT – your APIs will be projected to these other languages. A Class Library can only (easily) be used by .NET assemblies, but allows you to have class inheritance. Depending on the realization or change of your requirements then you might decide that you need to change the type of the library you have already created, but how do you do that? Easily. Assuming your code is compliant with the above mentioned limitations you just need to change the value of one XML element in your csproj file between <OutputType>winmdobj</OutputType> and <OutputType>Library</OutputType>.

*EDIT

Silly me, how could I have overlooked it? The project properties panel has an option for switching between Class Library, WinRT Component and Windows Store App!

Switching project types between Class Library, Windows Runtime Component and Windows Store App in Visual Studio

Switching project types between Class Library, Windows Runtime Component and Windows Store App in Visual Studio

How to safely use your time while you build a project?

So your build takes a while… How do you make use of that time (e.g. check Stack Overflow) and not forget to get back to work when the build is done? Well, you can make a sound. I am not sure if there is a simple built-in option to Visual Studio allows to play sounds on events. It is quite possible there is, but I will use what I know. I found you can play a sounds in command line by typing echo ^G, but it didn’t seem to work for me in a VS project post-build step. I blogged about using batch scripts and C# code together in a single file and here’s a way to beep from a batch script:

Continue reading

Tagged , ,

The five minute gauge control for WinRT/XAML

Wow, gauge controls are pretty easy to implement. Why would anyone pay for one? :)

This one took me literally 5 minutes. True, it is just a UserControl and it only shows 0-360 values I needed to debug some compass code, but it’s easy to build on it so I thought I’d share it since all my other blog post ideas need quite a bit more time than 5 minutes… :)

gauges

Continue reading

Tagged , , , ,

Code Snippets – Disable Warning 4014

I use code snippets extensively. I don’t think it makes sense to do without them if you do any XAML work, though what you use them for is actually the code behind where lots of boilerplate code is necessary. My snippets collection consists mostly of modified Dr WPF’s dependency property snippets and various types of observable property snippets. Today I am working on cleaning up some code in WinRT XAML Toolkit and decided a snippet to disable warnings could be helpful, so here it is (also added to my collection on dropbox). Just use the sw shortcut for this Suppress Warning snippet.

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <SnippetTypes>
        <SnippetType>SurroundsWith</SnippetType>
      </SnippetTypes>
      <Shortcut>sw</Shortcut>
      <Title>Suppress Warning</Title>
      <Description>Surrounds with a #pragma warning disable/restore block.</Description>
      <Author>Filip Skakun</Author>
      <HelpUrl>http://xyzzer.wordpress.com</HelpUrl>
    </Header>
    <Snippet>
      <Declarations>
        <Literal>
          <ID>warninglist</ID>
          <ToolTip>Comma separated warning list.</ToolTip>
          <Default>4014</Default>
        </Literal>
      </Declarations>
      <Code Language="csharp">
        <![CDATA[#pragma warning disable $warninglist$
$selected$$end$
#pragma warning restore $warninglist$]]>
      </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>

My Short Opinion About Windows Store Apps

I really like Windows 8. I like the improvements on the desktop side. I like the new start screen better than the old start menu. I like the WinRT technology, design and interactivity of the Windows Store apps. I love the cloud integration of the OS and apps. I believe this is the most user friendly OS for tablets on the WinStore apps side and the most user friendly and powerful OS on the desktop side.

I don’t really use any Windows Store apps though, since I don’t own a Windows 8 tablet and mostly use Windows on a (touch screen) laptop. I think this will be a great platform for games and I believe the AAA titles should and will come out in Windows Store and I will play some of them – perhaps even on my desktop machine since it has better GPU and cooling than my ThinkPad. For the apps on a laptop or desktop machine though – I think the desktop platform is still better. I like my apps in windows, system tray (or as Windows people like to call it – notification area) and I like having all of them on my screen and a consistent taskbar where I see all of them. On the desktop – I like seeing all my 100 open tabs in Chrome, 5 instances of Visual Studio, Outlook, etc. I like that I can play a video in a window and then continue listening to the video (or a webcast) while I move its window behind my Visual Studio window and continue working.

I think things might change – I would love if Microsoft added all the more line of business controls and WPF features to the WinRT platform – such as grid splitters, data grids, tree views etc. I would like to be able to develop windowed applications in WinRT, though I am afraid Microsoft is much more likely to insist on making the full-screen experience more powerful rather than supporting the good old lowercase windows.

I am excited for the future.

Tagged

Layout and Formatting with Windows 8 XAML Development

When designing a user experience, one of the first things you need to figure out is where to position things on the screen, how they should flow when the content changes, and what shape or color they should be. This article is about the tools you have at your disposal with Windows 8 XAML to control layout and formatting on this exciting new platform.

Read more on Safari Books Online

Tagged , ,

Windows 8 Development with XAML and C# – New and Missing Controls

Although the Windows 8 XAML platform brings back a lot of the controls that exist in WPF and Silverlight, and adds some completely new ones, there are some controls that you might find missing and wonder what to do. In this article we cover a list of some of these controls, along with some suggested ways to cope with their loss.

Read more on Safari Books Online

Tagged , , ,

Windows 8 Development with XAML and C# – Controls

User interfaces are usually composed of reusable controls that encapsulate the logic for rendering the view, taking input and manipulating data. Windows 8 XAML has a wide range of such controls and this is a terse overview of these controls that you can use to check if you know them all.

Read more on Safari Books Online

Tagged , , ,

Windows 8 Development with XAML and C# – Introduction

Why develop for Windows 8?

Windows 8 is a platform with high potential. Based on the trends, Windows 8 is expected to run on half a billion devices within a year or two. Since previous versions of Windows are already running on over a billion machines today, and upgrading from any existing version will cost a mere $15 to $40 – this is just a deal that is hard to miss. Windows 8 is every bit as stable and incrementally improved in its desktop flavor, but it also has a new and exciting part in its touch-centric start screen and app store support.

Read more on Safari Books Online

Tagged , , ,

WPF/Silverlight vs. Jupiter Quirks – Opacity

Have you noticed the difference in how the Opacity property is handled by child elements the Windows 8 XAML vs. Silverlight or WPF?

Silverlight/WPF:

Windows 8 XAML (Jupiter):

Continue reading

Tagged , , , , ,
Follow

Get every new post delivered to your Inbox.