netmonitor/NetMonitorClient/Form1.cs

49 lines
1.5 KiB
C#
Raw Normal View History

2010-04-15 23:43:12 +02:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
2010-04-21 13:48:40 +02:00
namespace NetMonitorClient
2010-04-15 23:43:12 +02:00
{
public partial class Netzmonitor : Form
{
2010-04-16 11:51:46 +02:00
private ServiceControl sc;
2010-04-15 23:43:12 +02:00
public Netzmonitor()
{
InitializeComponent();
InitNetworks();
2010-04-16 11:51:46 +02:00
this.serviceController1.ServiceName = "NetMonitorServer";
this.sc = new ServiceControl(this.serviceController1);
}
private void trayIcon_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.WindowState = System.Windows.Forms.FormWindowState.Normal;
}
private void TrayMenuNet_Click(object sender, EventArgs e)
2010-04-16 11:51:46 +02:00
{
ToolStripMenuItem Item = (ToolStripMenuItem)sender;
String ip = networkini.getValue(Item.Name, "Ip");
String subnet = networkini.getValue(Item.Name, "Subnet");
String gateway = networkini.getValue(Item.Name, "Gateway");
String dns = networkini.getValue(Item.Name, "Dns");
String wins = networkini.getValue(Item.Name, "Wins");
if (ip == "auto" && dns == "auto" && wins == "auto")
this.sc.setNetworkAuto();
else
{
this.sc.setNetworkIp(ip, subnet, gateway);
this.sc.setNetworkDNS(dns);
this.sc.setNetworkWINS(wins);
}
2010-04-16 11:51:46 +02:00
2010-04-15 23:43:12 +02:00
}
}
}