Introduction
In many situations, I needed to control wi-fi status on my PC. Tuning on/off automatically [midnight > morning] well, because my ISP doesn't invoice on traffic in that interval, and some programs need/use large amount of data..


Background
This is an easy way is to use command prompt cmd.exe.
netsh.exe does the job. [under administrator privileges]*
Enable Interface: netsh interface set interface "interfaceName" enable
Disable Interface: netsh interface set interface "interfaceName" disable
Using the Code
In brief, running this command in C#. By starting netsh.exe process with the above explained arguments:
private enum Status
{
Online,
Offline
}
private static void SetStatus(string interfaceName, Status status)
{
string state = status == Status.Online ? "enable" : "disable";
string arguments = "interface set interface \"{0}\" {1}";
string args = string.Format(arguments, interfaceName, state);
var NetshStartInfo = new System.Diagnostics.ProcessStartInfo("netsh", args)
{
CreateNoWindow = true,
RedirectStandardOutput = true,
UseShellExecute = false,
WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden
};
var Netsh = new System.Diagnostics.Process
{
StartInfo = NetshStartInfo
};
Netsh.Start();
}
The source code includes usage of the application settings to load/save options, Linq expressions, and some WPF styling...
* to run with administrator permission, add to the app.manifest file in solution explorer these line of code into:
<asmv1:assembly ...>
<.../>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</asmv1:assembly>
Points of Interest
It's a light way. Usage is up to certain limits and conditions. Advanced solution can be by scheduling firewall rules on certain programs. And starting them with arguments, etc.
Thanks! 
Bitcoin, Ethereum - Smartcontracts, Full Stack, Architecture & Development, Music!