Andrej Tozon's blog

In the Attic

NAVIGATION - SEARCH

Coke-pod

What do you get when you mix apple and coke? Music on the Coke side of life, of course...

music 

Psst! The secret to getting one of these babies is some luck and plenty of thirst. Or vice-versa...

Event handlers and VS2008-B2 WPF designer

Not being able to easily create event handlers for controls' events in Visual Studio's WPF designer posed as a potential turn off and a show stopper for less experienced developers, trying out the early bits of different incarnations of WPF designers. Beta 2 of Visual Studio 2008 (pka "Orcas") adds significant improvement with this issue: to begin with - double clicking on user control in the designer will create the default event handler for that control, as we're used with Windows Forms. Adding other event handlers is done through XAML part of the designer:

Adding event handler

Selecting <New Event Handler> in the above example would create the following code:

private void textBox1_TextChanged(object sender, TextChangedEventArgs e)
{

}

And to later navigate to that event handler, there's a context menu navigation option right under your fingers:

Context menu

The best part is that event handler creation isn't limited to single (selected) event handler. If you're starting with pre-created XAML file, and event handler names are already there, but without any generated code, just select all necessary controls and choose "Navigate to Event Handler" from the context menu and all missing handlers will be created for you. Without the actual implementation, of course; this one is still up to you :)

Your files under command

After four Betas and five RC's Total Commander 7.0 is finally out. This Norton Commander Windows "Clone" is the single piece of software I started using on Windows 3.1 some 13 years ago and still continue to use on a daily basis! It's the reason I never really got used to Windows Explorer and feel somewhat lost when I'm working on computers without TC installed.

New version include Windows Vista support, nicer look, and a lot of enhancements in nearly every feature that TC covers. Having said that, TC gives me a powerful file manager, FTP client (now with SSL option), folder synchronizer, archive files (un)packer and efficient file content viewer (with plugin support for a lot of different file formats). And I can carry it with me on my USB drive.

Microsoft &quot;Acropolis&quot;

If you're on a look for a powerful, extensible application framework for building service-oriented, rich WPF applications, here's a preview of what you can expect from Microsoft in (possibly near) future: Microsoft Code Name "Acropolis" CTP1.

[Taken from the help file] Microsoft Code Name "Acropolis" is a toolkit for creating modular, business-focused Windows client applications. "Acropolis" builds on the.NET Framework, and includes a run-time framework, design-time tools, and out-of-the-box functionality. "Acropolis" enables you to build reusable, connectable components and assemble them into working applications that are easy to change.

If you're familiar with Composite UI Application Block or Smart Client Software Factory, you'll feel right at home. Provided samples include Notepad, Outlook-styled application, a Portal (pluggable parts - interesting!) and RSS Reader. You'll need Visual Studio 2008 ("Orcas") to run those, and if you're ready to start from scratch, there are a couple of templates to start from:Acropolis Templates

... and the Acropolis Application Wizard will take it from there:

Acropolis application wizard

Certainly worth checking out...

[Update: read and watch more about "Acropolis" on its home page, hosted on windowsclient.net, a new community site, which replaced old www.windowsforms.net]

't was a Live Beta Day

Three Live Betas rolled out yesterday:

Windows Live Writer Beta 2 shows qute some progress. I like the new, "Live" look, including semi-transparent splash screen. Many new features include table editing, link glossary, better pasting, plug-in management (Insert Messenger Quote plugin appears to continue working with this beta).

Windows Live Messenger 8.5 Beta, on the other hand, seems to bring mostly UI enhancements (again). The good news is that future WLM Updates will be rolled out through Windows Update

There's also Windows Live Mail Beta 2, which I haven't tried yet, but its UI looks in sync with the other two.

Client Application Services - NTK2007 Sample

Attached to this post is the CAS sample I've been presenting on NTK2007, translated to English. Here's couple of notes about setting it up and taking it further:

1. The ("Orcas") solution contains two projects: ClientServices is a web project, serving CAS to the Windows Forms Client (ClientApplication).

2. ClientServices web project doesn't include the Membership database, you'll have to create your own [Visual Studio can create one for you automatically]. With the provided Configuration web tool, set up as many users as you like and create at least two roles: Administrator and PowerUser. Don't forget to switch to Forms authentication.

3. With ClientServices web project set up, configure ClientApplication to use the service. There's a new configuration tab called Services in ClientApplication properties pages. Point all the addresses to the address ClientServices is listening on.

This should get you going... A couple of things to note:

1. Checking the "Remember me" checkbox on the Login dialog acts the same as you'd expect from a web application - the application will automatically log you in on the next run. Log out button will clear this state and force you to enter your credentials manually again.

2. When a user, logging in, is in "Administrator" role, main form's title will reflect that:

Similarly, when a user, not in PowerUser role, clicks the "Say Hello" button, she will get a "No permission" message. This example is showing off declarative code access security.

By default, roles are set up to be cached for 1 day, which means that adding or removing a user from particular role won't have immediate effect on how application handles this role. To change this setting, click on the "Advanced" button on Service's tab:

... just be careful - setting the Role service cache timeout to 0 means that your application will call the service each and every time it needs to check whether current user is in specific role, either demanded imperatively or declaratively.

3. When you declare new profile properties in your profile service, you'll be able to use those as your application properties; just select Load Web Settings on the Settings tab to get them to your client application.

The fun part is that you can bind these properties to your user controls as you were used to with VS2005 applications, except that settings won't be read/written to your local configuration files, but rather to your remote, centralized profile/settings store.

As you can see from the enclosed sample, there's very little code that had to be written for all this to work.

Download the sample code.

Also see some of my previous posts on CAS:

Client Application Services in Windows Forms - The Walkthrough

I was just about to record my first screencast on Client Application Services I was presenting a week ago on local NT Konferenca, when this post popped up in my feeds aggregator - Karl Erickson posted a CAS Walkthrough document, overviewing CAS features, coming with Visual Studio "Orcas".

I started playing with CAS a couple of months ago, when there were virtually no documentation available on this subject, and I'm glad these cool little services are beginning to get a little more attention.

Anyway, if you want to see my screencast anyway, or are just looking for some additional sample code on Client Application Services, post a comment here. I'll be posting my presentation's sample code on my blog shortly.

NTK2007 sessions materials

I'm posting materials from my sessions on this year's NT konferenca:

Windows Forms, Windows Presentation Foundation and... Visual Basic 6? Hands-On-Lab: Powerpoint | Sample code | Step-By-Step Manual

Notes: Northwind data files are not included, NORTHWND.MDF and NORTHWND_log.LDF, placed in this zipped download just serve as placeholders. The code samples were created with Visual Studio "Orcas" and VB6.

Visual Studio "Orcas": What's new with Smart Client Development: Powerpoint

NTK2007

This year's NT Konferenca, starting next week, is kind of anniversary event for me - it's the 10th time I'm attending this conference, 5th time as a speaker, 1st as an MVP...

For the content I'm presenting... If you're interested in meeting with the new VS "Orcas" Beta 1 in person or just want to shake hands with your old friend VB6, you're invited to my "WF, WPF and... VB6?" Hands-On-Lab session on Tuesday. You'll have a chance to run Orcas and VB6 side-by-side, compare their performances, and possibly even learn something about how you can mix and interop Windows Forms, Windows Presentation and VB6 applications [which is something you may consider if you're planning to upgrade or enhance your existing applications with better technology].

My talk on Wednesday will focus on some of the new features regarding Smart Client development, coming with Orcas and .NET Framework 3.5: I'll talk about Client Application Services, SQL Server Compact Edition,  ADO.NET Synchronization Services [in my opinion, this is one of the features we're all going to love and use frequently], and more.

Although this year's conference was shortened to 3 days only, this doesn't show on the content - the sessions look fresh and interesting.

Enjoy the conference and I hope to see you there.