Notebook FanControl custom use

A user called Grantig on computerbase.de created the tool Notebook FanControl. It is written in C# and uses WCF for communication with a backend service. Using JustDecompile and the information from the config I managed to build my own front-end.

Image courtesy of bplanet
Image courtesy of bplanet / FreeDigitalPhotos.net

The Fancontrol client uses a DispatcherTimer for interval updates. A DispatcherTimer is close related to WPF and needs some extra work for unittesting and other non-WPF programs. So I’m using polling.

// simplified code
var model = new NbfcServiceClient.ViewModels.MainWindowViewModel();
model.PropertyChanged += (s, e) => 
    Console.WriteLine(model.CpuTemperature);
var client = new NbfcServiceClient.FanControlClient(model, 10);
client.StartFanControl();

// polling (done recursive)
Task.Factory.StartNew(() => {
    client.UpdateViewModel();
    Thread.Sleep(10000);
};

References

How to Test a Class Which Uses DispatcherTimer by Josh Smith.
My sources on Github

About erictummers

Working in a DevOps team is the best thing that happened to me. I like challenges and sharing the solutions with others. On my blog I’ll mostly post about my work, but expect an occasional home project, productivity tip and tooling review.
This entry was posted in Development and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.