Direct Download links for Windows 7 Beta

full speed … i use orbit

Thanks for your interest in the Windows 7 Beta. The volume has been phenomenal—we're in the process of adding more servers to handle the demand. We're sorry for the delay and we'll re-post the Beta as soon as we can ensure a quality download experience.

Download Windows 7 Beta (x86)

Download Windows 7 Beta (x64)

for a key access this links

https://www.microsoft.com/betaexperience/productkeys/win7-32/enus/default.aspx

https://www.microsoft.com/betaexperience/productkeys/win7-64/enus/default.aspx

you’ll need to have a live passport.

Windows 7 Imagination by Gigacore

NWindows 7 V3 Visual Style for Windows XP


Windows_7_V3_by_Vher528

This Visual Style is based on SevenVG by Vishal Gupta.

Download Theme | by ~Vher528

New Windows 7 Logon for Windows XP

Windows_7_Logon_by_Zotus

This logon is based on the Win 7 wallpaper by ~nyolc8.

Download logon | by zotus

New Windows 7 new login wallpaper

Windows 7 (1)

click on the image for the 1600x1000 px version. it’s not resized. it’s the real deal.

Windows 7 and a Grab Bag of Microsoftness Before FY10Q1 Results

October 22nd 2009. Windows 7. The circle is now complete.

What is Windows 7? There's a lot that Windows 7 is (oh, it's faster, it has an improved task bar, peeking, snapping, homegroupin', stable drivers and some pretty freaky desktop pictures) but the big thing that it isn't is that Windows 7 is not Vista. It didn't suffer Vista's raging dysfunctional mismanagement and broken windows. It didn't require a reset. Sure, it wasn't perfect and there's a lot of improvements yet to be made in focus and team productivity, but the Windows team delivered. So toot that damn horn, because this here train is arriving on time.

With FY10Q1 announcements coming this week and along with Windows 7, I hope we have a lot of good things to talk about with the analysts. Google and Apple and Yahoo! certainly did. Usually we release our quarterly earnings on the appropriate Thursday afternoon, after closing. It is unfortunately disturbing that we've decided to release our FY10Q1 earning results instead on this Friday morning before trading. I say disturbing only because the last time we did this, a whole bunch of Microsofties were pulled into a layoff. Now... hopefully this earnings report is delayed so that we can have this Thursday the 22nd be all about Windows 7 and not our financials. And I can not imagine that we (and by "we" I mean the Microsoft Senior Leadership Team) would be so dumb as to release our flagship product on a Thursday and turn around and fire a bunch of people the next day.

So, anyway, what's in the mix as the financials come up this week?

Windows 7: check. Thank goodness for SteveSi. I certainly hope he gets paid a lot more than Robbie Bach this year.

Within the Windows 7 reviews, there's going to be a point-of-view that the operating system is dead, which is, ah, kinda dumb. Your web browser isn't going to bootstrap that Intel CPU on its own. What might be dead is rich applications, which is a fair argument and Microsoft is failing to provide much in the way of new rich applications. In fact, we are cutting them one by one (Money, Encarta... Streets, you best watch your back). Sure, there's a transformation to online replicated services and all, but we really need to convince our consumers that there is a strong worth in having a Windows 7 on your laptop so that it's not a fancy glowy brick when the internet is down.

Kindle? Wouldn't it be sweet if we had a nice ebook reader application? We could call it... mmm, Reader?

Windows Live is supposed to help with building value via rich applications. Live has been broken out of Windows to free it from the consent decree and all ('cept for sneaking a Win7 component out early, wink-wink). Messenger, Mail, Photos, Movies, and an awkward online service. And Live Writer (though rumored a dead-man walking per comments).

It's a fair start, and if I had my druthers OneNote would move out of Office and into Windows Live to be the essential authoring companion to the Windows experience. Windows Live Essentials is a good start, but to add some joy into owning a Windows machine, what we need just as urgently is Windows Live Non-Essentials.

Joy. There's a concept just asking for a planning pillar. How strangely would your coworkers look at you during spec reviews if you asked how joyful the feature happened to be?

Windows 8: speaking of planning! The Sinofskyfication of Windows continues, along with alignment around his good lieutenants.

Office: hey, hey, hey, there's a Beta on the way. The Office train lost its conductor but it mostly seems to be still on track. Though trust me: Office wants its Steven back. Bad.

Mobile: Holy. Crap. I don't think we have any unbruised skin left on our body to take any more lumps regarding our mobile strategy. The Microsoft Mismanagement theory is in full force as we throw any willing body into the Mobile effort. Something good has to come out of those typing monkeys, rights? Windows Mobile Phone 6.5 or whatever the hell it's called didn't win any "Wows" and I discovered 1:1 the worst question to ask is, "So, can I upgrade it to Windows Phone 7?"

Look. Let's talk about device loyalty. I first started with owning PocketPCs. An HP Jornada. I loved it. When upgrade time came, HP had bought Compaq and abandoned the Jornada for the iPAQ (what, they had the iThing first?). So, unable to upgrade to the next CE, I cursed a little and bought one of those iPAQs. But HP decided not to allow it to be upgraded. So I switched to Dell to get their latest Axim PocketPC. Dell would be a safe bet, right? And Dell gave up on the line. My latest act of company loyalty: getting a powerful HTC WinMo 6 device. It was cut-off the 6.5 train, and soon, I'm going to be buying a new phone.

And I'm going to buy an iPhone.

I hate it. I hate to think that I'll be installing Apple software on one of my computers because their PC software is so inelegant and buggy (check Watson). I hate that I've been so loyal to the PocketPC platform and Windows Mobile but I've finally had my chain yanked for the last time. I'm not buying a 6.5 device only to have it abandoned when 7 comes out. Microsoft is doing nothing to convince me that it's going to get any better. We suffer through rumors that Pink is imploding and issues with Sidekick data doing disappearing acts while our CEO has conniption fits over Microsofties sporting iPhones. Dude, this is why.

In this case, Microsoft is going to have to earn me back and convince that not only do they have a better experience and better quality phone but that they also won't kick me off to the side of the road when a new release comes along, spinning a sad tale that the carriers make all the decisions.

Dev Div: If I had to sit down tomorrow and write a casual application for the PC, my mind would fork itself in about five different directions. Native with ATL? WPF? Silverlight? An HTA? And what's up with XNA? If I want to write an app for the Zune (which Zune?) what do I do? And can it run on some future mobile device? And the PC? And Xbox?

And how do I share it? How do I sell it? And, ah, crap, you mean you just released a whole new version of C# / Silverlight / XNA that I have to go and relearn? Maybe those free Starbucks coffee dispensers wasn't a good idea...

If anything, I'd probably be pretty damn tempted to invest time learning Adobe AIR. And I'm thinking that while smack dab in the middle of the Microsoft bubble. There are a lot of Partners in Dev Div, and I'm not seeing any benefit from their concentration. The Windows client should be the premiere development platform. It's not. What am I missing?

Are We There Yet? Are the layoffs over? Has Microsoft stabilized? Of course, I'd be satisfied with another 10,000 or more positions being eliminated. But I want it done in one fell swoop, like all the conventional wisdom out there dictates, so that the remaining work force can align itself and get to work and not constantly worry if their group is next. If we're going to continue this quarterly rhythm of maybe-layoffs, maybe-not then morale is going to get seriously poisoned. Let's finish this round and call it done.

Ballmer: well, Mr. Ballmer, if you ever wanted to leave on a high-note, this is it. I'm frustrated because when you hear Steve 1:1 you know that he gets it. He knows some key strategies and things that need to get done. But then Yahoo! happens. Vista happens. Over-exuberant hiring happens. Layoffs happen to shed off the over-hiring. And a flat stock price happens. So something is seriously not connecting between (a) when you hear Steve talking and (b) when he makes major decisions. Hmm. Maybe it's something about guys named Steve having localized reality distortion fields.

This week, as we celebrate Windows 7, you do see an undercurrent of knife-sharpening while examining Mr. Ballmer.

The biggest question still out there: just who would you replace Ballmer with? If a shareholder revolt was to actually happen (shyeah, right) who would be the right choice to lead Microsoft? There is no heir apparent. And no obvious motivation to find one. But wait. Maybe, just maybe... you know, we'll have to wait and see and discover if Steven Sinofsky's upcoming book One Strategy! has a chapter on 'How To Become the CEO of a 100,000 Employee Company' (hopefully followed by the chapter 'More With Less - How To Transform a 100,000 Employee Company Into a 70,000 Employee Company').

Any fireworks you're expecting this week of Windows 7 and Quarterly results?

Microsoft Layoff 2009 Completes Last Milestone and Ships!

With today's 800 Microsoft layoffs, Microsoft Layoff 2009 has reached its final milestone and shipped, exceeded expectations of 5,000 with 5,800 reduced positions.

Err... yay?

Last week during the Town Hall Mr. Ballmer confirmed there would be one more iteration on the layoffs. And after that? Who knows. More to come? Maybe. Booga booga!

You know, we have people working for Microsoft (or, at least did, I don't know, maybe no longer) responsible for driving executive leadership education and growth at Microsoft. This is their friggin' job. Develop Microsoft Leadership at the executive and L68+ levels. So, has anyone hemmed and hawed in-front of Mr. Ballmer and mentioned that this nickel and diming layoff approach is at the worst case end of the layoff management scale?

The looming threat of continuing RIFs and layoffs indicates that Microsoft is just too big for its leadership. It is beyond their capabilities to wrap their minds around everything Microsoft is doing. It has gotten away from them. What needs to go? Hell, I don't know even what all these people do, and you want to decide who stays and goes?

Yes.

Cut deep. Cut once. Get on with it and say, "We're done. We have aligned our company to be efficient and effective within this new global economic climate and are ready to focus on returning to profits and market share growth."

Done.

Coverage I've noticed today on the outside:

On Don Dodge:

And, bummers for me given that she interviewed me for Microspotting, Ms. Ariel Stallings tweet about being caught up in this layoff round.

Coverage from the inside? No email. Quiet. Quite dysfunctional. There was something linked off of the MSW site and it also had a FAQ document that had to be one of the worse FAQs I've ever read. There is an "A" portion to an FAQ and in this case some of the questions were great but the answers looked like they were generated from some sort of English obfuscation Perl script 3rd place prize winner.

So, I'm going through about sixty comments now on the older post. I think it was necessary for Microsoft to have layoffs due to the mismanaged growth and lack of focus and direction our Senior Leadership Team has given us. But it should have been twice as much, done all at once. Now we dither.

Were you affected by the layoff or know someone who was? I'd be interested in knowing which groups and organizations are affected.

FY10Q2 Results - Microsoft

Time for another Microsoft earning announcement. I'm going to be missing you, Mr. Liddell, and your New Zealand accent. With so many tech companies reporting good numbers and with Windows 7's success, I dare say that we're expecting a rosy quarterly earning report. And, if that's the case and knowing Mr. Ballmer's past record, he'll say something financially scary soon to rain on the parade.

Places I track for news on earnings include:

What questions do you expect or would you like to come up during the call? And if they don't come up during the conversation with the analysts, what Q&A do you want to send Mr. Ballmer's way during our upcoming Town Hall meeting?

  • Windows 7 continued success: how does that turn into profits and what kind of projections are we looking at?
  • Entertainment and Devices re-org: how does that align for future success and avoidance of being one big huge money pit?
  • Windows Mobile 7: we so dropped the ball in our early phone OS presence that now it seems like it's a losing battle to have a dog in this fight. But WinMo7 is out there. To me, I can imagine this becoming like the Zune HD: well praised and all, but not making a dent in the market because everyone has already moved on to the iPhone platform.
  • Bing: % of market share on track?
  • Efficiency: are back to our "we always fire the bottom 10% every review cycle" line of B.S. or are RIFs and layoffs still in effect? Given that the tech market at least seems to be turning around with-respect-to hiring (at least looking at the internal openings in Microsoft and how often I get pinged by recruiters), does Microsoft need to close down on the layoffs loudly and publically for both morale and recruitment's sake?
  • iPad iPad iPad! So what, the techie echo-chamber screams for the iPad? I'll be quiet happy with my Kindle for now, just because I do need it for lots of book reading vs. momentary goofing around with apps and browsing. Still, it does extend Apple's reach into the Windows market. What 'cha gonna do about that, Microsoft? How come you never thought of something like this? Or a book reader? You had what and what? Wow...
  • Ballmer: seems as though people are questioning Mr. Ballmer's continued CEO-ship. How much longer did he say he's in for being CEO?

Going back to the layoffs: first of all, this round does need to wrap up by end of FY10. The stress of possible layoffs will continue to have a negative effects on Microsoft, let alone recruiting. We should have one last big flush and then call ourselves done. I'm tired of the layoff rumors as much as anyone else. Probably more so, given the comment fear-mongering. To paraphrase a commenter here: Mini-Microsoft has correctly predicted 12 of the last 3 layoffs.

One commenter made a good point in that it is going to take a while to work through the fat, though, because Microsoft dug itself into such a deep, undisciplined hole that when layoffs were needed, no one knew how or where to start and certainly didn't realize how bad it had become.

(later...)

Thanks to the deferral $s, it was a break-out quarter. Some follow-ups:

Clearing the Air On the SSL Issue

Much has been made recently of ZDNet’s so-called “expose” (really a smear piece) about our software. And one of the most disturbing accusations is that we were exposing user data by having our tracker agent communicate over the unsecured TCP Port 80. As evidence, ZDNet blogger Jason Perlow offered up network traffic sniffer data showing our client communicating in the open and without encryption.

After an extensive investigation on our end, we have concluded that the use of Port 80 by the ZDNet client was an isolated incident, the result of a registration script error on our end. Simply put, we were not prepared for the sudden disappearance of our co-branding partner, InfoWorld (ZDNet registered with us the same day that IDG pulled the plug), or their normal registration process, which they controlled. As a result, when ZDNet registered its test VM with us, they were inadvertently redirected to an old test version of the script and it input the incorrect values for the ASPScriptPort and ASPScriptProtocol fields in our console configuration table.

Note: Other clients that were connected at the time were indeed communicating over SSL/Port 443. In fact, if ZDNet bothered to check back now they’d find that the agent now defaults to this mode for all future connections.

Much has also been made about our SSL certificate, which expired in September. To this accusation we have no response other than to say that we screwed-up. It was on our to do list and we missed the reminder notices from our issuer. Fortunately, our client agent is configured to ignore certificate errors when dealing with our server - a precaution we built in when a malformed certificate tripped us up several years back. So while the certificate may have been invalid, our client agents were still capable of connecting to the server using an SSL-secured connection. Regardless, we will be renewing the certificate shortly.

Bottom Line: The DMS Clarity Metrics Tracker agent is an SSL-secured program that does not expose user’s data – when properly configured. Obviously, the events of this past weekend – specifically, the sudden removal of the Windows Sentinel code from InfoWorld’s web site (an act that was in violation of our hosting contract with IDG) – caused a few ruffles in what had heretofore been a fully secure service with an unblemished operating record spanning nearly four years.

But we don’t expect Mr. Perlow and his hired hit-cronies at ZDNet to pay any attention to above disclosure or how it might explain their “alarming” experiences with our agent. They have their marching orders, and all signs point to Redmond as the real impetus behind the whole sordid affair.

Make no mistake: Online IT Journalism is dead, folks, the victim of greed, bias and an unquenchable thirst for page views…

RCK

Data-Tier Applications in SQL Server 2008 R2

Here discussed some of the new multi-server management capabilities in SQL Server 2008 R2. One of the new features I conspicuously side-stepped covering in that post is the concept of a data-tier application – and that’s what I want to describe in this post.

Data-tier applications provide a useful way to encapsulate all of the logical and physical components of an application that need to be deployed and managed as a unit on a SQL Server instance. For example, consider a typical business application. It probably consists of a number of tiers, including a presentation tier (which might be a Windows Form application or an ASP.NET Web application), a middle-tier (for example a library of .NET assemblies that provide objects to manage the business logic of the application), and a data-tier. The data-tier consists primarily of a logical database (and all the schemas, tables, views, and so on it contains) but it also includes server-level objects (such as any logins that the middle-tier uses to connect to the database server) and the physical database and log files used to store the database.

In the past, deploying or migrating the data-tier of an application has involved examining the database to find its server-level dependencies and physical storage properties, moving the database from its test/staging server to the production server (via backup and restore, SSIS, or a Transact-SQL script to recreate the database schema and data – taking into account any differences in physical storage media), and creating a script to recreate any server-level objects used by the database.

In SQL Server 2008 R2, this task has been simplified through the concept of data-tier applications. Software developers using Visual Studio 2010 will be able to create data-tier applications that encapsulate the entire data tier, or alternatively you can use new wizards in SQL Server Management Studio to create a data-tier application from an existing database, and deploy a data-tier application to a new database.

To create a data-tier application from an existing database, right-click the database you want to package and start the data-tier extraction wizard as shown in the following screenshot.

Picture1

This opens the following wizard screen:

Picture2

The first step is to set the properties of the data-tier application (note that the wizard uses the abbreviation “DAC” – technically, this stands for “Data Tier Application Component”, which you can think of as a unit of deployment, or a deployable package for a data-tier application. The term “data-tier application” is usually taken to mean a deployed instance of a DAC.

Picture3

As well as standard properties such as a name, version, and description for your data-tier application, you specify the file location where the DAC package should be created.

Picture4

The wizard then examines the database and its dependencies, and lists the objects that will included in the DAC. In the November CTP, not all database objects are supported in DACs – for example, you can’t include columns with spatial data types such as geometry or geography. The list of supported objects will no doubt expand over time. In this example, the wizard has identified the database objects included in the database, and also the users and associated logins that are required.

Picture5

Finally, the wizard builds the package for the DAC. The package itself is a single file with the extension .dacpac, as shown here:

Picture6

This file is actually a zip archive that contains a number of XML files describing the components of the DAC. If you append a.zip extension to the filename, you can examine these files as shown here:

Picture7

To deploy the data-tier application defined in the DAC, right-click the server you want to deploy it to and click Deploy Data-tier Application:

Picture8

This starts another wizard, as shown here:

Picture9

The first step is to select the DAC package file you want to deploy:

Picture10

Then you can change the database name and file locations if desired.

Picture11

The wizard summarizes the settings, …

Picture12

…,and then deploys the data-tier application to the server.

Picture13

You can then use SQL Server Management Studio to confirm that the database and any dependent objects has been deployed. In this case, you can see that the MyAppLogin login has been recreated on the target server along with the database.

Picture14

This ability to treat the entire data-tier as a single, encapsulated package should simplify database application deployment and management significantly.

Silverlight 3

This feature allows Silverlight developers to create fun and interactive applications that can be used with standard inputs, such as mouse and keyboard, as well as with touch-enabled devices.

If you have seen Minority Report, you are already aware of the gesture-based technology. The user can interact with the device to drag objects around, flick to navigate, and pinch to adjust the size of an object. These concepts have become a standard feature on a variety of devices, including Microsoft Surface, Windows 7, and mobile phones.

Silverlight 3 provides the fundamentals of receiving touch events from the hardware to the application. By default, the touch events are fired from Windows 7 to the browser (IE / Firefox). If the application is not processing the touch events, these events are registered as standard mouse events.

Here are two sample applications that utilize Multi-touch concepts. You will need a touch-enabled device and Windows 7 to get the full experience.

SlideView

3D SlideView | SlideView

In this two-part blog series, I’ll show you the process that I went through in developing a Silverlight class library with Multi-touch gestures and events. This process was used in SharePoint Silverview to add Silverlight / Windows 7 touch functionality in a SharePoint environment. You can find the complete source code at http://code.msdn.microsoft.com/ssv.

1.2 Online Research

Jesse Bishop, Program Manager on the Microsoft Silverlight team, wrote an amazing article about Multi-touch Gesture recognition in Silverlight 3. The article illustrates on how to register touch events and process standard gestures on individual elements. The primary concept is to have a single entity that reads the incoming events and determine which element that is being accessed. After reading Jesse’s article, I got inspired to extend his concept with a variety of gestures and events that can be used in a standard Silverlight application.

1.3 Hardware

Before you can develop or run Silverlight application with Multi-touch, you need the right equipment. I have been developing on the Dell SX2210T and the HP TouchSmart IQ586. The HP TouchSmart TX2 is also a good choice. One interesting thing that I learned was the HP TouchSmart IQ586 only had support for a single touch point. There is an updated driver to ensure that the monitor utilizes two touch points. You can check for this by viewing the Pen and Touch information under System Information. It is ideal to have 2 Touch Points, if you plan to support two-finger gestures such as Scale and Rotate. With the recent release of Windows 7, there may be drivers for existing hardware that will need to be updated.

1.4 Touch 101

The Touch framework has two primary concept: the TouchPoint object and the FrameReported event.

The TouchPoint object stores data related to a single touch point. This data is passed from the hardware as the user interacts with the touch device. The number of touch points vary on the supported hardware. The first touch point that is fired to the application is called the primary touch point. The object has two important properties: Position and Action. The Action property stores the current action state, such as Up, Down, and Move. The Up and Down actions are similar to the mouse’s MouseLeftButtonUp and MouseLeftButonDown events. The Move action is the transition action that is constantly called until the user releases the Touch Point, which also invokes the Up action.

The FrameReported event is an application-wide event that sends data from the hardware to the application. One thing to note is that this event is global to the application rather than an individual element. The application doesn’t directly know the element that the event is processing. It is possible to retrieve this information using the VisualTreeHelper.GetPointsUnderCoordinates method. The TouchFrameEventArgs argument has methods of getting information about touch points. You can get the current touch points by calling the GetPrimaryTouchPoint and GetTouchPoint methods.

2. Basic Implementation

Demo | Source Code

2.1 Creating the MultiTouch Class Library

Now, let’s start by creating a class library. The library will be useful for rapidly developing touch applications. We will only need two objects for the library: TouchElement control and TouchProcessor (explained in Jesse’s article).

In Visual Studio 2008 (or Visual Studio 2010 Beta 2), create a new Silverlight Application. Right-click on the Solution in the Solution Explorer and select Add New Project. In the Project Dialog box, select Silverlight Class Library and name it TouchLibrary. Remove the default Class1.cs file.

2.2 TouchElement

We will define the TouchElement control as a content control to allow you to place any element, such as an image, movie clip, or UIElement, into the control. This is not a requirement for deploying Touch applications, but rather a personal choice for development. One useful scenario is having a couple of TouchElement controls with images to allow users to drag and scale images around the user interface.

Right-click on the TouchLibrary and select Add New Item. In the Add New Item Dialog box, select User Control and name it TouchElement. Replace the TouchElement.xaml content with the following:

<ContentControl x:Class="TouchLibrary.TouchElement"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
RenderTransformOrigin="0.5,0.5"
>
<ContentControl.RenderTransform>
<TransformGroup>
<ScaleTransform x:Name="scale" />
<TranslateTransform x:Name="translate" />
TransformGroup>
ContentControl.RenderTransform>
<ContentControl.Template>
<ControlTemplate>
<ContentPresenter Margin="0" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}">
ContentPresenter>
ControlTemplate>
ContentControl.Template>
ContentControl>





Note that this is a Content Control rather than a UserControl. We have added TranslateTransform and ScaleTransform transforms to render the control’s transformation based on the touch events.



Now it’s time for some code action. In Jesse Bishop’s article, he implements the concept using ITouchElement as an interface that describes the supported gestures and ManipulateElement as a UserControl that implements the ITouchElement interface. I decided to merge the code from his elements into the TouchElement content control. I highly recommend checking out his article if you want to learn the details of the concept.



We will implement the Translate and Scale gestures. The Translate gesture occurs when the user drags the element from one position to another. The Scale gesture occurs when the user pinch and scales using two touch points. There may be scenarios when the developer wants to create their own custom translate and scale events. For this reason, we will add support for default transforms as well as add custom events that will send information back to the application.



The TransformEventArgs class stores basic data for both Translate and Scale events.




public class TransformEventArgs : EventArgs

{
public TouchElement.TransformType Type { get; set; }
public Point Translate { get; set; }
public double Scale { get; set; }

public TransformEventArgs(TouchElement.TransformType type, Point translate)
{
Type = type;
Translate = translate;
Scale = 1;
}

public TransformEventArgs(TouchElement.TransformType type, double scale)
{
Type = type;
Scale = scale;
Translate = new Point(0, 0);
}
}





The TransformHandler delegate is used for both events, with the TransformEventArgs object as the second parameter.




public delegate void TransformHandler(object sender, TransformEventArgs e);

public event TransformHandler ScaleChanged;
public event TransformHandler TranslateChanged;





We will add three properties to the TouchElement class. The TouchEnabled property will be used in the TouchProcessor class to check which TouchElement objects need to be processed. The TouchDrag and TouchScale boolean properties enable the default touch behaviors for drag (translate) and scale events. By default, the properties are set to false to allow the user to create their own events.




public bool TouchEnabled

{
get { return (bool)GetValue(TouchEnabledProperty); }
set { SetValue(TouchEnabledProperty, value); }
}

public bool TouchDrag
{
get { return (bool)GetValue(TouchDragProperty); }
set
{
SetValue(TouchDragProperty, value);

if (value)
this.TranslateChanged += new TransformHandler(TouchElement_TranslateChanged);
else
this.TranslateChanged -= new TransformHandler(TouchElement_TranslateChanged);
}
}

public bool TouchScale
{
get { return (bool)GetValue(TouchScaleProperty); }
set
{
SetValue(TouchScaleProperty, value);

if (value)
this.ScaleChanged += new TransformHandler(TouchElement_ScaleChanged);
else
this.ScaleChanged -= new TransformHandler(TouchElement_ScaleChanged);
}
}

public static readonly DependencyProperty TouchEnabledProperty =
DependencyProperty.Register("TouchEnabled", typeof(bool), typeof(TouchElement), new PropertyMetadata(true));

public static readonly DependencyProperty TouchDragProperty =
DependencyProperty.Register("TouchDrag", typeof(bool), typeof(TouchElement), new PropertyMetadata(false));

public static readonly DependencyProperty TouchScaleProperty =
DependencyProperty.Register("TouchScale", typeof(bool), typeof(TouchElement), new PropertyMetadata(false));





The TouchDrag and TouchScale properties connect the default event handlers, which validates the input value and directly updates TouchElement’s transform values.




void TouchElement_ScaleChanged(object sender, TransformEventArgs e)

{
double scale = e.Scale;

double s = this.scale.ScaleX + scale;
double MIN_SCALE = 0.25;
double MAX_SCALE = 5.0;

if (s > MIN_SCALE && s < style="color: rgb(0, 0, 255);">this.scale.ScaleX += scale;
this.scale.ScaleY += scale;
}
else if (s < style="color: rgb(0, 0, 255);">this.scale.ScaleX = MIN_SCALE;
this.scale.ScaleY = MIN_SCALE;
}
else if (s > MAX_SCALE)
{
this.scale.ScaleX = MAX_SCALE;
this.scale.ScaleY = MAX_SCALE;
}
}

void TouchElement_TranslateChanged(object sender, TransformEventArgs e)
{
this.translate.X += e.Translate.X;
this.translate.Y += e.Translate.Y;
}





The TranslateElement and ScaleElement methods calculate the appropriate transforms from the positions based on the touch events. After the value is calculated, the event is fired with the TransformEventArgs as a parameter. This will process the default transformation as well as any custom work that is connected to the event.




private void TranslateElement(Point oldPosition, Point newPosition)

{
double xDelta = newPosition.X - oldPosition.X;
double yDelta = newPosition.Y - oldPosition.Y;

if (yDelta != 0 || xDelta != 0)
RaiseTranslate(new TransformEventArgs(TransformType.TRANSLATE, new Point(xDelta, yDelta)));
}

private void ScaleElement(Point primaryPosition, Point oldPosition, Point newPosition)
{
double prevLength = GetDistance(primaryPosition, oldPosition);
double newLength = GetDistance(primaryPosition, newPosition);

if (prevLength == double.NaN || newLength == double.NaN)
return;

double scale = (newLength - prevLength) / newLength;

if (scale != 0)
RaiseScale(new TransformEventArgs(TransformType.SCALE, scale));
}





The TouchProcessor class calls the TouchPointReported method to process the touch event based on the TouchPoint’s Action property. On the Down action, we collect information on the TouchPoint. If it is the initial touch point, then the position is later used for distance calculation. In the next blog post, I will go into additional functionality that can be added in the TouchDown method, such as a start time for timing touch event for other gestures. On the Touch Up action, we free up the current point. The TouchUp method can also be used to process any gestures, which will be detailed in the next blog post. The Touch Move is where the fun’s at. After the Down action occurs, the Move action constantly runs until the Up action is called. If there is only a single touch point, the TranslateElement method is called. The ScaleElement method is called if there are multiple points. In Jesse’s article, he also has Rotate functionality, which is processed with multiple points.




public void TouchPointReported(TouchPoint touchPoint)

{
switch (touchPoint.Action)
{
case TouchAction.Down:
TouchDown(touchPoint.TouchDevice.Id, touchPoint);
break;
case TouchAction.Move:
TouchMove(touchPoint.TouchDevice.Id, touchPoint);
break;
case TouchAction.Up:
TouchUp(touchPoint.TouchDevice.Id, touchPoint);
break;
};
}

private void TouchDown(int id, TouchPoint touchPoint)
{
_points.Add(id, touchPoint.Position);

if (_points.Count == 1)
{
_startPoint = touchPoint.Position;
_primaryId = id;
}
}

private void TouchMove(int id, TouchPoint touchPoint)
{
Point oldPoint = _points[id];
Point newPoint = touchPoint.Position;

if ((_points.Count == 1 || id == _primaryId))
TranslateElement(oldPoint, newPoint);
else
ScaleElement(_points[_primaryId], oldPoint, newPoint);

_points[id] = newPoint;
}

private void TouchUp(int id, TouchPoint touchPoint)
{
Point oldPoint = _points[id];
Point newPoint = touchPoint.Position;
_points.Remove(id);
}





2.3 TouchProcessor



The TouchProcessor class manages the global touch functionality by connecting the Touch’s FrameReported event. Jesse goes into detail about the TouchProcessor class in his article. Add the following class to the Class Library. The primary difference in this version is the RootElement property, which is used to connect to the current application’s visual root. This property is required for the VisualTreeHelper.FindElementsInHostCoordinates method.




public class TouchProcessor

{
#region Data Members
private static Dictionary<int,TouchElement> touchControllers = new Dictionary<int, TouchElement>();
private static bool _istouchEnabled = false;
#endregion

#region Properties
public static UIElement RootElement
{
get;
set;
}

public static bool IsTouchEnabled
{
get { return _istouchEnabled; }

set
{
if (value && !_istouchEnabled)
Touch.FrameReported += new TouchFrameEventHandler(Touch_FrameReported);
else if (!value && _istouchEnabled)
{
Touch.FrameReported -= new TouchFrameEventHandler(Touch_FrameReported);
touchControllers.Clear();
}

_istouchEnabled = value;
}
}
#endregion

#region Constructor
public TouchProcessor()
{ }
#endregion

#region Events
private static void Touch_FrameReported(object sender, TouchFrameEventArgs e)
{
TouchPointCollection touchPoints = e.GetTouchPoints(null);

foreach (TouchPoint touchPoint in touchPoints)
{
int touchDeviceId = touchPoint.TouchDevice.Id;

switch (touchPoint.Action)
{
case TouchAction.Down:
TouchElement hitElement = GetTouchElement(touchPoint.Position);

if (hitElement != null)
{
if (!touchControllers.ContainsKey(touchDeviceId))
touchControllers.Add(touchDeviceId, hitElement);

// Prevent touch events from being promoted to mouse events (only if it is over a TouchElement)
TouchPoint primaryTouchPoint = e.GetPrimaryTouchPoint(null);
if (primaryTouchPoint != null && primaryTouchPoint.Action == TouchAction.Down)
e.SuspendMousePromotionUntilTouchUp();

ProcessTouch(touchPoint);
}

break;
case TouchAction.Move:
ProcessTouch(touchPoint);
break;
case TouchAction.Up:
ProcessTouch(touchPoint);

touchControllers.Remove(touchDeviceId);
break;
};
}
}
#endregion

#region Touch Process Events
private static void ProcessTouch(TouchPoint touchPoint)
{
TouchElement controller;
touchControllers.TryGetValue(touchPoint.TouchDevice.Id, out controller);

if (controller != null)
controller.TouchPointReported(touchPoint);
}

private static TouchElement GetTouchElement(Point position)
{
foreach (UIElement element in VisualTreeHelper.FindElementsInHostCoordinates(position, RootElement))
{
if (element is TouchElement)
return (TouchElement)element;

// immediately-hit element wasn't an TouchElement, so walk up the parent tree
for (UIElement parent = VisualTreeHelper.GetParent(element) as UIElement; parent != null; parent = VisualTreeHelper.GetParent(parent) as UIElement)
{
if (parent is TouchElement)
return (TouchElement)parent;
}
}

// no TouchElement found
return null;
}
#endregion
}





3. Test the TouchLibrary



In the Silverlight Project, add TouchLibrary to the project’s References. This will allow you to add the custom touch functionality to your project.



In MainPage.xaml, add the following namespace to connect to the new library.




xmlns:touch="clr-namespace:TouchLibrary;assembly=TouchLibrary"             





Add the following to MainPage.xaml to create three TouchElements (two with color rectangles and one with an image). The image source has the project name pre-pended to ensure that it loads the image from the correct project. The TouchDrag and TouchScale properties are enabled to allow you to manipulate the items.




<Grid Background="Black">

<touch:TouchElement TouchDrag="True" TouchScale="True" HorizontalAlignment="Left">
<Rectangle Fill="Red" Width="200" Height="200" />
touch:TouchElement>

<touch:TouchElement TouchDrag="True" TouchScale="True" HorizontalAlignment="Right">
<Rectangle Fill="Blue" Width="200" Height="200" />
touch:TouchElement>

<touch:TouchElement TouchDrag="True" TouchScale="True" HorizontalAlignment="Center" VerticalAlignment="Bottom">
<Image Source="/TouchApp;component/Rocks.jpg" Width="200" Height="200" />
touch:TouchElement>
Grid>





In MainPage.xaml.cs, add the following code to initialize the TouchProcessor object.




TouchProcessor.RootElement = this;

TouchProcessor.IsTouchEnabled = true;





One thing to note is that the Touch functionality doesn’t work in Windowless mode. By default, Windowless mode is set to false and it is a feature that should be used with caution. For more information on the limitations of Windowless mode, check out this article.



Compile and run the application. As mentioned before, you will need the required hardware to recognized the Touch events. You can drag the three items across the screen as well as scale them to different sizes. The item is also brought to the front of the screen after release the touch point.



The demo of this version can be found here.



Screenshot



4. Wrapping Up



Thanks for checking out this article. Stay tuned for my next blog post, where I introduce more customization for the TouchLibrary, including Gesture support, parented selection, and touch events in a ChildWindow.



http://www.silverlighttoys.com/Articles.aspx?Article=SilverlightMultiTouch

First Steps with the Silverlight Bing Maps Control

A while back, I posted an article about displaying spatial data from SQL Server with what was then called the Virtual Earth Maps control. The article demonstrated an application that retrieves information about locations visited by a toy stuffed bear named Beanie, and displays those locations on a map. Since then, the Virtual Earth Map control has been renamed Bing Maps, and a Silverlight version of the map control is now available – so naturally, the time has come to update the Beanie Tracker application.

Unlike the Javascript version of the Bing Maps control, to use the Silverlight Bing Maps control, you need to sign up at the Bing Maps Account Center and obtain a key. However, this is a straightforward process (and free!). Once you have a key, you can create Silverlight applications that display and manipulate the Bing Maps control. To do this, download and install the Bing Maps control. Then create a new Silverlight application and add a reference to the assemblies provided with the control as shown here:

Ref

Now that you have a reference to the Map control, you can add its namespace to a XAML UserControl and include a map object in the Silverlight user interface as shown here, referencing the key you obtained from the Bing Maps Account Center:

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl"
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="500" Width="700" Height="400">











Adding the map control displays a Bing Maps map in Silverlight user interface, enabling users to view the map and interact with it through it’s built in controls for changing the zoom level or view, and moving around the map. However, to add custom functionality, you need to write some code to manipulate the map control.

The Silverlight map control exposes a number of objects with properties and methods you can control programmatically, though some of the functionality in the Javascript version of the control has not been implemented in the Silverlight version. Unfortunately, the functionality that enables you to import a GeoRSS feed as a ShapeLayer onto the map is not implemented in the Silverlight control, so a simpler version of the Beanie Tracker application is required. In this version, I’ve written code to retrieve the GeoRSS feed, and then parse the XML feed and create a pushpin for each GML pos element, as shown here:

private void b1_Click(object sender, RoutedEventArgs e)
{
Uri url = new Uri("../Feed.aspx?data=locations", UriKind.Relative);
WebClient client = new WebClient();
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
client.DownloadStringAsync(url);
}

void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error == null)
{
StringReader stream = new StringReader(e.Result);
XmlReader reader = XmlReader.Create(stream);
string gmlURI = "http://www.opengis.net/gml";

while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element)
{
if (reader.NamespaceURI == gmlURI && reader.Name == reader.Prefix + ":pos")
{
string[] loc = reader.ReadInnerXml().Split(" ".ToCharArray());
double lat = Double.Parse(loc[0]);
double lon = double.Parse(loc[1]);
Pushpin p = new Pushpin();
p.Location = new Location(lat, lon);
map.Children.Add(p);
}
}
}
}
}


How to use ExportSqlCE to migrate from SQL Server to SQL Compact

Release 2.5 of the SQL Compact schema and data script utility Codeplex project contains a new command line utility, named Export2SqlCe, that allows you to export schema and data from a SQL Server 2005/2008 database in a SQL Compact compatible SQL format.

The Export2SqlCe tool does not create a SQL Compact sdf database file, but just creates a T-SQL script , that you can run with a tool like my SqlCeCmd Codeplex utility or SQL Server Management Studio 2008. This approach gives you the flexibility to modify the script in a text editor before creating the sdf file – but requires an extra step.

Below are the steps required to migrate a SQL Server database (tables and table indexes/constraints only) to a SQL Compact database.

First, run Export2SqlCe against your SQL Server database (2005 or 2008 are supported), using a command line similar to:

Export2sqlce "Data Source=(local);Initial Catalog=AdventureworksLT;Integrated Security=True" AW.sqlce

image

This will create a file named C:\aw.sqlce – let’s have a look:

image

This file contains a script to create tables, data and constraints (indexes and foreign keys), all in SQL Compact 3.5 compatible T-SQL dialect.

Then you can either open the aw.sqlce script in SQL Server Management Studio 2008 or use sqlcecmd to create the sdf file and populate the file based on the script – meaning the whole process can be run from a batch file and completely automated!

First create the database:

sqlcecmd -d "Data Source=C:\aw.sdf" -e create

Then run the generated script against the database:

sqlcecmd -d "Data Source=C:\aw.sdf" -i aw.sqlce > log.txt

Examine the log.txt to ensure no errors occurred- search for “error code” - I got an error from AdventureworksLT about an index that referred to a non-existing column. If this happens, modify aw.sqlce to avoid any errors, or modify the source database.

Entire batch file:

Export2sqlce "Data Source=(local);Initial Catalog=AdventureworksLT;Integrated Security=True" AW.sqlce
sqlcecmd -d "Data Source=C:\aw.sdf" -e create
sqlcecmd -d "Data Source=C:\aw.sdf" -i aw.sqlce > log.txt

Access a local SQL Compact database from Silverlight 4

Thanks to the new COM support in Silverlight 4, it is now possible for an elevated OOB application to access a local SQL Compact database. Keep in mind that COM suppport only is available on the Windows platform, not on Mac.

And thanks to the excellent SilverlightCOM Toolkit on Codeplex, it is very easy to use the ADO COM objects from your Silverlight application in a familiar (.NET) manner. In addition to data access, the COM Toolkit also enables access to files and directories, including file contents, registry, environment and starting processes (for now).

In order to enable access to COM objects (on Windows platforms only, of course), the following properties must be set for your Silverlight 4 project (which becomes settings in the AppManifest.xaml file):

image

image

To try this out, you can play with the demo here. Source code for the demo available here.

Install the Silverlight 4 runtime, scroll down to the test application, right click it and select Install:

image

You will get this security warning:

image

Click Install to install and create shortcuts on your Desktop or Start Menu.

This is the contents of the shortcut created:

"C:\Program Files\Microsoft Silverlight\sllauncher.exe" 2619253130.webite.se

The demo application will launch – change the connection string (which is an OLEDB connection string, not a .NET connection string) to use the SQL Compact OLEDB provider, and change the path to point to a SQL Compact file on your local disk:

Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=c:\install\projects\nwtest.sdf

image

Change the SQL statement to a valid statement for your database:

SELECT * FROM [Employees]

Press Connect to open the connection to the database and then press Execute to run the query, and voilá, you are accessing a local SQL Compact database with Silverlight 4!:

image

Note that the COM Toolkit is currently a work in progress, but as you can see, the basic functionality is already there.