-> IPScanner implemented

This commit is contained in:
2022-01-17 22:25:15 +01:00
parent bb6c229875
commit f7b63cb8e1
4 changed files with 28 additions and 37 deletions

View File

@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:Networking.Pages"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" Background="White">
<WindowsFormsHost HorizontalAlignment="Left" Height="450" VerticalAlignment="Top" Width="800">
<WindowsFormsHost>
<local:WF_IPScanner/>
</WindowsFormsHost>
</UserControl>

View File

@@ -1,7 +1,9 @@
using IPScanner;
using PTConverter.Plugin;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net;
using System.Text;
@@ -19,45 +21,30 @@ using System.Windows.Shapes;
namespace Networking.Pages
{
public class Device
{
public string IP { get; set; }
public string Ping { get; set; }
public string Host { get; set; }
public string Identification { get; set; }
}
/// <summary>
/// Interaktionslogik für Networking.xaml
/// </summary>
public partial class IPScanner : UserControl, IPage
{
public IPScanner()
{
InitializeComponent();
}
public string GetCategory() => "";
public string GetCategory() => "Networking";
public UserControl GetPage() => new IPScanner();
public string GetUnderCategory() => "";
string IPtoString(byte[] array)
{
//
// Concatenate all the elements into a StringBuilder.
//
StringBuilder strinbuilder = new StringBuilder();
for (int i = 0; i < array.Count(); i++)
{
strinbuilder.Append(array[i]);
if (i != array.Count() - 1)
strinbuilder.Append('.');
}
return strinbuilder.ToString();
}
private string GetPingTime(IPScanResult result)
{
if (result.ping > -1)
return result.ping + " ms";
return "N/A";
}
public string GetUnderCategory() => "IPScanner";
}
}

View File

@@ -41,6 +41,7 @@ namespace Networking.Pages
//
// lvIPList
//
this.lvIPList.Activation = System.Windows.Forms.ItemActivation.OneClick;
this.lvIPList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
@@ -50,11 +51,14 @@ namespace Networking.Pages
this.chHost,
this.chRecognized});
this.lvIPList.FullRowSelect = true;
this.lvIPList.GridLines = true;
this.lvIPList.HideSelection = false;
this.lvIPList.Location = new System.Drawing.Point(12, 87);
this.lvIPList.HoverSelection = true;
this.lvIPList.Location = new System.Drawing.Point(0, 32);
this.lvIPList.MultiSelect = false;
this.lvIPList.Name = "lvIPList";
this.lvIPList.Size = new System.Drawing.Size(714, 282);
this.lvIPList.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.lvIPList.Size = new System.Drawing.Size(800, 418);
this.lvIPList.TabIndex = 1;
this.lvIPList.UseCompatibleStateImageBehavior = false;
this.lvIPList.View = System.Windows.Forms.View.Details;
@@ -62,7 +66,7 @@ namespace Networking.Pages
// chIP
//
this.chIP.Text = "IP";
this.chIP.Width = 93;
this.chIP.Width = 191;
//
// chPing
//
@@ -71,18 +75,18 @@ namespace Networking.Pages
// chHost
//
this.chHost.Text = "Host";
this.chHost.Width = 88;
this.chHost.Width = 241;
//
// chRecognized
//
this.chRecognized.Text = "Recognized as";
this.chRecognized.Width = 119;
this.chRecognized.Width = 296;
//
// btnScan
//
this.btnScan.Location = new System.Drawing.Point(323, 58);
this.btnScan.Location = new System.Drawing.Point(319, 4);
this.btnScan.Name = "btnScan";
this.btnScan.Size = new System.Drawing.Size(75, 23);
this.btnScan.Size = new System.Drawing.Size(112, 23);
this.btnScan.TabIndex = 7;
this.btnScan.Text = "Scan";
this.btnScan.UseVisualStyleBackColor = true;
@@ -91,7 +95,7 @@ namespace Networking.Pages
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 64);
this.label1.Location = new System.Drawing.Point(5, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(50, 13);
this.label1.TabIndex = 6;
@@ -99,7 +103,7 @@ namespace Networking.Pages
//
// tbIPRange
//
this.tbIPRange.Location = new System.Drawing.Point(66, 61);
this.tbIPRange.Location = new System.Drawing.Point(62, 6);
this.tbIPRange.Name = "tbIPRange";
this.tbIPRange.Size = new System.Drawing.Size(251, 20);
this.tbIPRange.TabIndex = 8;

View File

@@ -9,7 +9,7 @@
Title="MainWindow" Height="450" Width="800">
<Grid>
<Pages:IPScanner HorizontalAlignment="Left" Height="336" Margin="0,55,0,0" VerticalAlignment="Top" Width="782"/>
<Pages:IPScanner Margin="0,0,34,10"/>
</Grid>
</Window>