DCSIMG
August 2009 - Posts - public: class Alon : IArchitect, IAzure, ICPP, ISmartHome, IHomeServer

Syndication

August 2009 - Posts

Windows 7 introduces a new Windows Ribbon framework, a framework that enables creating of a modern rich user interface and user experience based on the Office 2007 fluent UI concepts. The Windows Ribbon framework adopted the Model-View-Controller pattern. The UI is written using XAML like language, the controller is a COM based code and the Model is your business logic.  To enable developing the Ribbon markup we have created the Ribbon Explorer program.  These are the feature of Ribbon Explorer:

  • Read a Ribbon markup file which its full path is provided in the first argument of the command line.
  • Enable editing of the supply XML file, or a new XML file
  • Show the Ribbon XML, in an editor
  • Open/Save/Close of Ribbon XML file
  • Compile the XML file into a Dynamic Library that contains the Ribbon resources
  • Show the compilation output text in a read only text window (Tab)
  • Show the resulting resource file text in a read only text window (Tab)
  • Show the resulting header file text in a read only text window (Tab)
  • Load the result Dynamic Link Library and show the Ribbon
  • Display a Ribbon for managing the created Ribbon
  • Set the various Application Modes
  • Show the various popup menus and mini-toolbars
  • Show the various contextual tabs
  • Invalidate a property of a Ribbon command
  • Set directly a property of a Ribbon command
  • Change Ribbon Colors
  • Save & Load the Ribbon (QAT/Minimized) state
  • Display the Ribbon callback method calls and the property key/property variant values ( partially implemented )
  •  

    The new features in this release are:

    • Compatible with the Windows 7 RTM
    • Invalidating/Setting a state/value/property/all properties of a Ribbon command
    • Changing the Ribbon colors
    • Save/Load Ribbon state

     

    Playing with the Ribbon color is cool:

    image

     

    The strongest feature is the support of changing control properties of the Ribbon. You do that using the “Invalidate 7 Set” Tab. You can “Invalidate” the control just to see the current state:

    image

     

    image

    Select the Command, then select the Property (In our case the UI_PKEY_LargeImage) and then press the “Invalidate Property”.

    The result is:

    image

     

    Now, let’s try to change a value, for example to change the text of a button, tooltip and tooltip description. For that we select the “Set Values On Invalidate”, and set a text value in the “Set String Value”. To leave the control in its Enable state we need also to select the “Set boolean Value” and then press on the “Invalidate All Properties”:

    image

    image

     

    Go and try it here.

    Moving applications to new platform is not an easy decision to make. Sometimes you have no choice, new desktops and laptops run the new operating system and you have to support your clients. Sometimes you do have a choice, you install your application with the system and you can choose the operating system that your code will run on. There are two factors in this dilemma: first is the investment effort on making the application compatible with the new O/S comparing to the benefit (ROI). Second is that the application will probably need to continue running on the old operating system. In the case of Windows 7, if you have moved to Windows Vista, compatibility is almost not an issue, but if your application is still running on Windows XP than you have to invest a little to move it to the new platform. To help you moving to a new platform Microsoft DPE has contracted us (Sela) to develop Compatibility Labs (Part of the Windows 7 Training kit) that guide you through the common compatibility issues that you may encounter moving your application from Windows XP to Windows 7. The labs provide two levels of information on each of the problems. The first level is based on few slides that describe the problem and the way to solve it, and a deeper level that gives you much more details as well as a code sample of the problem and the solution, both in native (C++) code and managed (C#) code.

    So, you have moved your application and it now can run on both platforms, now it is the time to make it Windows 7 friendly. Here you have another dilemma, most of the new features are Windows 7 only features, some are Vista based and other will be downgrade also to Windows XP. If you will use a Windows 7 only feature, your application will not run on Windows XP.

    To solve this problem I like to divide the new features to two groups. The first group is the group of features that you based your application core implementation on. For example, if you decide to use the .NET framework 3.0 as your runtime, you cannot install your application on Windows 2000. For the most of us, this is not an issue, for others it is a show stopper. So if you need I/O priority and Transactional File System for your application implementation, you need Windows NT 6.0 (Vista, Server 2008) as your minimum bar. In 4-5 years, for most of us it may be not an issue.

    The second group is the group of features that make your application shines on the new platform, or at least looks new and modern like the new platform does. For Windows 7, the Ribbon, the Taskbar, Multi-touch support and Restart Manager are good samples of such features. With good design you can add these features to your application as add-ons making it compatible to Windows XP and great on Windows 7.

    To learn how to use these new features we have made with Redmond DPE two projects. The first one is the Windows 7 Training Kit it contains slides, demos and Hands on Labs for the new Windows 7 features. You will find .NET (C#) labs and demos as well as many native (C++) labs and demos. If you have downloaded the RC Kit in the past, download again. We have added new labs for the RTM.

    The second way to learn how to use new features in Windows NT 6.0 and Windows NT 6.1 is to download the XP2Win7 project. The project is still in its beta phase and we are working hard to fix bugs, simplify it and add some more features. XP2Win7 is an application that can be installed and runs on 9 different platforms (only 8 have been tested). The platforms are Windows XP, Windows Vista x86, Windows Vista x64, Windows Vista WOW 64 (x86 on x64 machine), Windows 7 x86, Windows 7 x64 and Windows 7 WOW64. Of course it should run also on the server platforms, but we have not tested this scenario.

    When you install the application on Windows XP, you get a simple picture album viewer. Installing it on Windows vista enables new features such as Aero Glass, Restart Manager, NT service is moved to be a Scheduler Task, A preview handler for the album is installed, Transactional NTFS is used with SQL server. Moving to Windows 7 enables another set of features such as Shell Library support, Taskbar integration, Multi-touch, Sensor and Location and Trigger Start Service.

    The installation kit also installs the source code. To build the application you need Windows 7, Visual Studio 2008 SP1, Windows 7 SDK (most of the code is managed and can be built and “single-step debug” without the need for the SDK). To build the native x64 project you need to install the x64 compiler tools that are not installed by default by the VS 2008 setup program. To run the application you also need SQL Server express edition. We are planning to lower the bar and remove the SQL Server dependency from the code. So if you want to see how to do a distributed transaction of TxNTFS and SQL Server, download the beta code, it will not be there in the release.

    This is also the place to thanks Yochay Kiriaty from Redmond DPE that gave us the chance to be part of such great projects and to David Bassa the CEO of Sela that made it possible. Also thanks to Dima Zurbalev, Sasha Goldshtein, and Noam Sheffer that spent (and still) nights (daytime at Redmond) and days in the last few months and to Josh Reuben, Ariel Ben Horesh, Ram Dayan, Konstantin Triger, Tomer Shamam and Pavel Yosifovich that also took part in the projects.

    Stay tune, more projects are coming!

    I have finished a Windows Internal course this week at Taldor. Windows Internal is a very special course. Usually when you go to a course, you know what the direct benefit is. You go to C# course; you will learn how to code in C#. You go to WPF, you … got the point. When you take the Windows Internal course, you just become better Windows user, Administrator and Programmer. After the course you have the feeling that you know the system. You know how it is built; you know what's going inside the machine. Teaching the course is also fun; you open the student's eyes. In the last course I told my students that in the Windows XP era it was very easy to get a dump from a buggy process. The dear Dr. Watson was there for us, but bow with Windows Error Report, it is a little bit more complicated. You have to set WER to send the report and Dumps to a share folder… I was totally wrong. Windows Error Report has a registry entry that allows you to set a folder that will have all the dumps, just like Dr. Watson used to do, or even better. You can set the dump type, the maximum dump files and even a settings per application.
    This is a global setting that I have added in my machine:

     image

     

    The new GFlags.exe (Part of Debugging Tools for Windows) has a special tab to help you manipulate these settings:

     image

    Have a fun debugging!

    In these days I am finishing writing the second chapter of two in a book about Windows 7 Development. I have joined the other authors of the book to assist and I am writing about developing the Windows Ribbon. The first chapter deals with the XAML language of the native Ribbon, while the second chapter deals with the code behind. The first chapter is already went to the editor. About couple of days ago, I have got a mail from the editor that says that other writers found some differences between the Windows RC version and the RTM. Since I have many screen shots of the Ribbon, I have checked to see if I have to retaken them. What I have found is that not only I have to take some of the screen shots, I have need to change some of the text also. Here is a screen shot of WordPad from the RC and the RTM. If you look carefully you find some tiny changes.

     

    RC:

    image

    RTM:

    image

     

    You find two new Buttons, and you also find that the Dialog Launcher has disappeared.

    Comparing the UICC.XSD file, which is the schema for the Ribbon language reveals that the DialogLauncher control is gone:

    image

     

    This is the only change in the schema. Now I have to go and remove all the places in the first chapter that describes this control.