75 lines
2.5 KiB
C#
75 lines
2.5 KiB
C#
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;
|
|
using System.Collections;
|
|
|
|
namespace NetMonitorClient
|
|
{
|
|
public partial class Netzmonitor : Form
|
|
{
|
|
private ServiceControl sc;
|
|
public Netzmonitor()
|
|
{
|
|
InitializeComponent();
|
|
InitNetworks();
|
|
this.sc = new ServiceControl("NetMonitorServer");
|
|
}
|
|
|
|
private void Netzmonitor_Resize(object sender, System.EventArgs e)
|
|
{
|
|
if (this.WindowState == FormWindowState.Minimized)
|
|
{
|
|
this.ShowInTaskbar = false;
|
|
this.WindowState = FormWindowState.Minimized;
|
|
}
|
|
}
|
|
|
|
private void trayIcon_MouseDoubleClick(object sender, MouseEventArgs e)
|
|
{
|
|
this.WindowState = FormWindowState.Normal;
|
|
this.ShowInTaskbar = true;
|
|
}
|
|
|
|
private void TrayMenuNet_Click(object sender, EventArgs e)
|
|
{
|
|
ToolStripMenuItem Item = (ToolStripMenuItem)sender;
|
|
Networksetter netsetter = new Networksetter(Item.Name, networkini, sc);
|
|
netsetter.setNetwork();
|
|
this.showPopup(netsetter.getPopupBool(), netsetter.getPopupTitel(), netsetter.getPopupText());
|
|
this.StatusLog.Items.AddRange(netsetter.getLog().ToArray());
|
|
}
|
|
|
|
private void showPopup(bool p, string titel, string text)
|
|
{
|
|
this.trayIcon.BalloonTipTitle = titel;
|
|
if (p)
|
|
{
|
|
this.trayIcon.BalloonTipIcon = ToolTipIcon.Info;
|
|
this.trayIcon.BalloonTipText = text + " gesetzt";
|
|
}
|
|
else
|
|
{
|
|
this.trayIcon.BalloonTipIcon = ToolTipIcon.Error;
|
|
this.trayIcon.BalloonTipText = text + " nicht gesetzt";
|
|
}
|
|
this.StatusbarLabel.Text = this.trayIcon.BalloonTipText;
|
|
this.trayIcon.ShowBalloonTip(200);
|
|
}
|
|
|
|
private void ProgramMenuDateiNetzwerkeAnsehen_Click(object sender, EventArgs e)
|
|
{
|
|
new EditNetworks(EditNetworks.Options.Show).ShowDialog(this);
|
|
}
|
|
|
|
private void ProgramMenuDateiNetzwerkeBearbeiten_Click(object sender, EventArgs e)
|
|
{
|
|
new EditNetworks(EditNetworks.Options.Edit).ShowDialog(this);
|
|
}
|
|
}
|
|
}
|