Save Internet Costs from Yota
Prologue
A couple of months ago, in my city, the Yota wireless operator launched its LTE network. After a little hesitation, I decided it was worth a try - in the hope that things are better with LTE Yota than with 3G from the Big Three operators. And I must say that so far I have not been disappointed in my decision.
And the point is not only that the speed is higher, and the coverage of the city is no worse. Using the Internet from Yota, I spend less money than before. After all, there is such a wonderful speed controller in your account that you can put it to a minimum and increase the speed only when it is really necessary.
Yes, doing this through a browser is not very convenient. So we got to the bottom of the post.
Automation
So, it was decided to write a client to control the speed of the modem. C # was used as a programming language. I confess, I went the easiest way - I used the WebBrowser component. The first version was on Windows Forms, but recently I rewrote the project on WPF. The program and project in Visual Studio are at the end of the post. And now I would like to focus on some aspects.
The first thing I had to deal with was to use the old version of Internet Explorer to display pages in WebBrowser, and in order to use, for example, version 8, you need to add a
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
key in the registry key with the name corresponding to the name of the program containing the DWORD value of 8000. I have allocated a small class for this:using Microsoft.Win32;
using System;
class BrowserEmulation
{
private BrowserEmulation() { }
///
/// Активация эмуляции новой версии
///
/// Название файла приложения
public static void Enable(string appName = null)
{
if (appName == null) appName = AppDomain.CurrentDomain.FriendlyName;
RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", true);
if (regKey != null)
{
try
{
regKey.GetValue(appName).ToString();
}
catch
{
regKey.SetValue(appName, 8000, RegistryValueKind.DWord);
}
}
}
///
/// Дезактивация эмуляции новой версии
///
/// Название файла приложения
public static void Disable(string appName = null)
{
if (appName == null) appName = AppDomain.CurrentDomain.FriendlyName;
RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", true);
if (regKey != null)
{
try
{
regKey.DeleteValue(appName);
}
catch { }
}
}
}
How to add a program to autoload is written on almost any fence, so it makes no sense to describe it.
Regarding restarting the WPF application, for this I have a very tiny class:
using System.Windows.Forms;
class Restart
{
private Restart() { }
public static void Go()
{
Application.Restart();
System.Windows.Application.Current.Shutdown();
}
}
It is worth recognizing that, in general, there is nothing interesting in the program code.
Result
Authorization window:
Loading:
Speed control:
Settings window:
You can download: Always up-to-date version of the program or Visual Studio 2012 Project