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

Unknown's avatar

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 comment

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