Quick Tiles Creator

Have you ever need to make some Marketplace 99×99 and 200×200 tiles for your WP7 App?

I had to made plenty of them – transparency is prohibited, so I made very simple and lightweight WP7 TilesCreator.

You can just move your any size transparent (or not) .png over the .exe file, and you obtaining two correct size files with red background.

Just look at screens:

image

image

image

I hope it is helpful!

Here is the application:

http://sdrv.ms/MQ3r5Y

Advertisements

All Windows Phone 7 icons

Browsing the Internet for some Metro UI design language information, I’ve accidently stumbled on a very nice picture at wpcentral.com.

It presents all Windows Phone 7 messaging emoticons. It is working (in color version, not in metro) in Live applications too (Live Messanger, Live Writer etc.)!

emotikony

I hope you enjoy it!

Puszczam oczko 

or maybe…

image

Screenshot of your Windows Phone 7 App (on device)

Have you ever wonder, if it is possible to take screenshot from your Windows Phone 7 device without jailbreak?

It could be very useful, specially in applications using built in camera, accelerometer (for ignite special actions) or multitouch gestures (if you haven’t got multitouch Windows 7 device).

I prepared workaround…

Do you remember WriteableBitmap class and its Render() method, which could render any UI element for bitmap? I’ve used it to render whole PhoneApplicationPage as my screenshot in this code segment:

if (sender is PhoneApplicationPage)
{
    var page = sender as PhoneApplicationPage;
    var bmp = new WriteableBitmap((int) page.ActualWidth,
                                  (int) page.ActualHeight);
    bmp.Render(page, null);
    bmp.Invalidate();
}

Of course it is implemented in PhoneApplicationPage event.

After that we need to save our image to gallery – the easiest way for download it to our PCs.

First of all – some IsolatedStorage:

 

const string tempJpeg = "TempJPEG";

var myStore = IsolatedStorageFile.GetUserStoreForApplication();
if (myStore.FileExists(tempJpeg))
{
    myStore.DeleteFile(tempJpeg);
}

using (var myFileStream = myStore.CreateFile(tempJpeg))
{
    bmp.SaveJpeg(myFileStream, bmp.PixelWidth, bmp.PixelHeight, 0, 85);
}

Next – WP7 method to save it in media library (class MediaLibrary form XNA – you must add reference Microsoft.Xna.Framework):

You can also use SavePictureToCameraRoll() method instead of SavePicture() method – it save picture in camera roll album instead of saved pictures album.

using (var myFileStream = myStore.OpenFile(tempJpeg,
                                           FileMode.Open,
                                           FileAccess.Read))
{
    var library = new MediaLibrary();

    library.SavePicture("SavedPicture.jpg", myFileStream);
    MessageBox.Show("Image saved to saved pictures album");

    //Optional code - see what you've done 🙂
    var pt = new PhotoChooserTask();
    pt.Show();
}

I thought that the best way to implement screenshot in PhoneApplicationPage is make a behavior, so I packed all that code in one class – ScreenShotBehavior : Behavior<PhoneApplicationPage> (System.Windows.Interactivity reference is necessary here). In final version screen shot action is on PhoneApplicationPage double tap event and behavior is avilable only after build with DEBUG constant.

In XAML you should add only this:

<phone:PhoneApplicationPage ...> <i:Interaction.Behaviors> <local:ScreenShotBehavior /> </i:Interaction.Behaviors>

... </phone:PhoneApplicationPage>

That is all – you can download entire solution from here:

http://bit.ly/znSvNE

 

And remember – No to ACTA!

NoToActaExport

Kinect SDK MTS Expo Session

Hello everybody!

18 – 19 October 2011 I was visiting Microsoft Technology Summit Conference, and I had been invited to make an Expo Session about Kinect SDK.

I had some problems with topics choose  – I had only 3×15 minutes. I took IMO best ones:

  1. Basics of Kinect SDK, How it works and something about sensors + DEMO – sensors and skeleton capture
  2. Basics of audio in Kinect, How microphones works + DEMO – beam and audio source tracking. I omitted speech recognition, because environment of expo hall was very loud and it simply was not working.
  3. Business Applications based on Kinect SDK + DEMO – introduction to Kinect Toolkit and HoverButton Control.

Kinect Toolkit is very small right now and I think – if we want to develop serious applications, we should wait for next version.

Slides from presentation: Download here (PL)

In demos I’ve described some snippets:

First demo – First Kinect application:

Runtime nui = new Runtime();

Definition of NUI – first, what we should do to start writing program for Kinect.

nui.Initialize(RuntimeOptions.UseColor | RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking);
nui.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nui_VideoFrameReady);
nui.DepthFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nui_DepthFrameReady);

nui.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color);
nui.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex);

Initialization Kinect sensors.

void nui_VideoFrameReady(object sender, ImageFrameReadyEventArgs e)
{
      NuiVideo.Source = e.ImageFrame.ToBitmapSource();
}
void nui_DepthFrameReady(object sender, ImageFrameReadyEventArgs e)
{
      NuiDepth.Source = e.ImageFrame.ToBitmapSource();
}

Sensors frames event handlers – connecting sensor streams to images.

nui.NuiCamera.ElevationAngle = 0;
nui.Uninitialize();

Control elevation angle by simple slider.

And this is finish of first Kinect application. Next steps is to show how skeleton view works, tell something about microphone sensor in Kinect and finally show how to make simple business app – using hover button and of course Natural User Interface.

Demo files (you have to install Kinect SDK first!): Download here

Beginning

Hey everyone!

My name is Paweł Żochowski and I just begun writing my blog.

I’m Microsoft Student Partner from Poland, interested in natural user interfaces and mobile applications.

After work I’m sailing and training Karate Uśmiech

At this blog I’m going to write about interesting things from my everyday work as developer and trainer.

 

PICT0007

Enjoy!