Changed a lot
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ClassDiagram MajorVersion="1" MinorVersion="1">
|
||||
<Class Name="NetMonitorTray.Controller.Tray">
|
||||
<Position X="7.75" Y="1" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>ACAAAAAAIAAAAAAIAgEAAAAAAAAAAAIIBEAAAAAAAAI=</HashCode>
|
||||
<FileName>Controller\ControllerTray.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="NetMonitorTray.Controller.Window" Collapsed="true">
|
||||
<Position X="0.5" Y="2.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIIAAAAAAAAAAg=</HashCode>
|
||||
<FileName>Controller\ControllerWindow.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="NetMonitorTray.Models.Tray">
|
||||
<Position X="9.25" Y="1" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAgAAwAAAAABAAAAQAAAIAAAAAIAAEAAg=</HashCode>
|
||||
<FileName>Models\ModelTray.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="NetMonitorTray.Models.Window" Collapsed="true">
|
||||
<Position X="2.25" Y="2.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAIAAAAAAAAAAAAAAIAAAAAAAAAAAIgAAQAAAAAACA=</HashCode>
|
||||
<FileName>Models\ModelWindow.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="NetMonitorTray.Program" Collapsed="true">
|
||||
<Position X="0.5" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAA=</HashCode>
|
||||
<FileName>Program.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="NetMonitorTray.Properties.Resources" Collapsed="true">
|
||||
<Position X="2.25" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>SAACCAAAAAACAAAAEAgBEAAAAQAAAAAAAAAAAAAAAIA=</HashCode>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="NetMonitorTray.View.Tray">
|
||||
<Position X="6.25" Y="1" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAhAQIAAACAAAAAAEAAMAAAEAACAAAIAAAgAAAAEAAQ=</HashCode>
|
||||
<FileName>Views\ViewTray.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="NetMonitorTray.View.Window" Collapsed="true">
|
||||
<Position X="4" Y="2.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AQAAAAAAACAAAAAAAAAAAAAAAAAAAAIAAAgAAAAEAAA=</HashCode>
|
||||
<FileName>Views\ViewWindow.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="NetMonitorTray.View.ViewWindowForm" Collapsed="true">
|
||||
<Position X="4" Y="1.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAEAAAAACCAAABAAAACAEAECAwAAAAACACAAIIAIBAE=</HashCode>
|
||||
<FileName>Views\ViewWindowForm.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Font Name="Segoe UI" Size="9" />
|
||||
</ClassDiagram>
|
||||
@@ -0,0 +1,140 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using NetMonitorUtils;
|
||||
using BlubbFish.Utils;
|
||||
|
||||
namespace NetMonitorTray.Controller {
|
||||
public class Tray : OwnController {
|
||||
private static View.Tray tray;
|
||||
private static OpenVpnSetter vpn;
|
||||
private static NetworkSetter network;
|
||||
private static Controller.Window window;
|
||||
/// <summary>
|
||||
/// Tray Controller
|
||||
/// </summary>
|
||||
public Tray() {
|
||||
vpn = new OpenVpnSetter("vpn.ini", "config.ini");
|
||||
network = new NetworkSetter("network.ini", "config.ini");
|
||||
}
|
||||
/// <summary>
|
||||
/// Init!
|
||||
/// </summary>
|
||||
override protected void init() {
|
||||
tray = new View.Tray();
|
||||
window = new Controller.Window();
|
||||
tray.setWorkingIcon();
|
||||
try {
|
||||
tray.Model.connectedStatus = false;
|
||||
List<string> vpns = tray.Model.getVpnList();
|
||||
tray.Model.VpnSelected = vpn.getStatus(vpns);
|
||||
List<string> adapter = tray.Model.getAdapterList();
|
||||
tray.Model.NetworkSelected = network.getNetwork(adapter);
|
||||
} catch(Exception e) {
|
||||
tray.showError(e.Message);
|
||||
tray.Model.connectedStatus = false;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// User klickt auf den Eintrag Beenden
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
internal static void Click_Quit(object sender, EventArgs e) {
|
||||
tray.Dispose();
|
||||
//Application.ExitThread();
|
||||
Application.Exit();
|
||||
}
|
||||
/// <summary>
|
||||
/// User klick auf einen Eintrag Service Starten/Stoppen
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
internal static void Click_Vpn(object sender, EventArgs e) {
|
||||
tray.setWorkingIcon();
|
||||
|
||||
string[] conf = ((ToolStripMenuItem)sender).Name.Split('|');
|
||||
switch(tray.Model.VpnSelected[conf[1]]) {
|
||||
case "disconnected":
|
||||
case "unknown":
|
||||
try {
|
||||
vpn.setStart(conf[1]);
|
||||
for(int i = 0; i < 10; i++) {
|
||||
string status = vpn.getStatus(conf[1]);
|
||||
if(status.StartsWith("[connected|")) {
|
||||
tray.Model.VpnSelected[conf[1]] = "connected";
|
||||
status = status.Substring(0, status.Length - 1).Substring(1);
|
||||
string[] ip = status.Split('|');
|
||||
tray.setVpn(true, "Verbunden am: " + ip[5] + "\nmit IP: " + ip[1] + "\nConfig: " + conf[1]);
|
||||
break;
|
||||
}
|
||||
System.Threading.Thread.Sleep(3000);
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
tray.Model.connectedStatus = false;
|
||||
tray.showError("Fehler beim starten von Openvpn mit " + conf[1] + ": " + ex.Message);
|
||||
}
|
||||
break;
|
||||
case "connected":
|
||||
try {
|
||||
vpn.setStop(conf[1]);
|
||||
for(int i = 0; i < 10; i++) {
|
||||
string status = vpn.getStatus(conf[1]);
|
||||
if(status == "[disconnected]") {
|
||||
tray.Model.VpnSelected[conf[1]] = "disconnected";
|
||||
tray.setVpn(false, "Config: " + conf[1]);
|
||||
break;
|
||||
}
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
tray.Model.connectedStatus = false;
|
||||
tray.showError("Fehler beim beenden von Openvpn mit " + conf + ": " + ex.Message);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// User klickt Doppelt auf das TrayIcon
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
internal static void Click_Tray(object sender, EventArgs e) {
|
||||
Click_Open(sender, e);
|
||||
}
|
||||
/// <summary>
|
||||
/// User klickt auf den Tray-Ballon
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
internal static void Click_Ballon(object sender, EventArgs e) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
/// <summary>
|
||||
/// User klickt auf einen Eintrag Netzwerk
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
internal static void Click_Network(object sender, EventArgs e) {
|
||||
tray.setWorkingIcon();
|
||||
try {
|
||||
network.setNetwork(((ToolStripMenuItem)sender).Name);
|
||||
string n = ((ToolStripMenuItem)sender).Name;
|
||||
tray.Model.NetworkSelected[n.Split('|')[0]] = n.Split('|')[1];
|
||||
} catch(Exception ex) {
|
||||
tray.showError("Fehler beim setzen des Netzwerks: " + ex.Message);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// User klickt auf den Eintrag Öffnen
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
internal static void Click_Open(object sender, EventArgs e) {
|
||||
window.execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using NetMonitorUtils;
|
||||
using BlubbFish.Utils;
|
||||
|
||||
namespace NetMonitorTray.Controller
|
||||
{
|
||||
public class Window : OwnController
|
||||
{
|
||||
private static View.Window window;
|
||||
/// <summary>
|
||||
/// Tray Controller
|
||||
/// </summary>
|
||||
public Window()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
override protected void init()
|
||||
{
|
||||
window = new View.Window();
|
||||
}
|
||||
|
||||
public static void FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
window.Dispose();
|
||||
}
|
||||
|
||||
internal static void NetworkSelected(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("Angeklickt!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace NetMonitorTray.Controller
|
||||
{
|
||||
public class Tray
|
||||
{
|
||||
private static View.Tray tray;
|
||||
public Tray()
|
||||
{
|
||||
tray = new View.Tray();
|
||||
}
|
||||
public void view()
|
||||
{
|
||||
Application.Run();
|
||||
}
|
||||
/// <summary>
|
||||
/// User klickt auf den Eintrag Beenden
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
internal static void Click_Quit(object sender, EventArgs e)
|
||||
{
|
||||
tray.Dispose();
|
||||
Application.ExitThread();
|
||||
}
|
||||
/// <summary>
|
||||
/// User klick auf einen Eintrag Service Starten/Stoppen
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
internal static void Click_Service(object sender, EventArgs e)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
//tray.showError("Fehler beim Starten/Stoppen von Service!");
|
||||
/*switch (((ToolStripMenuItem)sender).Name)
|
||||
{
|
||||
case "StartService": tray.setService(true); break;
|
||||
case "StopService": tray.setService(false); break;
|
||||
}*/
|
||||
}
|
||||
/// <summary>
|
||||
/// User klickt Doppelt auf das TrayIcon
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
internal static void Click_Tray(object sender, EventArgs e)
|
||||
{
|
||||
//Doppelklick auf das Trayicon
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
/// <summary>
|
||||
/// User klickt auf den Tray-Ballon
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
internal static void Click_Ballon(object sender, EventArgs e)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
/// <summary>
|
||||
/// User klickt auf einen Eintrag Netzwerk
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
internal static void Click_Network(object sender, EventArgs e)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
/// <summary>
|
||||
/// User klickt auf den Eintrag Öffnen
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
internal static void Click_Open(object sender, EventArgs e)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using NetMonitorTray.Properties;
|
||||
using BlubbFish.Utils;
|
||||
|
||||
namespace NetMonitorTray.Models {
|
||||
public class Tray : OwnModel<Tray> {
|
||||
private InIReader networks;
|
||||
private InIReader vpns;
|
||||
private Tray() {
|
||||
this.init();
|
||||
}
|
||||
|
||||
override protected void init() {
|
||||
this.networks = InIReader.getInstance("network.ini");
|
||||
this.vpns = InIReader.getInstance("vpn.ini");
|
||||
}
|
||||
|
||||
internal Dictionary<string, Dictionary<string, Tuple<string, System.Drawing.Bitmap, bool, bool>>> getMenuNetwork() {
|
||||
Dictionary<string, Dictionary<string, Tuple<string, System.Drawing.Bitmap, bool, bool>>> ret = new Dictionary<string, Dictionary<string, Tuple<string, System.Drawing.Bitmap, bool, bool>>>();
|
||||
List<String> l = this.networks.getSections();
|
||||
foreach(String name in l) {
|
||||
String adapter = this.networks.getValue(name, "Adapter");
|
||||
if(ret.Keys.Contains(adapter)) {
|
||||
ret[adapter].Add(adapter + "|" + name, new Tuple<string, System.Drawing.Bitmap, bool, bool>("Netzwerk " + this.networks.getValue(name, "Name"), Properties.Resources.MenuImagesNetwork, true, (this.NetworkSelected.Keys.Contains(adapter) && this.NetworkSelected[adapter] == name)));
|
||||
} else {
|
||||
Dictionary<string, Tuple<string, System.Drawing.Bitmap, bool, bool>> tmp = new Dictionary<string, Tuple<string, System.Drawing.Bitmap, bool, bool>>();
|
||||
tmp.Add(adapter + "|" + name, new Tuple<string, System.Drawing.Bitmap, bool, bool>("Netzwerk " + this.networks.getValue(name, "Name"), Properties.Resources.MenuImagesNetwork, true, (this.NetworkSelected.Keys.Contains(adapter) && this.NetworkSelected[adapter] == name)));
|
||||
ret.Add(adapter, tmp);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
internal Dictionary<string, Dictionary<string, Tuple<string, System.Drawing.Bitmap, bool, bool>>> getMenuVpn() {
|
||||
Dictionary<string, Dictionary<string, Tuple<string, System.Drawing.Bitmap, bool, bool>>> ret = new Dictionary<string, Dictionary<string, Tuple<string, System.Drawing.Bitmap, bool, bool>>>();
|
||||
List<String> l = this.vpns.getSections();
|
||||
Dictionary<string, Tuple<string, System.Drawing.Bitmap, bool, bool>> tmp = new Dictionary<string, Tuple<string, System.Drawing.Bitmap, bool, bool>>();
|
||||
|
||||
foreach(String vpn in l) {
|
||||
String name = this.vpns.getValue(vpn, "Name");
|
||||
String conf = this.vpns.getValue(vpn, "Config");
|
||||
tmp.Add(vpn + "|" + conf, new Tuple<string, System.Drawing.Bitmap, bool, bool>("VPN " + name, Properties.Resources.MenuImagesOpenvpn, true, (this.VpnSelected.Keys.Contains(conf) && this.VpnSelected[conf] == "connected")));
|
||||
|
||||
}
|
||||
ret.Add("OpenVpn", tmp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
private bool connectedStatusValue = false;
|
||||
internal bool connectedStatus {
|
||||
get { return connectedStatusValue; }
|
||||
set { connectedStatusValue = value; this.update(); }
|
||||
}
|
||||
|
||||
private Dictionary<String, String> VpnSelectedValue = new Dictionary<string, string>();
|
||||
/// <summary>
|
||||
/// Item1 = configfile
|
||||
/// Item2 = status ("unknown";"connected";"disconnected")
|
||||
/// </summary>
|
||||
internal Dictionary<String, String> VpnSelected {
|
||||
get { return VpnSelectedValue; }
|
||||
set { VpnSelectedValue = value; this.update(); }
|
||||
}
|
||||
|
||||
private Dictionary<String, String> networkSelectedValue = new Dictionary<string, string>();
|
||||
/// <summary>
|
||||
/// Item1 = adapter
|
||||
/// Item2 = network
|
||||
/// </summary>
|
||||
public Dictionary<String, String> NetworkSelected {
|
||||
get { return networkSelectedValue; }
|
||||
set { networkSelectedValue = value; this.update(); }
|
||||
}
|
||||
|
||||
internal List<string> getAdapterList() {
|
||||
List<String> ret = new List<string>();
|
||||
List<String> l = this.networks.getSections();
|
||||
foreach(String name in l) {
|
||||
String adapter = this.networks.getValue(name, "Adapter");
|
||||
if(!ret.Contains(adapter)) {
|
||||
ret.Add(adapter);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
internal List<string> getVpnList() {
|
||||
List<String> ret = new List<string>();
|
||||
List<String> l = this.vpns.getSections();
|
||||
foreach(String name in l) {
|
||||
String adapter = this.vpns.getValue(name, "Config");
|
||||
if(!ret.Contains(adapter)) {
|
||||
ret.Add(adapter);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using NetMonitorTray.Properties;
|
||||
using BlubbFish.Utils;
|
||||
|
||||
namespace NetMonitorTray.Models
|
||||
{
|
||||
public class Window : OwnModel<Window>
|
||||
{
|
||||
private InIReader networkfile;
|
||||
private Window()
|
||||
{
|
||||
this.init();
|
||||
}
|
||||
|
||||
override protected void init()
|
||||
{
|
||||
this.networkfile = InIReader.getInstance("network.ini");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Listet alle Netzwerke auf
|
||||
/// </summary>
|
||||
public List<string> Networks
|
||||
{
|
||||
get { return this.networkfile.getSections(); }
|
||||
}
|
||||
|
||||
public string getNetworkProperty(string network, string property)
|
||||
{
|
||||
return this.networkfile.getValue(network, property);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fügt ein neues Netzwerk hinzu
|
||||
/// </summary>
|
||||
/// <param name="name">Netzwerkid</param>
|
||||
/// <returns>true if added, false if error</returns>
|
||||
public bool addNetwork(string name)
|
||||
{
|
||||
if (this.networkfile.addSection(name))
|
||||
{
|
||||
this.update();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Löscht ein Netzwerk
|
||||
/// </summary>
|
||||
/// <param name="name">Netzwerkid</param>
|
||||
/// <returns>true if deleted, false if error</returns>
|
||||
public bool removeNetwork(string name)
|
||||
{
|
||||
if (this.networkfile.removeSection(name))
|
||||
{
|
||||
this.update();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using NetMonitorTray.Properties;
|
||||
using BlubbFish.Utils;
|
||||
|
||||
namespace NetMonitorTray.Model
|
||||
{
|
||||
public class Tray : OwnModel<Tray>
|
||||
{
|
||||
private bool serviceRun;
|
||||
private Tray()
|
||||
{
|
||||
this.init();
|
||||
}
|
||||
private void init()
|
||||
{
|
||||
this.serviceRun = false;
|
||||
}
|
||||
|
||||
internal Dictionary<string, Tuple<string, System.Drawing.Bitmap, bool, bool>> getMenuNetwork()
|
||||
{
|
||||
Dictionary<string, Tuple<string, System.Drawing.Bitmap, bool, bool>> ret = new Dictionary<string, Tuple<string, System.Drawing.Bitmap, bool, bool>>();
|
||||
ret.Add("network1", new Tuple<string, System.Drawing.Bitmap, bool, bool>("Netzwerk Home", null, true, false));
|
||||
ret.Add("network2", new Tuple<string, System.Drawing.Bitmap, bool, bool>("Netzwerk Arbeit", null, true, false));
|
||||
ret.Add("network3", new Tuple<string, System.Drawing.Bitmap, bool, bool>("Netzwerk Test", null, true, false));
|
||||
return ret;
|
||||
}
|
||||
|
||||
internal Dictionary<string, Tuple<string, System.Drawing.Bitmap, bool, bool>> getMenuOpenVpnService()
|
||||
{
|
||||
Dictionary<string, Tuple<string, System.Drawing.Bitmap, bool, bool>> ret = new Dictionary<string, Tuple<string, System.Drawing.Bitmap, bool, bool>>();
|
||||
ret.Add("StartService", new Tuple<string, System.Drawing.Bitmap, bool, bool>("Service Starten", Properties.Resources.MenuImagesServerConnect, !this.serviceRun, !this.serviceRun));
|
||||
ret.Add("StopService", new Tuple<string, System.Drawing.Bitmap, bool, bool>("Service Stoppen", Properties.Resources.MenuImagesServerDisconnect, this.serviceRun, this.serviceRun));
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void setService(bool run)
|
||||
{
|
||||
this.serviceRun = run;
|
||||
this.update();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{0B85C838-3295-4FDA-9B07-4F5B3681BE2F}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>NetMonitorTray</RootNamespace>
|
||||
<AssemblyName>NetMonitorTray</AssemblyName>
|
||||
@@ -52,8 +52,10 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Controller\Tray.cs" />
|
||||
<Compile Include="Models\Tray.cs" />
|
||||
<Compile Include="Controller\ControllerTray.cs" />
|
||||
<Compile Include="Controller\ControllerWindow.cs" />
|
||||
<Compile Include="Models\ModelWindow.cs" />
|
||||
<Compile Include="Models\ModelTray.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
@@ -61,13 +63,22 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\Tray.cs" />
|
||||
<Compile Include="Views\ViewWindowForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Views\ViewWindowForm.Designer.cs">
|
||||
<DependentUpon>ViewWindowForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ViewWindow.cs" />
|
||||
<Compile Include="Views\ViewTray.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="icon.ico" />
|
||||
<Content Include="Resources\Icons\door_open.png" />
|
||||
<Content Include="Resources\Icons\server_connect.png" />
|
||||
<Content Include="Resources\Icons\server_delete.png" />
|
||||
<Content Include="Resources\Icons\server_link.png" />
|
||||
<None Include="Resources\Icons\world_link.png" />
|
||||
<Content Include="Resources\working.ico" />
|
||||
<Content Include="Resources\nothing.ico" />
|
||||
<Content Include="Resources\connected.ico" />
|
||||
@@ -77,14 +88,23 @@
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Views\ViewWindowForm.resx">
|
||||
<DependentUpon>ViewWindowForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Utils\Utils\Utils.csproj">
|
||||
<Project>{fac8ce64-bf13-4ece-8097-aeb5dd060098}</Project>
|
||||
<Name>Utils</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\NetMonitorUtils\NetMonitorUtils.csproj">
|
||||
<Project>{45ee003d-5572-48fe-b90e-6bfe18d9eec8}</Project>
|
||||
<Name>NetMonitorUtils</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ClassDiagram1.cd" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace NetMonitorTray
|
||||
@@ -12,7 +13,8 @@ namespace NetMonitorTray
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Controller.Tray t = new Controller.Tray();
|
||||
t.view();
|
||||
t.execute();
|
||||
Application.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+21
-1
@@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.18444
|
||||
// Laufzeitversion:4.0.30319.34209
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
@@ -90,6 +90,26 @@ namespace NetMonitorTray.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap MenuImagesNetwork {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("MenuImagesNetwork", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap MenuImagesOpenvpn {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("MenuImagesOpenvpn", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
||||
@@ -127,6 +127,12 @@
|
||||
<data name="IconWorking" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\working.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="MenuImagesNetwork" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Icons\server_link.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="MenuImagesOpenvpn" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\resources\icons\world_link.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="MenuImagesQuit" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Icons\door_open.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 706 B |
Binary file not shown.
|
After Width: | Height: | Size: 957 B |
@@ -13,27 +13,31 @@ namespace NetMonitorTray.View
|
||||
public class Tray : OwnView
|
||||
{
|
||||
private NotifyIcon trayi;
|
||||
private Dictionary<string, Tuple<string, Bitmap, bool, bool>> menuOpenVpnService;
|
||||
private Dictionary<string, Tuple<string, Bitmap, bool, bool>> menuNetwork;
|
||||
private Dictionary<string, Dictionary<string, Tuple<string, Bitmap, bool, bool>>> menuVpn;
|
||||
private Dictionary<string, Dictionary<string, Tuple<string, Bitmap, bool, bool>>> menuNetwork;
|
||||
|
||||
private Icon[] iconlist = { new Icon(Resources.IconNothing, 40, 40), new Icon(Resources.IconWorking, 40, 40), new Icon(Resources.IconConnected, 40, 40) };
|
||||
|
||||
public Tray()
|
||||
{
|
||||
this.initIcon();
|
||||
Model.Tray.Instance.setObserver(this);
|
||||
this.init();
|
||||
this.Model = Models.Tray.Instance;
|
||||
this.Model.setObserver(this);
|
||||
}
|
||||
|
||||
public override void update()
|
||||
{
|
||||
this.menuOpenVpnService = Model.Tray.Instance.getMenuOpenVpnService();
|
||||
this.menuNetwork = Model.Tray.Instance.getMenuNetwork();
|
||||
this.menuVpn = this.Model.getMenuVpn();
|
||||
this.menuNetwork = this.Model.getMenuNetwork();
|
||||
this.trayi.ContextMenuStrip = this.genMenu();
|
||||
this.trayi.Icon = (this.Model.connectedStatus ? this.iconlist[2] : this.iconlist[0]);
|
||||
}
|
||||
|
||||
private void initIcon()
|
||||
override protected void init()
|
||||
{
|
||||
this.trayi = new NotifyIcon();
|
||||
this.trayi.Visible = true;
|
||||
this.trayi.Icon = new Icon(Resources.IconNothing, 40, 40);
|
||||
this.trayi.Icon = this.iconlist[0];
|
||||
this.trayi.Text = "NetMonitorTray";
|
||||
this.trayi.DoubleClick += Controller.Tray.Click_Tray;
|
||||
this.trayi.BalloonTipClicked += Controller.Tray.Click_Ballon;
|
||||
@@ -48,10 +52,15 @@ namespace NetMonitorTray.View
|
||||
m1.Name = "Open";
|
||||
menu.Items.Add(m1);
|
||||
menu.Items.Add(new ToolStripSeparator());
|
||||
menu.Items.AddRange(this.genMenuIt(this.menuNetwork, Controller.Tray.Click_Network));
|
||||
menu.Items.Add(new ToolStripSeparator());
|
||||
menu.Items.AddRange(this.genMenuIt(this.menuOpenVpnService, Controller.Tray.Click_Service));
|
||||
menu.Items.Add(new ToolStripSeparator());
|
||||
foreach (String adapter in this.menuNetwork.Keys)
|
||||
{
|
||||
menu.Items.AddRange(this.genMenuIt(this.menuNetwork[adapter], Controller.Tray.Click_Network));
|
||||
menu.Items.Add(new ToolStripSeparator());
|
||||
}
|
||||
foreach(String adapter in this.menuVpn.Keys) {
|
||||
menu.Items.AddRange(this.genMenuIt(this.menuVpn[adapter], Controller.Tray.Click_Vpn));
|
||||
menu.Items.Add(new ToolStripSeparator());
|
||||
}
|
||||
ToolStripMenuItem m2 = new ToolStripMenuItem("Beenden");
|
||||
m2.Image = Resources.MenuImagesQuit;
|
||||
m2.Click += Controller.Tray.Click_Quit;
|
||||
@@ -90,21 +99,28 @@ namespace NetMonitorTray.View
|
||||
this.trayi.ShowBalloonTip(100);
|
||||
}
|
||||
|
||||
internal void Dispose()
|
||||
override public void Dispose()
|
||||
{
|
||||
this.trayi.Visible = false;
|
||||
Application.ExitThread();
|
||||
}
|
||||
|
||||
internal void setService(bool run)
|
||||
internal void setVpn(bool run, string ip)
|
||||
{
|
||||
this.showBallonTooltip((run ? "Service erfolgreich gestartet." : "Service erfolgreich beendet"), ToolTipIcon.Info);
|
||||
Model.Tray.Instance.setService(run);
|
||||
this.showBallonTooltip((run ? "OpenVpn erfolgreich gestartet.\n"+ip : "OpenVpn erfolgreich beendet\n"+ip), ToolTipIcon.Info);
|
||||
this.Model.connectedStatus = run;
|
||||
}
|
||||
|
||||
internal void showError(string text)
|
||||
{
|
||||
this.showBallonTooltip(text, ToolTipIcon.Error);
|
||||
}
|
||||
|
||||
public Models.Tray Model { get; private set; }
|
||||
|
||||
internal void setWorkingIcon()
|
||||
{
|
||||
this.trayi.Icon = this.iconlist[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using NetMonitorTray.Properties;
|
||||
using BlubbFish.Utils;
|
||||
|
||||
namespace NetMonitorTray.View
|
||||
{
|
||||
public class Window : OwnView
|
||||
{
|
||||
private ViewWindowForm form;
|
||||
public Window()
|
||||
{
|
||||
this.form = new ViewWindowForm();
|
||||
this.init();
|
||||
this.Model.setObserver(this);
|
||||
}
|
||||
|
||||
public override void update()
|
||||
{
|
||||
this.form.UpdateForm();
|
||||
}
|
||||
|
||||
protected override void init()
|
||||
{
|
||||
this.Model = Models.Window.Instance;
|
||||
this.form.SetModel(this.Model);
|
||||
this.form.Show();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
this.form.BeginInvoke((Action)(() =>
|
||||
{
|
||||
this.form.Dispose();
|
||||
}));
|
||||
}
|
||||
|
||||
public Models.Window Model { get; private set; }
|
||||
}
|
||||
}
|
||||
+209
@@ -0,0 +1,209 @@
|
||||
namespace NetMonitorTray.View
|
||||
{
|
||||
partial class ViewWindowForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.networks = new System.Windows.Forms.TabPage();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.listView1 = new System.Windows.Forms.ListView();
|
||||
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.buttonNetworkAdd = new System.Windows.Forms.Button();
|
||||
this.openvpn = new System.Windows.Forms.TabPage();
|
||||
this.global = new System.Windows.Forms.TabPage();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.logBox = new System.Windows.Forms.TextBox();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.networks.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// statusStrip1
|
||||
//
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 336);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(780, 22);
|
||||
this.statusStrip1.SizingGrip = false;
|
||||
this.statusStrip1.TabIndex = 0;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
// tabControl1
|
||||
//
|
||||
this.tabControl1.Controls.Add(this.networks);
|
||||
this.tabControl1.Controls.Add(this.openvpn);
|
||||
this.tabControl1.Controls.Add(this.global);
|
||||
this.tabControl1.Location = new System.Drawing.Point(12, 12);
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
this.tabControl1.Size = new System.Drawing.Size(591, 321);
|
||||
this.tabControl1.TabIndex = 1;
|
||||
//
|
||||
// networks
|
||||
//
|
||||
this.networks.Controls.Add(this.groupBox2);
|
||||
this.networks.Controls.Add(this.groupBox1);
|
||||
this.networks.Location = new System.Drawing.Point(4, 22);
|
||||
this.networks.Name = "networks";
|
||||
this.networks.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.networks.Size = new System.Drawing.Size(583, 295);
|
||||
this.networks.TabIndex = 0;
|
||||
this.networks.Text = "Netzwerke";
|
||||
this.networks.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Location = new System.Drawing.Point(189, 6);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(388, 283);
|
||||
this.groupBox2.TabIndex = 3;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "groupBox2";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.listView1);
|
||||
this.groupBox1.Controls.Add(this.buttonNetworkAdd);
|
||||
this.groupBox1.Location = new System.Drawing.Point(6, 6);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(177, 283);
|
||||
this.groupBox1.TabIndex = 2;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "groupBox1";
|
||||
//
|
||||
// listView1
|
||||
//
|
||||
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeader1,
|
||||
this.columnHeader2});
|
||||
this.listView1.FullRowSelect = true;
|
||||
this.listView1.GridLines = true;
|
||||
this.listView1.HideSelection = false;
|
||||
this.listView1.Location = new System.Drawing.Point(7, 19);
|
||||
this.listView1.MultiSelect = false;
|
||||
this.listView1.Name = "listView1";
|
||||
this.listView1.ShowGroups = false;
|
||||
this.listView1.Size = new System.Drawing.Size(164, 226);
|
||||
this.listView1.TabIndex = 2;
|
||||
this.listView1.UseCompatibleStateImageBehavior = false;
|
||||
this.listView1.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// columnHeader1
|
||||
//
|
||||
this.columnHeader1.Text = "ID";
|
||||
//
|
||||
// columnHeader2
|
||||
//
|
||||
this.columnHeader2.Text = "Label";
|
||||
this.columnHeader2.Width = 100;
|
||||
//
|
||||
// buttonNetworkAdd
|
||||
//
|
||||
this.buttonNetworkAdd.Location = new System.Drawing.Point(7, 251);
|
||||
this.buttonNetworkAdd.Name = "buttonNetworkAdd";
|
||||
this.buttonNetworkAdd.Size = new System.Drawing.Size(164, 23);
|
||||
this.buttonNetworkAdd.TabIndex = 1;
|
||||
this.buttonNetworkAdd.Text = "Netzwerk Hinzufügen";
|
||||
this.buttonNetworkAdd.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// openvpn
|
||||
//
|
||||
this.openvpn.Location = new System.Drawing.Point(4, 22);
|
||||
this.openvpn.Name = "openvpn";
|
||||
this.openvpn.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.openvpn.Size = new System.Drawing.Size(583, 295);
|
||||
this.openvpn.TabIndex = 1;
|
||||
this.openvpn.Text = "OpenVPN";
|
||||
this.openvpn.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// global
|
||||
//
|
||||
this.global.Location = new System.Drawing.Point(4, 22);
|
||||
this.global.Name = "global";
|
||||
this.global.Size = new System.Drawing.Size(583, 295);
|
||||
this.global.TabIndex = 2;
|
||||
this.global.Text = "Einstellungen";
|
||||
this.global.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(609, 12);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(35, 13);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "label1";
|
||||
//
|
||||
// logBox
|
||||
//
|
||||
this.logBox.Location = new System.Drawing.Point(609, 34);
|
||||
this.logBox.Multiline = true;
|
||||
this.logBox.Name = "logBox";
|
||||
this.logBox.Size = new System.Drawing.Size(163, 295);
|
||||
this.logBox.TabIndex = 3;
|
||||
//
|
||||
// ViewWindowForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(780, 358);
|
||||
this.Controls.Add(this.logBox);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.tabControl1);
|
||||
this.Controls.Add(this.statusStrip1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "ViewWindowForm";
|
||||
this.Text = "NetMonitorTray";
|
||||
this.tabControl1.ResumeLayout(false);
|
||||
this.networks.ResumeLayout(false);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||
private System.Windows.Forms.TabControl tabControl1;
|
||||
private System.Windows.Forms.TabPage networks;
|
||||
private System.Windows.Forms.TabPage openvpn;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox logBox;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Button buttonNetworkAdd;
|
||||
private System.Windows.Forms.TabPage global;
|
||||
private System.Windows.Forms.ListView listView1;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader1;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace NetMonitorTray.View
|
||||
{
|
||||
public partial class ViewWindowForm : Form
|
||||
{
|
||||
private Models.Window model;
|
||||
public ViewWindowForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.FormClosed += Controller.Window.FormClosed;
|
||||
listView1.ItemActivate += Controller.Window.NetworkSelected;
|
||||
}
|
||||
|
||||
public void UpdateForm()
|
||||
{
|
||||
this.BeginInvoke((Action)(() =>
|
||||
{
|
||||
this.logBox.Text = "Loaded";
|
||||
List<string> networks = this.model.Networks;
|
||||
foreach(string network in networks) {
|
||||
ListViewItem item = new ListViewItem();
|
||||
item.Text = network;
|
||||
item.SubItems.Add(this.model.getNetworkProperty(network, "Name"));
|
||||
listView1.Items.Add(item);
|
||||
}
|
||||
|
||||
}));
|
||||
}
|
||||
|
||||
public void SetModel(Models.Window window)
|
||||
{
|
||||
this.model = window;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
Reference in New Issue
Block a user