First I need to say that I never tried this myself, but this is the way I would approach the problem.
This is not a ready solution, but should give you some help forward. There might be more steps I have not thought of.
1. Pair your Bluetooth device with your PC.
2. Implement code to detect paired devices.
This link explains how to find Serial COM ports (including BT devices)
It should be possible to modify the code so you can find paired BT devices only.
Finding Bluetooth paired NXTs with WMI
3. Identify your device.
4. Use polling to see if your device exist in the list or not and is connected.
Polling is easy to implement, but you should do it in a thread so it can be easily aborted.
If the API provides events when devices appears or disappears it is preferable to use the events but I don't know if there is any. You have to read for yourself.
5. If exists, unlock computer; else, lock computer.
This page is for
Bluetooth API. I hope it will be helpful.
Here is another link using 32feet.NET that should work for
Working With Bluetooth Devices Using C# – Part 1
You can decide to implement this as a Windows service that starts automatically when your computer starts or a regular EXE that you start yourself.
Good luck with your project.