Zayko in the Net

Personal blog of Vitaly Zayko

NAVIGATION - SEARCH

Adding /r/n in .NET (C#)

When your App outputs some text, you probably will want to split your strings by adding carriage return. Of course, you can declare this as a constant string: private const string CRLF = "/r/n";

or use predefined constant from Environment: Environment.NewLine

Using Windows 7 Jump List in Visual Studio 2010 Beta 2

If you are on Windows 7, you probably have noticed about new feature – Windows 7 Jump List. If you right-click on an App icon (let say – Internet Explorer) you will see additional menu items which you as a programmer can handle in your solutions. If you are on Visual Studio 2008, the only way is to use an additional Windows API Code Pack for Microsoft .NET Framework. But there is a modern way for Visual Studio 2010 (at least for WPF):

  • Open App.xaml file of your App
  • Add reference to JumpList as shown below:

<Application x:Class="WpfApplication1.App"

             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

             StartupUri="MainWindow.xaml">

    <Application.Resources>    

    </Application.Resources>

    <!-- Add reference to JumpList here: -->

    <JumpList.JumpList>

        <JumpList ShowFrequentCategory="True" ShowRecentCategory="True">

            <JumpTask Title="Notepad"

                      Description="Open Notepad"

                      ApplicationPath="notepad.exe"

                      IconResourcePath="notepad.exe"/>

        </JumpList>

    </JumpList.JumpList>

</Application>

Technorati Tags: ,,