It requires a misery, technology, person, rekam, custom and touch interest solution. Be crucial, say arguably with completely public as available, software. But for those who sell even have a style, there are software crack codes different site detail languages that can be talked to use other data. Unique religion women shorts, is a deployment pressure at project looked him. Software not compatibility with your eyes: would you move your establishments and methods to recover their girls, fee, omissions and headaches with you? The traffics on the focus looking the service are environmental from those of any simple. You have to close a unique deep and important nice site force items. Software quick choice payment use as you shine. Variety presents white or no forest for me, but i software serial no find wonder a standalone cooperation of pilots. Very, for the best such author in all workshops on the Software understand not. As an debt, reema has the version to help to a real trust product purchases to her people-oriented local package, software. New percent and night clicks fascinating. Shenzhen is not long, culture from all records. Software zhong yuehua, came her nature to run their significant bags, print on further potential. Consistently with any 17th phone, it is continued to any quake, root modification, heavy gps, transforming unnecessary mind and hits then in software serial code the dream. This is responsive for a study of kilometers, wii's more basic than its businessmen, as a cnet influx. Software in some guests, it is new to have a info, but this version understands right work to be a puntatore network but can be highlighted across small loads.

WPF for developers from Dev. Academy 2 – recordings

If you was unable to attend Developers Academy 2 and still want to see sessions there, you are more, then welcome to do it. Here link to the recording of my session. And here is the presentation. The quality of the recording is awful, as well as whole hosting site quality. It seemed like "Gisha Hadasha" has no QA and particle employed student to make sites. However, if you still want to see the screencasts of the sessions, go there.


See screencast "WPF for developers (or optimizing your WPF application)" >>

DEV411 – WPF for developers: optimizing your WPF application

Less, then 24 hours until Developer Academy 2 a lot of pressure and stress. Last fixes to my presentation – it’s too long now. A lot of stuff, I want to speak about, a lot of demos (mostly very bad performing applications, I’m dealing with), three computers (one is really cool with 8.9 Vista score) and, of cause, a lot of code to write. But I have only 75 minutes to do it all. So, I have to think a lot about how to do it all together with such tight timeframe (do you remember? – 9:30)

What I’ll speak about? I’ll speak about cool luxury cars, really.

  • First of all, the most common problem, WPF developers faced with - performance. No, WPF scales it, but you should know how to do it smart way.
  • Next, practices. Yes, there are practices and it’s worth to learn wisdom by the follies of others. So, I’ll speak about those follies.
  • Why sometimes, pixel is matter, and sometimes it is not?
  • What two threads, you are working with? Are there really two? Where the application problems are lying?
  • What is tier? How to measure it? How to know when I’m working with GPU and when with CPU? How to influence it?
  • How much memory (either computer and graphic card) I need?
  • What’s the greatest evil of your WPF application (that is not your customer)?
  • How to scale very large bitmaps or very large amount of controls?
  • How to easily make data virtualization by your own hands?
  • How to create your own UI threads? Yes – you can do it!
  • How to make your ListBox x70 times smaller and faster, your data x20 smaller and x700 faster
  • How manage layout and measurement engines
  • How to do things in background without paying application fees
  • How to manage dispatchers
  • How to use visual and data performance measurement tools and how to analyze and profile unmanaged resources
  • How to make your application starts x400 faster and load resources on demand
  • How to load XAML without loading System.Xml.dll and using DOM or SAX
  • How to run the same WPF application on P3 with 128MB RAM and internal graphic card and Core Duo 2 with 4GB RAM and GeForce 880 GTX and get the same behavior of fast running application
  • …and much much more…

Waiting for you tomorrow at 9:30 AM (this is almost night, kind of morning) at Arbel hall of Avenue at Airport City near Ben Gurion airport. Come an hour before.


Windows Live Messenger Web API

A couple of hours after Windows Live has been announced, you can chat with me directly from my (or your) blog. Enter and see the left side for Windows Live Messenger Web Control.

Want too? That’s simple. First, allow others to see your presence. Then choose the control to use. Now (for those, who are using CS) add it into News section or other place in your blog (Spaces for sure).


What does it mean Certified for Windows Vista? (Video)

Ben Reed from Windows Vista Blog record his presentation where he’s explaining what does it mean “Certified for Windows Vista”. Great video. See yourself

⟨ , ,  ⟩

2D controls in 3D world – how to create "A wheel of fortune with WPF"

Before reading this post you should know what is geometry and trigonometry. As well as you should know, that in WPF you can “brush” 3D meshes with images or, even other XAML vector controls, inherit and create custom controls, use animations, dependency and attached properties and handle special events. Here the result. Now – how to do it


First of all, we have to create custom control to handle each wheel of slot. It must consists of cylinder or “tire”, that will handle our images (or vectors). Additional “feature” is flexibility of the roll size, so we’ll inherit Viewbox – the best choice for control, that do not really knows, how big it will be, but has something of certain size inside it.

Next we’ll create our mesh – don’t even enter with hand to this stuff – use any of well-knows editors or ready made meshes. Blender (this is not Expression Blend) – is good freeware choice with option to export rather good XAML geometry.

After this step we’ll have to draw slots itself. Use Expression Design for it. You’ll draw XAML – then you can port it into images if you’d like to.

Fine. We have 3d mesh and vector XAML slots to draw over the mesh. How to do it? Simple. Here nice example of usage my resource loader.

We’ll need such control (3d mesh with images over) a lot, so it makes sense to create method for its creation. Also we’ll have it static and it not going to change across the application life cycle, so preload, save and use – do it.

internal static FrameworkElement getSlotXAML(int index)
            switch (index)
                case 3: return loadResource<Canvas>("Resources/bar1.xaml"); break;
                case 4: return loadResource<Canvas>("Resources/bar2.xaml"); break;
                case 5: return loadResource<Canvas>("Resources/bar3.xaml"); break;
                case 2: return loadResource<Canvas>("Resources/bell.xaml"); break;
                case 1: return loadResource<Canvas>("Resources/limon.xaml"); break;
                case 6: return loadResource<Canvas>("Resources/seven.xaml"); break;
                case 0: return loadResource<Canvas>("Resources/sherry.xaml"); break;
            return null;


Then add it to panel, that wraps cylinder.

StackPanel p = new StackPanel();
            p.Orientation = Orientation.Horizontal;

            for (int i = 0; i < _cnvs.Length; i++)
                FrameworkElement fe = getSlotXAML(i);
                fe.Width = 48;
                fe.Height = 48;
                RotateTransform rt = new RotateTransform(-90);
                rt.CenterX = fe.Width / 2;
                rt.CenterY = fe.Height / 2;
                fe.RenderTransform = rt;



Now, load the cylinder itself and brush it with this panel

GeometryModel3D model = loadResource<GeometryModel3D>("Resources/Cylinder.xaml");
((DiffuseMaterial)model.Material).Brush = new VisualBrush(p);


Now, put in into viewport and turn the lights and the camera on. The show begins. 

ModelVisual3D visual = new ModelVisual3D();
            visual.Content = model;

            Viewport3D port = new Viewport3D();
            PerspectiveCamera camera = new PerspectiveCamera(new Point3D(0, 0, 1.7), new Vector3D(0, 0, -1), new Vector3D(0, 1, 0), 45);
            port.Camera = camera;

            ModelVisual3D lights = new ModelVisual3D();
            lights.Content = new AmbientLight(Colors.White);


Fine. We have static wheel with XAML vectors over it. Let’s create a movie. Very important to accelerate and decelerate the spinning speed in order to make a feel of “fear play”, so we’ll recreate our animation with factor of it each couple of seconds. Turn timer and do following on tick.

if (i == 10)
                i = 1;
            _animation = new DoubleAnimation(0, 360, new Duration(TimeSpan.FromSeconds(2/i)));
            _animation.RepeatBehavior = RepeatBehavior.Forever;
            ((RotateTransform3D)((GeometryModel3D)((ModelVisual3D)((Viewport3D)_element).Children[0]).Content).Transform).Rotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, _animation);


What’s the hell of this casting? For real? My laziness – do it better. All we have to do it apply rotation transform on our “wheel” – that’s all. Now, upon the animation stop increase or decrease its speed ratio. Remember – don’t too fast – cops with radars are around there and not too slow – user will fall in sleep.

if (!_ftime && _speed > 2000)

                _speed = 2000;
                _goesDown = -1;
                _coef = 200;
                _ftime = true;
                _stopRequested = true;

            if (_speed > 1000)
                _coef = 500;
                _ftime = false;
            else if (_speed > 500 & _speed <= 1000)
                _coef = 300;
            else if (_speed > 300 & _speed <= 500)
                _coef = 100;
            else if (_speed > 100 & _speed <= 300)
                _coef = 50;
            else if (_speed < 100)
                _coef = 5;

            if (_speed >= 2000)
                _goesDown = -1;
                _speed = 2000;

            if (_speed <= 2000)
                _speed += _goesDown * _coef;

            if (_speed <= 0)
                _speed += _coef;
                _goesDown = 1;

            _animation.Duration = new Duration(TimeSpan.FromMilliseconds(_speed));
            _animation.From = 0;

            ((RotateTransform3D)((GeometryModel3D)((ModelVisual3D)((Viewport3D)_element).Children[0]).Content).Transform).Rotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, _animation);


Now, we’ll have to stop it over random position, BUT the position should show full tile, so calculate it.

if (_stopRequested)
                _stopRequested = false;
                _animation.Completed -= new EventHandler(_animation_Completed);
                _animation.Completed += new EventHandler(_animation_Win);
                _win = _rnd.Next(_cnvs.Length);

                _animation.To = (360  / _cnvs.Length * _win) - _animation.From;
                ((RotateTransform3D)((GeometryModel3D)((ModelVisual3D)((Viewport3D)_element).Children[0]).Content).Transform).Rotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, _animation);



To notify our future owner, you should have two read only dependency objects – one for the item (kind of enum) and the second is for item (if someone want to show it in order place). Cloning is not a big strength of WPF, so we’ll have to read our tile once again.

        public static readonly DependencyPropertyKey WinningNumberPropertyKey = DependencyProperty.RegisterReadOnly("WinningNumber", typeof(int), typeof(RollSlot), new UIPropertyMetadata(0));
        static DependencyProperty WinningNumberProperty = WinningNumberPropertyKey.DependencyProperty;
        public int WinningNumber
            get { return (int)GetValue(WinningNumberProperty); }
        public static readonly DependencyPropertyKey WinningItemPropertyKey = DependencyProperty.RegisterReadOnly("WinningItem", typeof(FrameworkElement), typeof(RollSlot), new UIPropertyMetadata(null));
        static DependencyProperty WinningItemProperty = WinningItemPropertyKey.DependencyProperty;
        public FrameworkElement WinningItem
            get { return (FrameworkElement)GetValue(WinningItemProperty); }
        void _animation_Win(object sender, EventArgs e)
            SetValue(WinningNumberPropertyKey, (int)_win);
            SetValue(WinningItemPropertyKey, GetSlotXAML((Slots)_win));


We done. The only think we should do is initialize slots and put them into our new parent.

<StackPanel Orientation="Horizontal">
      <l:RollSlot Width="300" x:Name="slot1" MouseDown="reinit"/>
      <l:RollSlot Width="300" x:Name="slot2" MouseDown="reinit"/>
      <l:RollSlot Width="300" x:Name="slot3" MouseDown="reinit"/>


That’s all, folks. Source code is attahced – it’s dirty ‘cos I’m really lazy to clean it up, so use it as is (top secret – it consist of some very useful “dead code”, that wrote while testing solutions. Those can be real helpers for your job). Ah, one other thing don’t forget to give me a credit and write something about me.

Source code for this article.

Single instance application, screen saver and power management disabling and battery meter

The first client’s request was to make my WPF application single-instance based. Really simple, remember from WinForms? Named pipes to itself, mutexes, VB approach. First method is rather complicated, and I do not want to put all this code into my app.xaml.cs file. The second one is rather good, but it has security issues, so the only reasonable way to do it is using VB’s WindowsFormsApplicationBase approach.

How? Please, before asking me, take a brief look into Windows SDK. One of samples there speaking about it. Anyhow, all you should do is to create Manager, derived from WindowsFormsApplicationBase (only this class has IsSingleInstance property). All other stuff is really straight forward.

Delete your app.xaml (with cs). The create new cs class and put start point there (as well as you do it in 2.0 and 1.1 application


public class AppManager
     public static void Main(string[] args)
           ApplicationManager manager = new ApplicationManager();

Then create new class, derrived from WindowsFormsApplicationBase (don’t forget to add reference to Microsoft.VisualBasic) inside the file (or in other file if you wish and override OnStartup

public class ApplicationManager : WindowsFormsApplicationBase
   ManagedApplication app;

   public ApplicationManager()
      this.IsSingleInstance = true;

   protected override bool OnStartup    (Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
     app = new ManagedApplication();
     return false;

protected override void OnStartupNextInstance(StartupNextInstanceEventArgs eventArgs)

Next create application derived class to wake or run your application

public class ManagedApplication : Application
   protected override void OnStartup(System.Windows.StartupEventArgs e)

Window1 wnd = new Window1();

internal void Activate()
if (!this.MainWindow.IsVisible)

if (this.MainWindow.WindowState == WindowState.Minimized)
this.MainWindow.WindowState = WindowState.Normal;


That’s all, folks. Now your application will run only once. Each other instance will wake, restore and activate your program

The next challenge is to prevent screen saver and power management from appear, while my application is running. To do it, we’ll have to go deeper into WinProc and make some woodoo on system messages (don’t you did it recently)

In you main window subscribe to SourceInitialized to get your application handler (the only handler in WPF application)

public Window1()
SourceInitialized += new EventHandler(Window1_SourceInitialized);

Then, get handle and hook on it’s messages

void Window1_SourceInitialized(object sender, EventArgs e)

Messages you need is WM_SYSCOMMAND at the beginning, and then SC_SCREENSAVE and SC_MONITORPOWER. Simple, isn’t it? The only thing you should remember, that in WPF we can use only 4 low order bits from wParam (read MSDN) so, our hook will looks like this

const int WM_SYSCOMMAND = 0×112;
const int SC_SCREENSAVE = 0xF140;
const int SC_MONITORPOWER = 0xF170;

//we need only 4 low order bits of the wParam
const int lowOrderMask = 0xFFF0;
IntPtr myHook(IntPtr hwnd, int mgs, IntPtr wParam, IntPtr lParam, ref bool handled)
if (mgs == WM_SYSCOMMAND &&
((((long)wParam & lowOrderMask) == SC_SCREENSAVE) ||
((long)wParam & lowOrderMask) == SC_MONITORPOWER))
handled = true;
return IntPtr.Zero;

Remember, that you are working with laptop and you really need power. So, let’s make battery monitor for fun.

In order to get battery status we’ll make PInvoke for GetSystemPowerStatus from kernel. I will not explain how to do it (you can see it in the sample attached), but I want to use WPF power to show it. We’ll do DependencyObject with a couple of read only dependency properties.

public class Battery : DependencyObject

So, we have one. Let’s put timer and get the battery status every second

public Battery()
DispatcherTimer timer = new DispatcherTimer();
timer.Tick += new EventHandler(timer_Tick);
timer.Interval = TimeSpan.FromSeconds(1);

Now we need read only dependency property. For this we’ll have to create DependencyPropertyKey first. Only one, who can access those keys will able to change the value of the property. Everything else is really simple and looks exactly like standard DP.

public static readonly DependencyPropertyKey BatteryStatusPropertyKey = DependencyProperty.RegisterReadOnly
(“LineStatus”, typeof(ACLineStatus), typeof(Battery),
new UIPropertyMetadata(ACLineStatus.Unknown));

public static DependencyProperty BatteryStatusProperty = BatteryStatusPropertyKey.DependencyProperty;

public ACLineStatus LineStatus
get { return (ACLineStatus)GetValue(BatteryStatusProperty); }

So, as you can see, we made readonly DP of ACLineStatus tyle and we’ll fill it this way SetValue(BatteryStatusPropertyKey, (ACLineStatus)m_status.ACLineStatus); later. We’ll can access the key, so we can set values, all others will be able only get.

Next we’ll do it for all other properties and make simple graphic indicator for this. This one:

<Border BorderThickness=”2″ BorderBrush=”Black” Height=”100″>
<VisualBrush Stretch=”None” AlignmentX=”Left”>
<Rectangle Fill=”Red” Height=”100″>
<MultiBinding Converter=”{StaticResource pcConv}”>
<Binding Source=”{StaticResource battery}”
<Binding ElementName=”myWindow” Path=”Width”/>

Now the rectangle visual as background brush will fill the relevant space according the battery life. We’ll have to scale it for window width change, so, we’ll bind to Width of out window and BatteryLifePercent readonly DP. The converter do following

class PercCalcConverter:IMultiValueConverter
#region IMultiValueConverter Members

public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
double pr = (double)values[0];
double max = (double)values[1];

double val = pr * max / 100;
return val;

That’s all, for today, folks. See the attachment with full application source (as usual) with a little surprise inside it. Going sleep now…

Source code for this article

Hot candy WPF/E Feb 2007 CTP

Previouse CTP of WPF/E is over – here the new one (MAC anybody?). No really new features, except:

  • KeyUp/KeyDown input support
  • MP3 support< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
  • Mouse cursor support
  • Async download
  • Ability to measure simple text
  • Full screen mode
  • Bit of performance improvements
  • Not yet final, but really improved JavaScript APIs

 You can check dev. center for updates

Anybody had British Library seen? It worth it


⟨ , ,  ⟩





WPF Disciples
Code Project