Server hinzugefügt; Auslesen des Menüs und der Ip adressen

This commit is contained in:
BlubbFish 2010-04-21 11:34:01 +00:00
parent 27b6c5d466
commit 26dbe5cc52
11 changed files with 251 additions and 38 deletions

42
NetMonitor.sln Normal file
View File

@ -0,0 +1,42 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetMonitorCliend", "NetMonitorCliend\NetMonitorCliend.csproj", "{718693A0-06A3-4765-801D-33842861AA61}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetMonitorServer", "NetMonitorServer\NetMonitorServer.csproj", "{7813196F-D729-44A2-81C7-82BB83E207F5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{718693A0-06A3-4765-801D-33842861AA61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{718693A0-06A3-4765-801D-33842861AA61}.Debug|Any CPU.Build.0 = Debug|Any CPU
{718693A0-06A3-4765-801D-33842861AA61}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{718693A0-06A3-4765-801D-33842861AA61}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{718693A0-06A3-4765-801D-33842861AA61}.Debug|x86.ActiveCfg = Debug|Any CPU
{718693A0-06A3-4765-801D-33842861AA61}.Release|Any CPU.ActiveCfg = Release|Any CPU
{718693A0-06A3-4765-801D-33842861AA61}.Release|Any CPU.Build.0 = Release|Any CPU
{718693A0-06A3-4765-801D-33842861AA61}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{718693A0-06A3-4765-801D-33842861AA61}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{718693A0-06A3-4765-801D-33842861AA61}.Release|x86.ActiveCfg = Release|Any CPU
{7813196F-D729-44A2-81C7-82BB83E207F5}.Debug|Any CPU.ActiveCfg = Debug|x86
{7813196F-D729-44A2-81C7-82BB83E207F5}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{7813196F-D729-44A2-81C7-82BB83E207F5}.Debug|Mixed Platforms.Build.0 = Debug|x86
{7813196F-D729-44A2-81C7-82BB83E207F5}.Debug|x86.ActiveCfg = Debug|x86
{7813196F-D729-44A2-81C7-82BB83E207F5}.Debug|x86.Build.0 = Debug|x86
{7813196F-D729-44A2-81C7-82BB83E207F5}.Release|Any CPU.ActiveCfg = Release|x86
{7813196F-D729-44A2-81C7-82BB83E207F5}.Release|Mixed Platforms.ActiveCfg = Release|x86
{7813196F-D729-44A2-81C7-82BB83E207F5}.Release|Mixed Platforms.Build.0 = Release|x86
{7813196F-D729-44A2-81C7-82BB83E207F5}.Release|x86.ActiveCfg = Release|x86
{7813196F-D729-44A2-81C7-82BB83E207F5}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,20 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetMonitorCliend", "NetMonitorCliend\NetMonitorCliend.csproj", "{718693A0-06A3-4765-801D-33842861AA61}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{718693A0-06A3-4765-801D-33842861AA61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{718693A0-06A3-4765-801D-33842861AA61}.Debug|Any CPU.Build.0 = Debug|Any CPU
{718693A0-06A3-4765-801D-33842861AA61}.Release|Any CPU.ActiveCfg = Release|Any CPU
{718693A0-06A3-4765-801D-33842861AA61}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -48,8 +48,6 @@
this.trayIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.trayMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
this.trayMenuNetzwerk = new System.Windows.Forms.ToolStripMenuItem();
this.homeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fhgToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.trayMenu.SuspendLayout();
@ -209,8 +207,6 @@
private System.Windows.Forms.NotifyIcon trayIcon;
private System.Windows.Forms.ContextMenuStrip trayMenu;
private System.Windows.Forms.ToolStripMenuItem trayMenuNetzwerk;
private System.Windows.Forms.ToolStripMenuItem homeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem fhgToolStripMenuItem;
private InIReader networkini;
}
}

View File

@ -25,16 +25,24 @@ namespace NetMonitorCliend
this.WindowState = System.Windows.Forms.FormWindowState.Normal;
}
private void homeToolStripMenuItem_Click(object sender, EventArgs e)
private void TrayMenuNet_Click(object sender, EventArgs e)
{
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);
}
private void fhgToolStripMenuItem_Click(object sender, EventArgs e)
{
this.sc.setNetworkIp("129.26.164.16","255.255.248.0","129.26.160.1");
this.sc.setNetworkDNS("129.26.165.177");
this.sc.setNetworkWINS("129.26.165.167");
}
}
}

View File

@ -25,7 +25,6 @@ namespace NetMonitorCliend
this.trayMenuNetzwerk.Size = new System.Drawing.Size(152, 22);
this.trayMenuNetzwerk.Text = "Netzwerk";
ArrayList networks = networkini.getSections();
ToolStripItem[] tsi = new ToolStripItem[networks.Count];
@ -33,10 +32,10 @@ namespace NetMonitorCliend
foreach (String net in networks)
{
ToolStripMenuItem TrayItemNet = new ToolStripMenuItem();
TrayItemNet.Name = networkini.getValue(net, "Name") + "ToolStripMenuItem";
TrayItemNet.Name = net;
TrayItemNet.Size = new System.Drawing.Size(152, 22);
TrayItemNet.Text = networkini.getValue(net, "Name");
TrayItemNet.Click += new System.EventHandler(this.homeToolStripMenuItem_Click);
TrayItemNet.Click += new System.EventHandler(this.TrayMenuNet_Click);
tsi[i++] = TrayItemNet;
}

View File

@ -1,5 +1,5 @@
[network1]
Name=Home
[network2]
Name=FHG
Ip=auto
Dns=auto
Wins=auto

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7813196F-D729-44A2-81C7-82BB83E207F5}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NetMonitorServer</RootNamespace>
<AssemblyName>NetMonitorServer</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Service1.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Service1.Designer.cs">
<DependentUpon>Service1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
namespace NetMonitorServer
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new Service1()
};
ServiceBase.Run(ServicesToRun);
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NetMonitorServer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NetMonitorServer")]
[assembly: AssemblyCopyright("Copyright © 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("255d9beb-a9f8-4063-bf63-3e1038d3e780")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

37
NetMonitorServer/Service1.Designer.cs generated Normal file
View File

@ -0,0 +1,37 @@
namespace NetMonitorServer
{
partial class Service1
{
/// <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 Component 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()
{
components = new System.ComponentModel.Container();
this.ServiceName = "Service1";
}
#endregion
}
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
namespace NetMonitorServer
{
public partial class Service1 : ServiceBase
{
public Service1()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
}
protected override void OnStop()
{
}
}
}