Modifying the sensitivity of S-Pen

Recently I bought Samsung Galaxy Note II and found out that there was a problem. The S-Pen was not recognized at the bottom right corner of the screen.

The Samsung service centre said, this is a problem with S-Pen and they would replace it. Unfortunately since stocks were not available I was requested to come later.

Meanwhile I came across a post at Phandroid and it worked great for me.

The following is what I did.

Open the S-Pen’s click button (at green highlighted part in the below image) using a razor or small screw driver (just be careful not to break it) and then adjust a potentiometer (red highlighted part).

Turn clockwise to decrease sensitivity and counter-clockwise to increase the sensitivity.

I had to turn counter-clockwise by 0.5 mm and it’s perfect now.

Bringing Window to front in WPF

Recently I was working on WPF application where the Window would be minimized to tray and when user click’s the tray icon, the window has to show up in front of other windows.

I tried lot many variants and had trouble with Windows 7 and Windows 2008 R2. The following code finally worked for me.

Note: This code was present in the Window which was supposed to be controlled. If required replace “this” with actual reference of the Window.

if (!this.IsVisible)
{
    this.Show();
}
this.WindowState = WindowState.Normal;
this.Activate();
this.Topmost = true;
this.Topmost = false;
this.Focus();